deepfakes / faceswap-playground

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

Tensor A must be from the same graph as Tensor B #291

Closed josiemariahlee closed 5 years ago

josiemariahlee commented 5 years ago

I got the below error message while trying to train the model in Google Colab:

Tensor("conv2d_9/kernel:0", shape=(5, 5, 3, 128), dtype=float32_ref) must be from the same graph as Tensor("face:0", shape=(?, 64, 64, 3), dtype=float32).

I suspect the faces images are the problem. However, I used the Extract function that comes with the main repo so it shouldn't have been? From the log, it seems to me that the model isn't able to get the input_shape. Here is the full Crash Report. It doesn't seem to be a common issue so I suppose it's my problem. Any idea how I can fix it?

Training image example: Face A Face B

============ System Information ============ encoding: UTF-8 git_branch: master git_commits: a83f31d bugfix. cc78811 Merge branch 'staging'. 2071c6d Add save snapshot backup option for training. d60b0c3 tools: Preview. Fix mask_type pull down. a329452 Centralize cv2 image reading and handle bad filenames gpu_cuda: 10.0 gpu_cudnn: 7.5.1 gpu_devices: GPU_0: Tesla T4 gpu_devices_active: GPU_0 gpu_driver: 410.79 gpu_vram: GPU_0: 15079MB os_machine: x86_64 os_platform: Linux-4.14.79+-x86_64-with-Ubuntu-18.04-bionic os_release: 4.14.79+ py_command: faceswap.py train -A /content/drive/My Drive/Colab Projects/Trump_faces -B /content/drive/My Drive/Colab Projects/Alan_faces -m /content/drive/My Drive/Colab Projects/Trump_Alan_Model -p py_conda_version: N/A py_implementation: CPython py_version: 3.6.7 py_virtual_env: False sys_cores: 2 sys_processor: x86_64 sys_ram: Total: 13022MB, Available: 10992MB, Used: 1292MB, Free: 4110MB

torzdf commented 5 years ago

The issue actually happens earlier:

DEBUG Exception: Unable to create group (no write intent on file)

This relates to the model files and indicates potentially either model corruption, or write/permissions issues on your specified save location.

josiemariahlee commented 5 years ago

Thanks torzdf! I checked the write/permission on the save location. It seems fine as I can see the origin_state.json file and a couple other files there. It might be that I was using tensorflow 1.13 instead of 1.12? I pip installed tensorflow 1.12 after running setup.py but when I ran faceswap.py again, it shows an error:

!python faceswap.py train -A 'Trump_faces' -B 'Alan_faces' -m 'Trump_Alan_Model' -p 06/06/2019 05:54:04 INFO Log level set to: INFO 06/06/2019` 05:54:04 ERROR Tensorflow is a requirement but is not installed on your system.

pip installed:

!pip list | grep tensor tensor2tensor==1.11.0 tensorboard==1.12.2 tensorboardcolab==0.0.22 tensorflow==1.12.0 tensorflow-estimator==1.10.12 tensorflow-gpu==1.12.0 tensorflow-hub==0.4.0 tensorflow-metadata==0.13.0 tensorflow-probability==0.6.0

Any idea how I can set up tensorflow 1.12 properly?

torzdf commented 5 years ago

To be honest, we don't directly support Google Colab (although many people do use it). If you haven't already then I recommend checking out this guide, to hopefully help solve your issues: https://github.com/seranus/faceswap-notebooks/blob/master/faceswap_trainer.ipynb

josiemariahlee commented 5 years ago

Checking it out, thanks!

Kirin-kun commented 5 years ago

I do use Tensorflow 1.13.1 without any major issue because I have an RTX card

So I can confirm Faceswap does work with 1.13.1.

To know what's wrong with your tf (probably missing a library), run python without argument in your virtualenv and type "import tensorflow"

It should tell you why it doesn't load. Faceswap just hides the message and just say it isn't installed.

I had this problem at some point and I solved it, I don't remember how (google is your friend).