LucaCorvitto / RealFaces_w_StableDiffusion

Git Repo with code and Dataset of the paper "On the use of Stable Diffusion for creating realistic faces: from generation to detection"
13 stars 0 forks source link

Problems to run cross_validation.py #1

Closed fegoyo closed 3 weeks ago

fegoyo commented 6 months ago

Hi, how are you?

My name is Fernanda and I am trying to understanding your code, as my first part of my Phd, but I have a problem with a cross_validaation.py, because haven't all the files necessary to runvthis code. This code needs some .pth files as 'center_crop_png_best.pth', referring to all the models that you mentioned on your article ('vit', 'vgg16', 'mobilenet', 'xception', 'resnet') with all transform_type = ['resize_only', 'center_crop', 'random_crop', 'random_resized_crop']. So, could you please, upload these files?

LucaCorvitto commented 6 months ago

Hi Fernanda!

Since I can not load the files directly on Github due to the size limitation, I will upload them on Google drive in the next days. I will update the README once I am done. Let me know if you run into any other problems.

fegoyo commented 6 months ago

Hi Luca!

Thanks for your quick answer!

I don't know if you can help me, but on the file binary_classifiers.py, I can't compress the image because isn't possible to find the .DS_STORE file. Probably, I think that this error occur because I am using MacBook m3 pro to test your code and, even watching, a lot of tutorials to disable this file I have this same error. So, could you please upload this file?

LucaCorvitto commented 6 months ago

Hi Fernanda!

The model checkpoints have been loaded on the drive folder inside the folder named "models". Each zip file contains all the checkpoints needed for the cross_validation run (hopefully). I also updated the README file for more info on how to run the cross_validation.py file. I hope it will be useful and solve the problem.

Regarding your problem with binary_classifier.py, can you please give me other information about the error, like the traceback? Meanwhile, I will try to run the code again and see what I can do to help you with that.

fegoyo commented 6 months ago

Sure! This is my error! I have .DS_Store file on this path, but still it continues with this problem. My python version is: 3.10.13. Thank you so much for help me.

Captura de Tela 2024-02-27 às 23 38 58
LucaCorvitto commented 6 months ago

The error seems to be caused by the fact that PIL tries to open .DS_Store as it was an image. The simplest solution should be deleting this file and check if the error persists. Otherwise, if this file is somewhat necessary in your folder, than you have to filter it out by adding a few lines of code to avoid opening it, and other potential non-image files, in compress_create like this:

if '.png' not in name:
    continue
img = Image.open(os.path.join(path, name))

Let me know if you have any other problem, I'll try to help.

fegoyo commented 6 months ago

Thank you so much! I will try to run this code and, if I have another problem, can I tell you? Curiosity ... do you know what base of stylegan3 did you use? I found all of this: Captura de Tela 2024-03-01 às 17 46 49

fegoyo commented 5 months ago

@LucaCorvitto Could you please, tell me what base of stylegan3 did you use? I found all of this: Captura de Tela 2024-03-11 às 16 10 45

Thank you!

LucaCorvitto commented 5 months ago

Hi Fernanda!

Sorry for my late response, I didn't see your question. We used the stylegan3-r-ffhq-1024x1024, I will add this information also on the readme file. Good luck with your work!

fegoyo commented 5 months ago

Hi Luca! No problem.

Thank you so much for all quick answers. It will help me!