|
24 | 24 | from utils.FaceDetector import FAN, MTCNN
|
25 | 25 | from facenet_pytorch import InceptionResnetV1
|
26 | 26 |
|
| 27 | +from memory_profiler import profile |
| 28 | + |
| 29 | + |
27 | 30 | class FaceVideoDataModule(pl.LightningDataModule):
|
28 | 31 |
|
29 | 32 | def __init__(self, root_dir, output_dir, processed_subfolder=None,
|
@@ -151,6 +154,7 @@ def _get_path_to_sequence_reconstructions(self, sequence_id):
|
151 | 154 | out_folder = Path(self.output_dir) / suffix
|
152 | 155 | return out_folder
|
153 | 156 |
|
| 157 | + @profile |
154 | 158 | def _detect_faces_in_sequence(self, sequence_id):
|
155 | 159 | # if self.detection_lists is None or len(self.detection_lists) == 0:
|
156 | 160 | # self.detection_lists = [ [] for i in range(self.num_sequences)]
|
@@ -222,6 +226,7 @@ def load_detections(fname):
|
222 | 226 | last_frame_id = -1
|
223 | 227 | return detection_fnames, centers, sizes, last_frame_id
|
224 | 228 |
|
| 229 | + @profile |
225 | 230 | def _detect_faces_in_image(self, image_path):
|
226 | 231 | # imagepath = self.imagepath_list[index]
|
227 | 232 | # imagename = imagepath.split('/')[-1].split('.')[0]
|
@@ -658,7 +663,7 @@ def create_reconstruction_video_with_recognition(self, sequence_id, overwrite=Fa
|
658 | 663 | baseoutfile = "video_with_labels.mp4"
|
659 | 664 | else:
|
660 | 665 | baseoutfile = "video_with_labels_thresh_%.03f.mp4" % distance_threshold
|
661 |
| - outfile = vis_fnames[0].parents[1] /baseoutfile |
| 666 | + outfile = vis_fnames[0].parents[1] / baseoutfile |
662 | 667 |
|
663 | 668 | print("Creating reconstruction video for sequence num %d: '%s' " % (sequence_id, self.video_list[sequence_id]))
|
664 | 669 | if outfile.exists() and not overwrite:
|
|
0 commit comments