manual load data:
code:
fn_src = 'source.jpg'
fns_tar = ['dest.jpg']
temp = []
for name in os.listdir('data_cnn/'):
name = 'data_cnn/' + name
temp.append(name)
fns_tar = temp
print(fn_src)
print(fns_tar)
out:
source.jpg
['dest.jpg']
then while using :
src, mask, aligned_im, (x0, y0, x1, y1), landmarks = utils.get_src_inputs(fn_src, fd, fp, idet)
tar, emb_tar = utils.get_tar_inputs(fns_tar, fd, fv)
occur error:
Building FAN for landmarks detection...
InvalidArgumentError Traceback (most recent call last)
~/anaconda2/envs/kjj/lib/python3.6/site-packages/tensorflow/python/framework/ops.py in _create_c_op(graph, node_def, inputs, control_inputs)
1627 try:
-> 1628 c_op = c_api.TF_FinishOperation(op_desc)
1629 except errors.InvalidArgumentError as e:
InvalidArgumentError: Shape must be rank 1 but is rank 0 for 'bn10.20053864458101422_5/cond/Reshape_4' (op: 'Reshape') with input shapes: [1,64,1,1], [].
During handling of the above exception, another exception occurred:
ValueError Traceback (most recent call last)
in
----> 1 src, mask, aligned_im, (x0, y0, x1, y1), landmarks = utils.get_src_inputs(fn_src, fd, fp, idet)
2 tar, emb_tar = utils.get_tar_inputs(fns_tar, fd, fv)
~/kjj/deepfakes/fewshot-face-translation-GAN-master/utils/utils.py in get_src_inputs(fn, fd, fp, idet)
177 im = cv2.imread(fn)[..., ::-1]
178 im = auto_resize(im)
--> 179 (x0, y0, x1, y1), landmarks = detect_face(im, fd)
180 aligned_im = align_image(im, x0, y0, x1, y1, landmarks)
181
~/kjj/deepfakes/fewshot-face-translation-GAN-master/utils/utils.py in detect_face(im, fd, with_landmarks)
94 landmarks = None
95 if with_landmarks:
---> 96 bboxes, landmarks = fd.detect_face(im, with_landmarks=with_landmarks)
97 else:
98 bboxes = fd.detect_face(im, with_landmarks=with_landmarks)
~/kjj/deepfakes/fewshot-face-translation-GAN-master/face_toolbox_keras/models/detector/face_detector.py in detect_face(self, image, with_landmarks)
64 if self.lmd == None:
65 print("Building FAN for landmarks detection...")
---> 66 self.build_FAN()
67 print("Done.")
68 landmarks_list = []
~/kjj/deepfakes/fewshot-face-translation-GAN-master/face_toolbox_keras/models/detector/face_detector.py in build_FAN(self)
45
46 def build_FAN(self):
---> 47 self.lmd = FANLandmarksDetector(self.lmd_weights_path)
48
49 def detect_face(self, image, with_landmarks=True):
~/kjj/deepfakes/fewshot-face-translation-GAN-master/face_toolbox_keras/models/detector/landmarks_detector.py in init(self, path_to_weights_file)
20 def init(self, path_to_weights_file=FILE_PATH+"/FAN/2DFAN-4_keras.h5"):
21 if not tf.version >= '1.13':
---> 22 self.net = load_model(path_to_weights_file)
23 else:
24 self.net = tf.keras.models.load_model(path_to_weights_file)
~/anaconda2/envs/kjj/lib/python3.6/site-packages/keras/engine/saving.py in load_model(filepath, custom_objects, compile)
~/anaconda2/envs/kjj/lib/python3.6/site-packages/keras/engine/saving.py in _deserialize_model(f, custom_objects, compile)
~/anaconda2/envs/kjj/lib/python3.6/site-packages/keras/engine/saving.py in model_from_config(config, custom_objects)
~/anaconda2/envs/kjj/lib/python3.6/site-packages/keras/layers/init.py in deserialize(config, custom_objects)
53 module_objects=globs,
54 custom_objects=custom_objects,
---> 55 printable_module_name='layer')
~/anaconda2/envs/kjj/lib/python3.6/site-packages/keras/utils/generic_utils.py in deserialize_keras_object(identifier, module_objects, custom_objects, printable_module_name)
143 custom_objects=dict(list(_GLOBAL_CUSTOM_OBJECTS.items()) +
144 list(custom_objects.items())))
--> 145 with CustomObjectScope(custom_objects):
146 return cls.from_config(config['config'])
147 else:
~/anaconda2/envs/kjj/lib/python3.6/site-packages/keras/engine/network.py in from_config(cls, config, custom_objects)