def main():
    args = parse_args()
    ids = get_original_video_paths(args.root_dir, basename=True)
    os.makedirs(os.path.join(args.root_dir, "landmarks"), exist_ok=True)
    with Pool(processes=os.cpu_count()) as p:
        with tqdm(total=len(ids)) as pbar:
            func = partial(save_landmarks, root_dir=args.root_dir)
            for v in p.imap_unordered(func, ids):
                pbar.update()
Exemple #2
0
def main():
    args = parse_args()
    originals = get_original_video_paths(args.root_dir, basename=True)
    with Pool(processes=os.cpu_count() - 4) as p:
        with tqdm(total=len(originals)) as pbar:
            for v in p.imap_unordered(
                    partial(write_face_encodings, root_dir=args.root_dir),
                    originals):
                pbar.update()
Exemple #3
0
def main():
    """
    This script creates for a given video, a random sample of cropped images. 
    It then uses the python library face_recognition to extract face encodings from each clip and saves these encodings in a file.
    """
    args = parse_args()
    originals = get_original_video_paths(args.root_dir, basename=True)
    with Pool(processes=os.cpu_count() - 4) as p:
        with tqdm(total=len(originals)) as pbar:
            # imap_unordered: this method chops the iterable into a number of chunks which it submits to the process pool as separate tasks.
            # the ordering of the results from the returned iterator are considered arbitrary
            for v in p.imap_unordered(partial(write_face_encodings, root_dir=args.root_dir), originals):
                pbar.update()
Exemple #4
0
def main():
    args = parse_args()
    originals = get_original_video_paths(args.root_dir)
    process_videos(originals, args.root_dir, args.detector_type)