deepfakes / faceswap-playground

User dedicated repo for the faceswap project
306 stars 194 forks source link

Converting Error Help Please #44

Closed DrDreGFunk closed 6 years ago

DrDreGFunk commented 6 years ago

Mac OS High Sierra Mac: 10.13.2 Python 3.6.3 :: Anaconda custom (64-bit) Using CPU Processor: 2.2 GHz Intel Core i7 Memory: 16 GB 1600 MHz DDR3

Main Issue: "'NoneType' object is not iterable"

WHAT IT SAYS IN TERMINAL:

MY NAME-MBP-2:faceswap MY NAME$ python faceswap.py convert -i vid -o output -m model Input Directory: /Volumes/My Passport/DeepFakes/faceswap/vid Output Directory: /Volumes/My Passport/DeepFakes/faceswap/output Starting, this may take a while... Loading Model from Model_Original plugin... /Users/MY NAME/anaconda3/lib/python3.6/site-packages/h5py/init.py:36: FutureWarning: Conversion of the second argument of issubdtype from float to np.floating is deprecated. In future, it will be treated as np.float64 == np.dtype(float).type. from ._conv import register_converters as _register_converters Using TensorFlow backend. /Users/MY NAME/anaconda3/lib/python3.6/importlib/_bootstrap.py:219: RuntimeWarning: compiletime version 3.5 of module 'tensorflow.python.framework.fast_tensor_util' does not match runtime version 3.6 return f(*args, **kwds) 2018-02-11 20:16:59.539510: I tensorflow/core/platform/cpu_feature_guard.cc:137] Your CPU supports instructions that this TensorFlow binary was not compiled to use: SSE4.1 SSE4.2 AVX AVX2 FMA loaded model weights Loading Convert from Convert_Masked plugin... 0%| | 0/952 [00:00<?, ?it/s]Failed to convert image: /Volumes/My Passport/DeepFakes/faceswap/vid/vid 1.png. Reason: 'NoneType' object is not iterable


I have 952 video images and they all say: "Failed to convert image: /Volumes/My Passport/DeepFakes/faceswap/vid/vid.png. Reason: 'NoneType' object is not iterable

Hope it's not too complicated and thanks in advance!

mike-truk commented 6 years ago

@DrDreGFunk is there a space in your PNG file name? What happens if you rename "vid 1.png" to "vid.1.png" or "vid.0001.png"?

DrDreGFunk commented 6 years ago

@mike-truk Thank you for the suggestion, but it still didn't work. I did what you said and it still gave me the same error. Oh I also forgot to mention as I've just noticed, but right at the bottom of the terminal (after all the failed to convert 952 images). it says:


Images found: 952 Images processed: 952 Faces detected: 0

So is the real question or clue to the problem: why can't it detect the faces?

I've been training the images for ages (at least 16 hours or so) and pressed "Enter" in the preview window to save what I have done, but I still don't understand why it gives me this error haha.

(All the pictures in the folder are 854 × 480)

I would be very grateful for any other suggestions :)

DrDreGFunk commented 6 years ago

@Apollo112 You know your stuff and I was wondering if you could give me some suggestion. If that's alright? Thanks in advance

Jack29913 commented 6 years ago

I use Windows but let's see. It can't find faces because it cant use your images. Ignore processed part.

DrDreGFunk commented 6 years ago

Thank you kind sir for these suggestions! I've also tried training from the beginning again, but still no luck. I will try these out once I am satisfied with the training results again and let you know if it resolves the issue.

DrDreGFunk commented 6 years ago

@Apollo122 I've tried all the suggestions above but I still get the same error. I moved the faceswap folder to my desktop and still no luck. Could there be anything else I might be missing?

Jack29913 commented 6 years ago

Have you tried extract script with same images? Did it work? Also It says NAME/anaconda3/lib/python3.6/importlib/_bootstrap.py:219: RuntimeWarning: compiletime version 3.5 of module 'tensorflow.python.framework.fast_tensor_util' does not match runtime version 3.6 So you may need to compile it with python 3.6 or downgrade your runtime version to 3.5

DrDreGFunk commented 6 years ago

@Apollo122 Ok thank you! How do you downgrade from 3.6 to 3.5? I downloaded and installed the .pkg and checked my python version in the terminal, but it still says version 3.6? Or compile it to 3.6 as I'm pretty new to this aha.

Jack29913 commented 6 years ago

Don't use Mac so you have to check it yourself

DrDreGFunk commented 6 years ago

Ok, no problem and thanks again. I'll let you know if it works.

DrDreGFunk commented 6 years ago

@Apollo122 I think I am making progress. I created a new environment which used Python 3.5.0 and this time I got a different error message:

(faceswap) MY NAME-MacBook-Pro-2:faceswap MY NAME$ python faceswap.py convert -I video -o output -m model

Traceback (most recent call last):

File "faceswap.py", line 2, in

from lib.utils import FullHelpArgumentParser

File "/Volumes/MyPassport/DeepFakes/faceswap/lib/utils.py", line 5, in

from scandir import scandir

ImportError: No module named 'scandir'


I installed scandir and then it came up with:

ImportError: No module named 'cv2'

So I installed that as well and then it said:

ImportError: No module named 'tqdm'

...So I installed that as well and then it says:

ImportError: No module named 'face_recognition'

So I installed that as well....

Then guess what..... It asked me to install keras... So I installed that

Then it asked me to install tensorflow....

So I again installed that too hahaha

DrDreGFunk commented 6 years ago

@Apollo122 WITH ALL OF FROM ABOVE INSTALLED, I GET THIS ERROR AGAIN BUT IT'S SLIGHTLY DIFFERENT:

(faceswap) MY NAME-MacBook-Pro-2:faceswap MY NAME$ python faceswap.py convert -i video -o output -m model

Input Directory: /Volumes/MyPassport/DeepFakes/faceswap/video Output Directory: /Volumes/MyPassport/DeepFakes/faceswap/output Starting, this may take a while... Loading Model from Model_Original plugin... /Users/MY NAME/anaconda3/envs/faceswap/lib/python3.5/site-packages/h5py/init.py:36: FutureWarning: Conversion of the second argument of issubdtype from float to np.floating is deprecated. In future, it will be treated as np.float64 == np.dtype(float).type. from ._conv import register_converters as _register_converters Using TensorFlow backend. 2018-02-24 00:41:14.746215: I tensorflow/core/platform/cpu_feature_guard.cc:137] Your CPU supports instructions that this TensorFlow binary was not compiled to use: SSE4.2 AVX AVX2 FMA loaded model weights Loading Convert from Convert_Masked plugin... 0%| | 0/930 [00:00<?, ?it/s]Failed to convert image: /Volumes/MyPassport/DeepFakes/faceswap/video/video1.png. Reason: 'NoneType' object is not iterable

DIFFERENT ERROR THAN BEFORE AT THE BOTTOM OF TERMINAL: ———————————————————————————

Images found: 930 Images processed: 930 Faces detected: 0

Exception ignored in: <bound method BaseSession.del of <tensorflow.python.client.session.Session object at 0x133600518>> Traceback (most recent call last): File "/Users/MY NAME/anaconda3/envs/faceswap/lib/python3.5/site-packages/tensorflow/python/client/session.py", line 702, in del File "/Users/MY NAME/anaconda3/envs/faceswap/lib/python3.5/site-packages/tensorflow/python/framework/c_api_util.py", line 31, in init TypeError: 'NoneType' object is not callable

I'm going to try training again using the new environment of python 3.5.0. As before it was using python 3.6. That could be the reason why the converting stage is not working...

DrDreGFunk commented 6 years ago

@Apollo122 Any other thoughts?

Clorr commented 6 years ago

@DrDreGFunk in scripts/extract.py, you should try to modify the lines

                try:
                    for filename in tqdm(self.read_directory()):
                        image = cv2.imread(filename)
                        self.faces_detected[os.path.basename(filename)] = self.handleImage(image, filename)
                except Exception as e:
                    print('Failed to extract from image: {}. Reason: {}'.format(filename, e))

to

                for filename in tqdm(self.read_directory()):
                    image = cv2.imread(filename)
                    self.faces_detected[os.path.basename(filename)] = self.handleImage(image, filename)

be sure to remove 4 spaces at the beginning of each line to keep a valid indentation. With this code, the failure message will be more complete... Then post it here

Clorr commented 6 years ago

@DrDreGFunk Also note that if you installed everything by just reading error messages, you may have missed something in the install. Please ensure you have read the (small) documentation before posting a problem here

Clorr commented 6 years ago

@DrDreGFunk Also please post what versions you installed, because if you typed pip install tensorflow, you won't have the right version... You can have the versions by typing pip freeze

DrDreGFunk commented 6 years ago

Thank you @Clorr for the responses! I will try them out now! What parts do I modify in the lines as I'm a bit confused about that haha (I'm new at this)? My tensorflow version = 1.4.1 and tensorflow-tensorboard = 0.4.0.