chychkan / DeepFaceLab_MacOS

Run DeepFaceLab on MacOS
GNU General Public License v3.0
251 stars 55 forks source link

Can't parse 'center'. Sequence item with index 0 has a wrong type #72

Closed mateuspestana closed 2 years ago

mateuspestana commented 2 years ago

Hi! When I train my model, I'm getting this error:

   raise Exception ("Exception occured in sample %s. Error: %s" % (sample.filename, traceback.format_exc() ) )
Exception: Exception occured in sample /Users/mateuspestana/Downloads/DeepFaceLab_MacOS/workspace/data_dst/aligned/03987.jpg. Error: Traceback (most recent call last):
  File "/Users/mateuspestana/Downloads/DeepFaceLab_MacOS/.dfl/DeepFaceLab/samplelib/SampleGeneratorFace.py", line 134, in batch_func
    x, = SampleProcessor.process ([sample], self.sample_process_options, self.output_sample_types, self.debug, ct_sample=ct_sample)
  File "/Users/mateuspestana/Downloads/DeepFaceLab_MacOS/.dfl/DeepFaceLab/samplelib/SampleProcessor.py", line 106, in process
    warp_params = imagelib.gen_warp_params(resolution,
  File "/Users/mateuspestana/Downloads/DeepFaceLab_MacOS/.dfl/DeepFaceLab/core/imagelib/warp.py", line 146, in gen_warp_params
    random_transform_mat = cv2.getRotationMatrix2D((w // 2, w // 2), rotation, scale)
TypeError: Can't parse 'center'. Sequence item with index 0 has a wrong type

Does anyone knows how to solve it? Oh, I'm using an M1 Pro.

chychkan commented 2 years ago

Hi @mateuspestana! This particular issue is due to your version of opencv package being not compatible with DeepFaceLab code. As a temporary workaround you can edit the /Users/mateuspestana/Downloads/DeepFaceLab_MacOS/.dfl/DeepFaceLab/core/imagelib/warp.py file and change the line

random_transform_mat = cv2.getRotationMatrix2D((w // 2, w // 2), rotation, scale)

to

random_transform_mat = cv2.getRotationMatrix2D((w // 2.0, w // 2.0), rotation, scale)
chychkan commented 2 years ago

@mateuspestana did you get chance to try the ^^ workaround?

mateuspestana commented 2 years ago

Just tried it and started training. By now, it's working flawlessly. Thanks!