DeepFaceLab icon indicating copy to clipboard operation
DeepFaceLab copied to clipboard

Preview not working when training

Open Toasterbirb opened this issue 4 years ago • 10 comments

Expected behavior

Ran the command bash 6_train_SAEHD.sh, followed trough the terminal prompts. A preview window of the progress should launch

Actual behavior

Training starts, and the preview window doesn't launch. Spits out this error:

Traceback (most recent call last):][5.1329]
  File "/home/toasterbirb/projects/deepfacelab/DeepFaceLab_Linux/./DeepFaceLab/main.py", line 343, in <module>
    arguments.func(arguments)
  File "/home/toasterbirb/projects/deepfacelab/DeepFaceLab_Linux/./DeepFaceLab/main.py", line 132, in process_train
    Trainer.main(**kwargs)
  File "/home/toasterbirb/projects/deepfacelab/DeepFaceLab_Linux/DeepFaceLab/mainscripts/Trainer.py", line 323, in main
    io.show_image( wnd_name, (final*255).astype(np.uint8) )
  File "/home/toasterbirb/projects/deepfacelab/DeepFaceLab_Linux/DeepFaceLab/core/interact/interact.py", line 128, in show_image
    self.on_create_window(wnd_name)
  File "/home/toasterbirb/projects/deepfacelab/DeepFaceLab_Linux/DeepFaceLab/core/interact/interact.py", line 460, in on_create_window
    cv2.namedWindow(wnd_name)
cv2.error: OpenCV(4.5.1) /tmp/pip-req-build-2mj8ejrk/opencv/modules/highgui/src/window.cpp:634: error: (-2:Unspecified error) The function is not implemented. Rebuild the library with Windows, GTK+ 2.x or Cocoa support. If you are on Ubuntu or Debian, install libgtk2.0-dev and pkg-config, then re-run cmake or configure script in function 'cvNamedWindow'

Steps to reproduce

Run bash 6_train_SAEHD.sh and set the settings for training.

Other relevant information

Command that runs (I think):

main.py train \
    --training-data-src-dir "$DFL_WORKSPACE/data_src/aligned" \
    --training-data-dst-dir "$DFL_WORKSPACE/data_dst/aligned" \
    --pretraining-data-dir "$DFL_ROOT/pretrain_CelebA" \
    --model-dir "$DFL_WORKSPACE/model" \
    --model SAEHD
  • Arch Linux x86_64
  • GPU: NVIDIA GeForce RTX 3060
  • Python 3.9.7
  • Installed DeepFaceLab following this guide: https://github.com/nagadit/DeepFaceLab_Linux

Toasterbirb avatar Dec 12 '21 18:12 Toasterbirb

Bro, if it errors out. It is not even training.

Please change the title to something that includes this: cv2.error: OpenCV(4.5.1)

And try following the lovely last line of the error message. It actually tells you what to install to fix it.

It is not 100% sure that it is the fix to your problem but it looks correct what they tell you to do :)

qkum avatar Dec 12 '21 20:12 qkum

Why are you asking for Linux support in this repo?

This is the windows repo.

Go back to the Linux repo and repost there plz :)

qkum avatar Dec 12 '21 20:12 qkum

Bro, if it errors out. It is not even training.

Please change the title to something that includes this: cv2.error: OpenCV(4.5.1)

And try following the lovely last line of the error message. It actually tells you what to install to fix it.

It is not 100% sure that it is the fix to your problem but it looks correct what they tell you to do :)

It is training, and it also saved the first backup too showing what the preview would look like. In the terminal, it shows text like this:

[21:14:00][#002632][0541ms][1.6765][1.4653]
[21:38:50][#005267][0537ms][1.3516][1.0356]
[22:03:50][#008012][0564ms][1.2288][0.8789]
[22:28:51][#010634][0534ms][1.1509][0.7846]
[22:51:15][#013051][0567ms][1.0991][0.9172]

And the numbers go up and down. It didn't "error out", just the preview window did and it seems to be a separate thing from the actual training script.

Also, nowhere it says that this repo is windows only. I assumed that this repository is the main repository of the project and the other repos were just downstream installation guides. Python is cross-platform and my question might not be Linux specific at all.

Toasterbirb avatar Dec 12 '21 20:12 Toasterbirb

Aaah, I see.

Yeah, I noticed that the preview and the later on edit windows run in their own terminal in the background as you say. And the backbone training/merging/converting in its own terminal yes.

But it does not matter if the training part works if the preview part errors out with missing mondules.

You are still stuck.

This is the windows repo.

You are just n00b at github and don't understand that the repo where you downloaded the Linux version ofc is where the Linux questions goes fren.

qkum avatar Dec 13 '21 02:12 qkum

Friendly advice:

I noticed that most people on GitHub hate noobs. So, my advice is to stop your attitude. Because 9 out of 10 won't help you when they see your attitude.

When you are n00b at programming you have to kiss the shoes of those who can help you. That is how I did/do. Glad that I'm not n00b anymore.

So I can help myself now and others too :)

qkum avatar Dec 13 '21 02:12 qkum

Aaah, I see.

Yeah, I noticed that the preview and the later on edit windows run in their own terminal in the background as you say. And the backbone training/merging/converting in its own terminal yes.

But it does not matter if the training part works if the preview part errors out with missing mondules.

You are still stuck.

This is the windows repo.

You are just n00b at github and don't understand that the repo where you downloaded the Linux version ofc is where the Linux questions goes fren.

First of all, I don't know what you mean by me being "stuck". The training part is what is important, I can see the previews from the automated backups. It just would be nice addition to see the preview live. The important part is to have a model in the end.

Also, I know that I downloaded this software from the Linux repo, but how does that gatekeep me from coming to the actual upstream repository? One of the questions in the template is "Operating system". That in itself gives more room than just a singular OS (windows).

Friendly advice:

I noticed that most people on GitHub hate noobs. So, my advice is to stop your attitude. Because 9 out of 10 won't help you when they see your attitude.

When you are n00b at programming you have to kiss the shoes of those who can help you. That is how I did/do. Glad that I'm not n00b anymore.

So I can help myself now and others too :)

I don't know what is up with your friendly advice, but it comes out really rude. I don't know if you know what Github issues is meant for. Its everything else than personal discussions about my proficiency with computers. You can go flex with your python skills to some actual forum to assert your dominance. Just because you made your Github account in 2018 doesn't mean that you are somehow a senior in this field. I saw you mention that in some issue too as an argument.

I had an issue with the program, and I reported the issue in case someone else has come across is and knows a fix. If that were to happen, others with the same issue could find the fix later. DeepFaceLab is written in python and hence most of the stuff is universal between Linux and Windows. If this project was written in C or some other compiled language, it would be an entirely different case.

Toasterbirb avatar Dec 13 '21 10:12 Toasterbirb

Did you fix missing preview window?

zabique avatar Jun 01 '22 13:06 zabique

@zabique Nah, never found a solution for it. I just trained the thing blindly and hoped for the best. I think I ended up just wasting time with the whole project and the result was quite messed up

Toasterbirb avatar Jun 02 '22 14:06 Toasterbirb

[FIX by Dodo] If you run LINUX version of DFL, training started, but there is no training preview then edit: DeepFaceLab/core/interact/interact.py last lines of the file, change it to that: image_2022-06-02_202656139

zabique avatar Jun 02 '22 19:06 zabique

This solved it for me: Stackoverflow

I used: pip install opencv-python==4.1.2.30

yhsharaf avatar Apr 16 '23 09:04 yhsharaf

Did you ever find the answer? If so, would you mind sharing it and closing this issue?

joolstorrentecalo avatar Jun 08 '23 23:06 joolstorrentecalo

No, I never found an answer in time. As I said before, I trained blindly, got a messed up result and gave up.

I guess I can close this issue since there are a few solutions posted by others. I can't test those myself right now, so I'll simply trust that they work :D

If those solutions don't work for you @JDTCC (assuming you have this problem), you can open a new issue I guess

Toasterbirb avatar Jun 08 '23 23:06 Toasterbirb