deepfakes / faceswap-playground

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

in converting steps: TypeError: 'int' object is not iterable #244

Closed WingsOfPanda closed 5 years ago

WingsOfPanda commented 5 years ago

Actual behavior

I trained the model successfully but fails at converting step. I first have trouble to locate the alignment.json file. Later I discovered that the 'state.json' file, which is generated under models folder, should be the correct one. I renamed it and copy it into the source image file.

However, when I compile the covert steps by using

python faceswap.py convert -i ~/faceswap/photo/trump/ -o ~/faceswap/output/ -m ~/faceswap/models/

it returns the error from the terminal saying

Traceback (most recent call last): File "/Schemes/Python/faceswap/lib/cli.py", line 89, in execute_script process = script(arguments) File "/Schemes/Python/faceswap/scripts/convert.py", line 37, in init Legacy(self.alignments, self.images.input_images, arguments.input_aligned_dir) File "/Schemes/Python/faceswap/scripts/convert.py", line 318, in init self.process(faces_dir) File "/Schemes/Python/faceswap/scripts/convert.py", line 322, in process no_dims = self.alignments.get_legacy_no_dims() File "Schemes/Python/faceswap/lib/alignments.py", line 286, in get_legacy_no_dims for alignment in val: TypeError: 'int' object is not iterable

also, from the crash report it says (I attached the full version of crash report at the end)

ValueError: Error: Alignments file not found at /faceswap/Data/trump2/alignments.json

But I am sure the file is there. I copied it there.

Any suggestions? Thank you!

Other relevant information

and also here is the full crash report:

01/31/2019 16:21:11 MainProcess MainThread logger log_setup INFO Log level set to: INFO 01/31/2019 16:21:11 MainProcess MainThread cli execute_script DEBUG Executing: convert. PID: 8558 01/31/2019 16:21:12 MainProcess MainThread convert init DEBUG Initializing Convert: (args: Namespace(alignments_path=None, avg_color_adjust=False, blur_size=2, converter='Masked', discard_frames=False, draw_transparent=False, erosion_kernel_size=None, filter=None, frame_ranges=None, func=<bound method ScriptExecutor.execute_script of <lib.cli.ScriptExecutor object at 0x119310470>>, gpus=1, input_aligned_dir=None, input_dir='/faceswap/Data/trump2', logfile=None, loglevel='INFO', mask_type='facehullandrect', match_histogram=False, model_dir='/faceswap/models', nfilter=None, output_dir='/faceswap/output', ref_threshold=0.6, seamless_clone=False, sharpen_image=None, smooth_mask=False, swap_model=False, trainer='Original')) 01/31/2019 16:21:12 MainProcess MainThread utils get_folder DEBUG Requested path: '/Users/panliu/faceswap/output' 01/31/2019 16:21:12 MainProcess MainThread utils get_folder DEBUG Returning: '/Users/panliu/faceswap/output' 01/31/2019 16:21:12 MainProcess MainThread fsmedia init DEBUG Initializing Images 01/31/2019 16:21:12 MainProcess MainThread fsmedia check_input_folder INFO Input Directory: /faceswap/Data/trump2 01/31/2019 16:21:12 MainProcess MainThread utils get_image_paths DEBUG Scanned Folder contains 6 files 01/31/2019 16:21:12 MainProcess MainThread utils get_image_paths DEBUG Returning 4 images 01/31/2019 16:21:12 MainProcess MainThread fsmedia init DEBUG Initialized Images 01/31/2019 16:21:12 MainProcess MainThread fsmedia init DEBUG Initializing Alignments: (is_extract: False, input_is_video: False) 01/31/2019 16:21:12 MainProcess MainThread fsmedia set_folder_filename DEBUG Alignments from Input Folder: '/faceswap/Data/trump2' 01/31/2019 16:21:12 MainProcess MainThread fsmedia set_folder_filename DEBUG Setting Alignments: (folder: '/faceswap/Data/trump2' filename: 'alignments') 01/31/2019 16:21:12 MainProcess MainThread fsmedia set_serializer DEBUG No Serializer defaulting to: 'json' 01/31/2019 16:21:12 MainProcess MainThread alignments init DEBUG Initializing Alignments: (folder: '/faceswap/Data/trump2', filename: 'alignments', serializer: 'json') 01/31/2019 16:21:12 MainProcess MainThread alignments get_serializer DEBUG Getting serializer: (filename: 'alignments', serializer: 'json') 01/31/2019 16:21:12 MainProcess MainThread alignments get_serializer DEBUG Serializer set from argument: 'json' 01/31/2019 16:21:12 MainProcess MainThread alignments get_serializer VERBOSE Using 'json' serializer for alignments 01/31/2019 16:21:12 MainProcess MainThread alignments get_location DEBUG Getting location: (folder: '/faceswap/Data/trump2', filename: 'alignments') 01/31/2019 16:21:12 MainProcess MainThread alignments get_location DEBUG File extension set from serializer: 'json' 01/31/2019 16:21:12 MainProcess MainThread alignments get_location VERBOSE Alignments filepath: '/faceswap/Data/trump2/alignments.json' 01/31/2019 16:21:12 MainProcess MainThread alignments load DEBUG Loading alignments Traceback (most recent call last): File "/faceswap/lib/cli.py", line 89, in execute_script process = script(arguments) File "/faceswap/scripts/convert.py", line 34, in init self.alignments = Alignments(self.args, False, self.images.is_video) File "/faceswap/scripts/fsmedia.py", line 61, in init serializer=serializer) File "/faceswap/lib/alignments.py", line 36, in init self.data = self.load() File "/faceswap/scripts/fsmedia.py", line 97, in load data = super().load() File "/faceswap/lib/alignments.py", line 121, in load "{}".format(self.file)) ValueError: Error: Alignments file not found at /faceswap/Data/trump2/alignments.json

============ System Information ============ git_branch: Not Found git_commits: Not Found gpu_cuda: Unsupported OS gpu_cudnn: Not Found gpu_devices:
gpu_driver: 0 gpu_vram:
os_machine: x86_64 os_platform: Darwin-18.2.0-x86_64-i386-64bit os_release: 18.2.0 py_command: faceswap.py convert -i /faceswap/Data/trump2 -o /faceswap/output/ -m /faceswap/models/ py_conda_version: N/A py_implementation: CPython py_version: 3.6.7 py_virtual_env: True sys_cores: 8 sys_processor: i386 sys_ram: Total: 16384MB, Available: 7875MB, Used: 5664MB, Free: 3396MB

=============== Pip Packages =============== absl-py==0.7.0 astor==0.7.1 certifi==2018.11.29 chardet==3.0.4 Click==7.0 cloudpickle==0.7.0 cmake==3.13.3 cycler==0.10.0 dask==1.1.0 decorator==4.3.2 dlib==19.16.0 face-recognition==1.2.3 face-recognition-models==0.3.0 ffmpy==0.2.2 gast==0.2.2 grpcio==1.18.0 h5py==2.8.0 idna==2.8 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.15.4 nvidia-ml-py3==7.352.0 opencv-python==4.0.0.21 pandas==0.23.4 pathlib==1.0.1 Pillow==5.4.1 protobuf==3.6.1 psutil==5.5.0 pydicom==1.2.2 pynvx==0.0.4 pyparsing==2.3.1 python-dateutil==2.7.5 pytz==2018.9 PyWavelets==1.0.1 PyYAML==3.13 requests==2.21.0 scandir==1.7 scikit-image==0.14.2 scikit-learn==0.20.2 scipy==1.2.0 six==1.12.0 tensorboard==1.12.2 tensorflow==1.12.0 termcolor==1.1.0 toolz==0.9.0 tqdm==4.30.0 urllib3==1.24.1 virtualenv==16.2.0 Werkzeug==0.14.1 xlrd==1.2.0

WingsOfPanda commented 5 years ago

I have got the answer. Could somebody close this question? Thank you!