HighwayWu / LASTED

Synthetic Image Detection
MIT License
51 stars 2 forks source link

Some question for rerun the code #12

Closed ttttsjjjj closed 5 months ago

ttttsjjjj commented 6 months ago

Hello ,i am new in research.I have already set all the settings through READ ME file.But when i run the code by "sh main.sh" some problems occurs:DataParallel' object has no attribute 'data_root' .Here are my settings in main.sh: python main.py \ --model 'LASTED' \ --train_file 'annotation/Train_Photos_num199244.txt' \ --num_class 2\ --val_ratio 0.005 \ --test_file 'annotation/Test_MidjourneyV5_num2000.txt' \ --isTrain 1 \ --lr 0.0001 \ --resume '' \ --data_size 448 \ --batch_size 6\ --gpu '1,2' \ 2>&1 | tee weights/log.log If I miss something please make me know .Thank you !

HighwayWu commented 6 months ago

Thanks for your asking. By default, all the images should be placed in the 'data/' folder, which is also the default 'data_root'. Also, please provide a more detailed error screenshot for analyzing.

ttttsjjjj commented 6 months ago

Thanks for your reply!Here are my training images in the 'data/'folder,(i just use the dataset'RealPhoto_LSUN'and 'SyntheticPhoto_ProGAN' for training) image

Also i have prepared the training txt file named "Train_Photos_num199244" under the folder"annotation"through preprocess.py. image

Then i set the main.sh file like this: image

Finally,i run this code by "sh main.sh"in the terminal.But some problems occurs: image If i miss something please tell me.Thank you again for taking the time to reply !

HighwayWu commented 6 months ago

Sorry for the inconvenience. The reason is that the "model" was incorrectly read as "args" in line. The error has been corrected, please refer to the new "main.py".

ttttsjjjj commented 6 months ago

Thank you very much for your reply, the previous issue is solved! But now a new question arises: image image Looking forward for your reply. Thank you again!

HighwayWu commented 6 months ago

Sorry again for the inconvenience. The "images" should have only 4 dims, i.e., batch-size, channels, H, and W. The "rep" shoule be removed. Therefore, the line should be "b, C, H, W = images.shape", and there is no need to do ".reshape" in the next line. Relevant codes have been updated, and thanks for pointing out this issue.

ttttsjjjj commented 6 months ago

Thanks again for your reply, the previous issue is solved! But another small problem arises: image (ps:You are really very helpful and your reply really helped me a lot, thank you again!)

HighwayWu commented 6 months ago

"val_score" was forgotten to be defined. Please correct it to a specific metric, such as "val_auc" or "val_ap".

ttttsjjjj commented 5 months ago

All problems solved! Thanks a lot.