Closed theoldgun closed 6 years ago
Have you run the extract process? This would generate your alignments.json (It is a mapping of face locations within images).
Either way, there is a Pull Request on the way which should address this issue.
Note: if the alignments.json file is missing, faceswap is supposed to attempt an extraction.
For my numerous convert attempts (lol), I tested not having an alignment file and it was ugly
It doesnt work. Either with -D hog or cnn.
With hog it loads a keras model then it crashes.
With cnn, it errors with a out of memory error.
So, the alignments file is a MUST have.
Also
module 'dlib' has no attribute 'get_frontal_face_detector'
Looks like your dlib is weirdly installed.
The changes have just been pushed to https://github.com/deepfakes/faceswap/tree/staging which should address this. Please feel free to test and see if it solves your issue.
So, the alignments file is a MUST have.
Not any more, but it's definitely preferable as the alignments will just be extracted with default settings and no scope for review if you don't have it.
thanks you for help me @torzdf @Kirin-kun !!!
when I execute the commend:
python faceswap.py extract -i ~/faceswap/photo/trump -o ~/faceswap/data/trump
it says:
Input Directory: /home/dms/faceswap/photo/trump
Output Directory: /home/dms/faceswap/data/trump
Filter: filter.jpg
Using json serializer
Starting, this may take a while...
Loading Extract from Extract_Align plugin...
0%| | 0/1 [00:00<?, ?it/s]/home/dms/.virtualenvs/faceswap_env_python36/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.
100%|███████████████████████████████████████████████████████████████████████████| 1/1 [00:00<00:00, 1.89it/s]
Alignments filepath: /home/dms/faceswap/photo/trump/alignments.json
Writing alignments to: /home/dms/faceswap/photo/trump/alignments.json
-------------------------
Images found: 1
Faces detected: 0
-------------------------
Done!
and in the /faceswap/photo/trump folder:it generate "aligned" folder and "alignments.json" file the "aligned" folder has nothing in it and the "alignments.json" 's context is "{}"... Is my problem is "dlib" not installed?
Then I execute
sudo pip install -r requirements-gpu-python36-cuda9.txt
again
and all lib is installed successfully.
There is only one photo in the /faceswap/photo/cage and /faceswap/photo/trump folder,
then I execute
python faceswap.py extract -i ~/faceswap/photo/trump -o ~/faceswap/data/trump
and
python faceswap.py extract -i ~/faceswap/photo/cage -o ~/faceswap/data/cage
:
Input Directory: /home/dms/faceswap/photo/cage
Output Directory: /home/dms/faceswap/data/cage
Filter: filter.jpg
Using json serializer
Starting, this may take a while...
Loading Extract from Extract_Align plugin...
0%| | 0/1 [00:00<?, ?it/s]/home/dms/.virtualenvs/faceswap_env_python36/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.
100%|███████████████████████████████████████████████████████████████████████████| 1/1 [00:00<00:00, 1.88it/s]
Alignments filepath: /home/dms/faceswap/photo/cage/alignments.json
Writing alignments to: /home/dms/faceswap/photo/cage/alignments.json
-------------------------
Images found: 1
Faces detected: 0
-------------------------
Done!
outcome is both in the /faceswap/photo/cage and /faceswap/photo/trump folder's "alignments.json" 's context is "{}",and there is nothing in /faceswap/data/cage and /faceswap/data/trump folder.so what should I do? please help me ,If my question is not stated clearly, please tell me.Thank you~
theoldgun, I'm not using Ubuntu, but how about trying more than one trump and cage photo and running the extract process again to test? Your output indicates that convert found the image but couldn't recognize the face. If the face is too small, or a face profile or sharp face angle or a blurry face, the extract or convert process may not recognize it. Try extract with more input photos, most should have recognized faces. If no faces are recognized in multiple photos, there may be an issue with your python install.
Thank you for help me @gessyoo .I tried more photo but also Faces detected: 0
.some photo came from Internet and I also tried some photo from train data.The outcomes is same,the problem is still unresolved.
There's a possibility that your dlib, although installed, doesn't support CUDA.
Can you run python and type:
import dlib dlib.DLIB_USE_CUDA
If it doesn't say "True", your dlib isn't compiled properly.
Also run your extract with the -v flag:
python faceswap.py extract -i ~/faceswap/photo/trump -o ~/faceswap/data/trump -v
It should hopefully give you a message about why a face wasn't found
Expected behavior
I have trained the model with data from Trump and Cage, but when I make a conversion, I get an error.
Actual behavior
I use a Trump's photo to convert,and use the fellow commend:
python faceswap.py convert -i ~/faceswap/photo/trump/ -o ~/faceswap/output/ -m ~/faceswap/models_17k/
but an error has occurred:And I also don't know what is the alignments.json. I only put a Trump's picture in /home/dms/faceswap/photo/trump/.
please help me ~~~Thank you
Other relevant information