RealForensics icon indicating copy to clipboard operation
RealForensics copied to clipboard

Path building error in stage2/eval.py

Open Wertiz opened this issue 2 years ago • 4 comments

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.

Wertiz avatar Feb 16 '23 09:02 Wertiz

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?

ahaliassos avatar Feb 17 '23 15:02 ahaliassos

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.

Wertiz avatar Feb 20 '23 10:02 Wertiz

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.

FeiTeacher avatar Apr 04 '23 12:04 FeiTeacher

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

nguyenvulong avatar Jan 20 '24 17:01 nguyenvulong