ahaliassos / RealForensics

Official code for Leveraging Real Talking Faces via Self-Supervision for Robust Forgery Detection (CVPR 2022)
MIT License
75 stars 7 forks source link

Path building error in stage2/eval.py #5

Open Wertiz opened 1 year ago

Wertiz commented 1 year ago

https://github.com/ahaliassos/RealForensics/blob/990243bd3aee8fff4742045e110411d53b504f13/stage2/eval.py#L26-L28

While building the weights path on line 27, os.path.realpath(__file__) does not return the real path of the file which, according to the readme, should be {working directory}/stage2/eval.py but returns {working directory}/outputs/YYYY-MM-DD/HH-MM-SS/stage2/eval.py

Subsequently, the weights path is built incorrectly and no weights will ever be found. This issue also continues to appear everywhere and I'm not able to reproduce these results. I assume hydra is interferring somehow.

ahaliassos commented 1 year ago

Does {working directory}/outputs/YYYY-MM-DD/HH-MM-SS/stage2/eval.py exist. And are you sure you're not running eval.py from that directory rather than {working directory}/stage2/eval.py?

Wertiz commented 1 year ago

Not quite. The directory {working directory}/outputs/YYYY-MM-DD/HH-MM-SS exists but it's empty, so not stage2 folder. It does not exist before running the command so it's impossible for me to run the command from that directory. I have done some tests printing os.path.realpath(__file__) both in if __name__=='__main__': and in @hydra.main. In the python main the path is correct while in the hydra main the path is wrong. Probably hydra changes the working directory to the output one where it can save intermidiate/output files.

I've circumvented the issue by hardcoding my paths and it's fairly trivial to put a personal fix in the code but it's still something that should be permanently fixed.

FeiTeacher commented 1 year ago

Hi,I had the same problem as you,and I hardcode the weights path.But another problem arises,the file of csv is not be found ,and I don't know how to solve the problem. Could you plz provide a demo code or some suggestions? That'll be super helpful.

nguyenvulong commented 8 months ago

Have you managed to disable hydra or hardcode in someway to make it work. This is too tedious.