resize = tuple(map(
    int, args.resize.split('x'))) if args.resize is not None else None
crop = tuple(map(int, args.crop.split('x'))) if args.crop is not None else None
trim = tuple(map(float,
                 args.trim.split(':'))) if args.trim is not None else None
flip = {
    'v': 0,
    'h': 1,
    'hv': -1,
    'vh': -1
}[args.flip] if args.flip is not None else None
normalize = args.normalize
crop_center = CropCenter[args.crop_center]

print("Creating directory hierarchy")
create_directories(paths)
print("Fetching models")
fetch_models(paths)

if args.no_label:
    print("Decimating video")
    labeller = None
else:
    print("Decimating video and labelling with {}".format(args.label_with))
    labeller = Labeller.build_from_arguments(args, paths)

decimate_and_label_video(paths,
                         labeller,
                         trim=trim,
                         subsample=args.subsample,
                         subsample_offset=args.subsample_offset,
Exemple #2
0
    p.add_argument('--frame-offset',
                   help='The frame offset for the two datasets',
                   required=True,
                   type=int)
    p.add_argument('--target-label-offset', required=True, type=int)
    p = Labeller.add_arguments(p)

    return p.parse_args()


print("Synthesizing face puppet")

args = parse_arguments()
paths_base = build_paths(args, directory_prefix='base')
paths_out = build_paths(args, directory_prefix='test')
create_directories(paths_out)
labeller = Labeller.build_from_arguments(args, paths_base)
labeller_t = Labeller.build_from_arguments(
    args, paths_base, label_offset=args.target_label_offset)

del labeller.face_labeller.landmarks["right_eyebrow"]
del labeller.face_labeller.landmarks["left_eyebrow"]
del labeller.face_labeller.landmarks["right_eye"]
del labeller.face_labeller.landmarks["left_eye"]

del labeller_t.face_labeller.landmarks["mouth"]
del labeller_t.face_labeller.landmarks["inner_mouth"]
del labeller_t.face_labeller.landmarks["nose"]
del labeller_t.face_labeller.landmarks["jaw"]

base_image_fns = sorted(os.listdir(paths_base.img_dir))