Force args.face to be a valid file

This commit is contained in:
Prajwal 2020-10-03 10:51:13 +05:30 committed by GitHub
parent 43419e6135
commit c72e2d0e7c
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -179,9 +179,7 @@ def load_model(path):
def main():
if not os.path.isfile(args.face):
fnames = list(glob(os.path.join(args.face, '*.jpg')))
sorted_fnames = sorted(fnames, key=lambda f: int(os.path.basename(f).split('.')[0]))
full_frames = [cv2.imread(f) for f in sorted_fnames]
raise ValueError('--face argument must be a valid path to video/image file')
elif args.face.split('.')[1] in ['jpg', 'png', 'jpeg']:
full_frames = [cv2.imread(args.face)]