deepfakes / faceswap

Deepfakes Software For All
https://www.faceswap.dev
GNU General Public License v3.0
50.52k stars 13.06k forks source link

After latest clone, convert shows images being generated but target dir is empty #377

Closed fetchlister closed 6 years ago

fetchlister commented 6 years ago

I cloned the latest version of faceswap yesterday and it won't convert frames at all. Or rather, they don't end up in the specified folder. I've tried the Gui as well and cannot seem to get any of my frames converted no matter the model I use.

torzdf commented 6 years ago

Can you run with the -v flag and say whether there is any output.

fetchlister commented 6 years ago

This is what I get. In the past it worked just fine - until the latest clone. The deprecation stuff I never worried about because It just worked.

python /home/luke/faceswap/faceswap.py convert -b 15 -e 10 -i '/home/luke/Desktop/bond' -o '/home/luke/Desktop/bonder' -m '/home/luke/Videos/my own deepfakes/kendrickmodel' -v

/usr/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. Output Directory: /home/luke/Desktop/bonder Input Directory: /home/luke/Desktop/bond Loading Extract from Extract_Align plugin... Using json serializer Alignments filepath: /home/luke/Desktop/bond/alignments.json Aligned directory not specified. All faces listed in the alignments file will be converted Alignments file not found. Generating at default values... Output Directory: /home/luke/Desktop/bonder Input Directory: /home/luke/Desktop/bond Loading Extract from Extract_Align plugin... Using json serializer Alignments filepath: /home/luke/Desktop/bond/alignments.json Starting, this may take a while... 0%| | 0/8615 [00:00<?, ?it/s]Info: initializing keras model... 2018-04-27 04:52:11.949540: 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 2018-04-27 04:52:12.005466: I tensorflow/stream_executor/cuda/cuda_gpu_executor.cc:895] successful NUMA node read from SysFS had negative value (-1), but there must be at least one NUMA node, so returning NUMA node zero 2018-04-27 04:52:12.005943: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1105] Found device 0 with properties: name: Quadro M2200 major: 5 minor: 2 memoryClockRate(GHz): 1.036 pciBusID: 0000:01:00.0 totalMemory: 3.95GiB freeMemory: 3.83GiB 2018-04-27 04:52:12.005977: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1195] Creating TensorFlow device (/device:GPU:0) -> (device: 0, name: Quadro M2200, pci bus id: 0000:01:00.0, compute capability: 5.2) WARNING:tensorflow:From /usr/lib/python3.6/site-packages/keras/backend/tensorflow_backend.py:1349: calling reduce_mean (from tensorflow.python.ops.math_ops) with keep_dims is deprecated and will be removed in a future version. Instructions for updating: keep_dims is deprecated, use keepdims instead 0%|▏ | 35/8615 [00:23<1:37:11, 1.47it/s]

fetchlister commented 6 years ago

By the way - training works perfectly fine.

Kirin-kun commented 6 years ago

It looks likes you didn't extract before converting. So the program is trying to extract first. It should convert "on the fly" though.

Could you extract the faces from /home/luke/Desktop/bond so it generates an alignments.json prior to converting, so as to know at what step the problem might be?

torzdf commented 6 years ago

@fetchlister Have you waited for the process to complete? As @Kirin-kun says, it looks like you didn't extract first. This is fine, but it's now a 2 step process if you don't have an alignments file.

1) Extract alignments (there will be no output at this stage, so the destination directory will be empty) 2) Perform conversion (this is when the output directory will start filling up)

This change was implemented because in the past conversion without an alignments file would lead to Out of Memory failures.

fetchlister commented 6 years ago

Of course I extracted - didn't you see the

"0%|▏ | 35/8615 [00:23<1:37:11, 1.47it/s]"

?

Its clearly seeing the 8615 photos but not converting them.

Kirin-kun commented 6 years ago

"Alignments file not found. Generating at default values..."

It doesn't find "/home/luke/Desktop/bond/alignments.json" so it starts by extracting.

fetchlister commented 6 years ago

alright so assuming I'm in the directory with my frames to be converted, what commands would I now run to both generate a alignments file and convert the pictures? Assuming that the directory is just full of sequencially named frames - not faces.(I've already built the model)

Kirin-kun commented 6 years ago

python /home/luke/faceswap/faceswap.py extract -i '/home/luke/Desktop/bond' -o '/home/luke/Desktop/bond/aligned' -D cnn -ae

It should extract the faces and create an alignments.json

Review the "aligned" directory to see if there's any false positive.

Kirin-kun commented 6 years ago

Then you can re-launch your convert command:

python /home/luke/faceswap/faceswap.py convert -b 15 -e 10 -i '/home/luke/Desktop/bond' -o '/home/luke/Desktop/bonder' -m '/home/luke/Videos/my own deepfakes/kendrickmodel'

And we will see how it goes.

fetchlister commented 6 years ago

So we now have to run an extract to build the model and then one again for conversion? That seems a bit overkill.

torzdf commented 6 years ago

No, I think you're missing the point.

For what ever reason you do not have an alignments.json file. This is fine, you don't have to have one, but one must be generated.

So, you can do one of 2 things:

1) Do as @Kirin-kun suggests, run extract first then run convert 2) Just run convert

If you just run convert, then extract will be run at default settings to generate the alignments.json.

This is what you are seeing here:


Alignments file not found. Generating at default values...
Output Directory: /home/luke/Desktop/bonder
Input Directory: /home/luke/Desktop/bond
Loading Extract from Extract_Align plugin...
Using json serializer
Alignments filepath: /home/luke/Desktop/bond/alignments.json
Starting, this may take a while...

At this point, No files will be output it is just reading the images to generate the alignments file.

Once that process is complete, it will automatically move on to convert when it will start generating your output.

Kirin-kun commented 6 years ago

You don't need the alignments file to build the model. You just need faces.

The procedure has always been:

The recent change just extract before converting if it doesn't find the alignments file, because otherwise it wouldn't know where to place the face. It just doesn't save the extracted faces.

fetchlister commented 6 years ago

@Kirin-kun Are the faces then I guess held in memory or a temp dir until they are all enumerated and an alignment file can be made? I'm seeing disk activity but nothing in /tmp.

Kirin-kun commented 6 years ago

You'd have to ask that to @torzdf he's the one who wrote the code.

Let the whole process run through. As long as the progress bar moves, it's doing something.

Kirin-kun commented 6 years ago

And yeah, the alignments.json is built in memory, be it in the single extract command or the extract->convert command. In the single extract command, it's saved at the end though.

But I don't recommend ignoring the "extract" step because you don't have any control over the extraction process if it's launched from the convert command, as it will use the default options.

Notably, it will use the default extractor (hog) and not try to rotate, which means it may detect less faces depending on your images.

torzdf commented 6 years ago

Actually it will use the detector selected (detector is a cross script option), but yeah, it's recommended to run extract yourself for the reasons @Kirin-kun says.

torzdf commented 6 years ago

I don't think there is an issue here, but if there is, please feel free to re-open