deepfakes / faceswap-playground

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

Extraction failed on latest faceswap-master #217

Closed defineinit closed 5 years ago

defineinit commented 6 years ago

I'm using faceswap gui. I added the following to the default values of faceswap gui: Rotate Images : 180 Skip Existing : checked Align Eyes : checked

and full command (from Generate button) : C:\Users\defin\AppData\Local\Programs\Python\Python36\python.exe G:\faceswap-master\faceswap.py extract -i D:\test2 -o D:\test2\extracted -l 0.6 --serializer json -D mtcnn -A fan -mtms 20 -mtth 0.6 0.7 0.7 -mtsc 0.709 -r 180 -sz 256 -s -ae

OS : Windows 10 Python : 3.6.7 GPU : GTX 1070 8G CUDA : 9.0.176 cuDNN : 7.3.1 (for CUDA 9.0)

pip freeze : absl-py==0.5.0 astor==0.7.1 Click==7.0 cloudpickle==0.6.1 cmake==3.12.0 cycler==0.10.0 dask==0.19.4 decorator==4.3.0 dlib==19.15.0 face-recognition==1.2.3 face-recognition-models==0.3.0 ffmpy==0.2.2 gast==0.2.0 grpcio==1.15.0 h5py==2.8.0 Keras==2.2.4 Keras-Applications==1.0.6 Keras-Preprocessing==1.0.5 kiwisolver==1.0.1 Markdown==3.0.1 matplotlib==2.2.2 networkx==2.2 numpy==1.14.5 nvidia-ml-py3==7.352.0 opencv-python==3.4.1.15 pathlib==1.0.1 Pillow==5.3.0 protobuf==3.6.1 pyparsing==2.2.2 python-dateutil==2.7.3 pytz==2018.5 PyWavelets==1.0.1 PyYAML==3.13 scandir==1.7 scikit-image==0.14.1 scikit-learn==0.20.0 scipy==1.1.0 six==1.11.0 tensorboard==1.11.0 tensorflow-gpu==1.11.0 termcolor==1.1.0 toolz==0.9.0 tqdm==4.26.0 Werkzeug==0.14.1

Log :

Loading... Output Directory: D:\test2\extracted Input Directory: D:\test2 Using json serializer Alignments filepath: D:\test2\alignments.json Skip Existing/Skip Faces selected, but no alignments file found! Loading Detect from Mtcnn plugin... Loading Align from Fan plugin...

NB: Parallel processing disabled. You may get faster extraction speeds by enabling it with the -mp switch

Starting, this may take a while...

Detecting faces: 0%| | 0/604 [00:00<?, ?it/s] Initializing MTCNN Detector... Initialized MTCNN Detector. Initializing Face Alignment Network... Initialized Face Alignment Network. {'filename': 'D:\test2\dataset_0001.png', 'detected_faces': [<lib.faces_detect.DetectedFace object at 0x000002E63E04CE80>], 'image': array([[[ 50, 68, 88], [ 51, 69, 89], Exception in thread Thread-3:[ 52, 70, 90],

Traceback (most recent call last): ...,File "C:\Users\defin\AppData\Local\Programs\Python\Python36\lib\threading.py", line 916, in _bootstrap_inner

[116, 159, 173],self.run()

[116, 159, 173],File "C:\Users\defin\AppData\Local\Programs\Python\Python36\lib\threading.py", line 864, in run [116, 159, 173]],

self._target(*self._args, **self._kwargs)

File "G:\faceswap-master\scripts\extract.py", line 84, in reload_images[[ 50, 68, 88],

load_queue.put(detect_item)[ 51, 69, 89],

File "", line 2, in put[ 53, 71, 91],

File "C:\Users\defin\AppData\Local\Programs\Python\Python36\lib\multiprocessing\managers.py", line 756, in _callmethod...,

conn.send((self._id, methodname, args, kwds))[116, 159, 173],

File "C:\Users\defin\AppData\Local\Programs\Python\Python36\lib\multiprocessing\connection.py", line 206, in send[116, 159, 173],

self._send_bytes(_ForkingPickler.dumps(obj))[116, 159, 173]],

File "C:\Users\defin\AppData\Local\Programs\Python\Python36\lib\multiprocessing\connection.py", line 290, in _send_bytes

nwritten, err = ov.GetOverlappedResult(True)[[ 50, 68, 88],

BrokenPipeError: [WinError 109] The pipe has been ended[ 51, 69, 89],

[ 53, 71, 91],

..., [117, 160, 174], [117, 160, 174], [117, 160, 174]],

...,

[[ 87, 121, 148], [ 87, 121, 148], [ 87, 121, 148], ..., [193, 192, 194], [ 43, 39, 65], [ 25, 21, 47]],

[[ 87, 121, 148], [ 87, 121, 148], [ 87, 121, 148], ..., [ 15, 20, 60], [ 9, 14, 54], [ 12, 17, 57]],

[[ 87, 121, 148], [ 87, 121, 148], [ 87, 121, 148], ..., [ 9, 14, 54], [ 9, 14, 54], [ 8, 13, 53]]], dtype=uint8), 'resized_faces': [array([[[ 17, 54, 78], [ 13, 51, 75], [ 16, 56, 81], ..., [ 37, 69, 96], [ 35, 68, 95], [ 32, 66, 93]],

[[ 15, 52, 76], [ 14, 51, 76], [ 20, 59, 84], ..., [ 36, 68, 95], [ 33, 66, 93], [ 31, 64, 91]],

[[ 14, 51, 75], [ 14, 52, 76], [ 24, 63, 88], ..., [ 34, 66, 93], [ 32, 65, 92], [ 30, 63, 90]],

...,

[[103, 145, 177], [103, 145, 177], [103, 145, 177], ..., [133, 140, 151], [132, 139, 150], [130, 139, 150]],

[[103, 145, 177], [103, 145, 177], [102, 144, 176], ..., [132, 139, 150], [132, 139, 150], [131, 139, 150]],

[[103, 145, 177], [102, 144, 176], [102, 144, 176], ..., [132, 139, 150], [133, 140, 151], [132, 140, 151]]], dtype=uint8)], 't_mats': [matrix([[ 2.11245224e-02, 1.82535087e-03, -6.75918876e+00], [-1.82535087e-03, 2.11245224e-02, -4.67057687e-01]])]} Process exited.

Status: Failed - extract.py. Return

P.S. In this version the "Terminate" button is not working. under any circumstances.

torzdf commented 6 years ago

I'll look into this.

It looks like it's single processor specific. You're running on a 1070Ti, so you should be able to run with the -mp flag without issue, which should bypass this problem (and be faster).

torzdf commented 6 years ago

Should be fixed in latest commit. I will look into the termination issue in due course

torzdf commented 6 years ago

Terminate on GUI should now be fixed.

NB: It has a new requirement: pip install psutil

defineinit commented 6 years ago

Thank you. issues are solved.

but something else happens. if i use -mp option, the error message below and does not proceed.

Loading Detect from Mtcnn plugin... Loading Align from Fan plugin... Starting, this may take a while...

2018-11-04 21:46:22.865691: E tensorflow/stream_executor/cuda/cuda_dnn.cc:353] Could not create cudnn handle: CUDNN_STATUS_INTERNAL_ERROR 2018-11-04 21:46:23.031680: E tensorflow/stream_executor/cuda/cuda_dnn.cc:353] Could not create cudnn handle: CUDNN_STATUS_INTERNAL_ERROR 2018-11-04 21:46:23.256504: E tensorflow/stream_executor/cuda/cuda_dnn.cc:353] Could not create cudnn handle: CUDNN_STATUS_INTERNAL_ERROR

torzdf commented 6 years ago

I think this might be related to the earlier issues. Could you reboot your machine and try again, as there may be some orphaned processes lying about.

defineinit commented 6 years ago

Still the same error on reboot.

I don't know if this is the solution, but I found at the following sources from Google.

config = tf.ConfigProto() config.gpu_options.allow_growth = True session = tf.Session(config=config)

After inserting this source in mtcnn.py file, the operation will proceed without error.

I don't know Python and source well. Please refer to this sources for fix.