ZhendongWang6 / DIRE

[ICCV 2023] Official implementation of the paper: "DIRE for Diffusion-Generated Image Detection"
306 stars 24 forks source link

compute_dire.py questions #19

Closed whitebeacon closed 11 months ago

whitebeacon commented 1 year ago
6f0b1a979fb025eb7a1c93e1d596d78

Does any body know how to solve this problem?

ciodar commented 1 year ago

The weights you're loading are incorrect for the architecture. You have to configure the Unet parameters so that they match the weights you want to load.

whitebeacon commented 1 year ago

The weights you're loading are incorrect for the architecture. You have to configure the Unet parameters so that they match the weights you want to load.

Hello, I modified images_dir, recons_dir, dire_dir and model_path in the compute_dire.py file and modified these into my own paths, and no other code was changed. After running compute_dire.py, then come out this question, Did you perform any other operations during debugging?How to configure the Unet parameters?

ciodar commented 1 year ago

It depends on the model checkpoint. For LSUN-bedroom I am using the lsun_bedroom.pt checkpoint released with the ADM repository. In that repo you can verify what is the needed configuration for each checkpoint. If you are using compute_dire.sh you can directly modify the MODEL_FLAGS variable, otherwise you need to insert them into the configuration dictionary accordingly. For example, this is the configuration for LSUN-Bedroom:

attention_resolutions 32,16,8 
class_cond False 
diffusion_steps 1000 
dropout 0.1 
image_size 256 
learn_sigma True 
noise_schedule linear 
num_channels 256 
num_head_channels 64 
num_res_blocks 2 
resblock_updown True 
use_fp16 True 
use_scale_shift_norm True
whitebeacon commented 1 year ago

It depends on the model checkpoint. For LSUN-bedroom I am using the lsun_bedroom.pt checkpoint released with the ADM repository. In that repo you can verify what is the needed configuration for each checkpoint. If you are using compute_dire.sh you can directly modify the MODEL_FLAGS variable, otherwise you need to insert them into the configuration dictionary accordingly. For example, this is the configuration for LSUN-Bedroom:

attention_resolutions 32,16,8 
class_cond False 
diffusion_steps 1000 
dropout 0.1 
image_size 256 
learn_sigma True 
noise_schedule linear 
num_channels 256 
num_head_channels 64 
num_res_blocks 2 
resblock_updown True 
use_fp16 True 
use_scale_shift_norm True

Your answer is very helpful for a novice in artificial intelligence. Thank you very much.

whitebeacon commented 1 year ago

It depends on the model checkpoint. For LSUN-bedroom I am using the lsun_bedroom.pt checkpoint released with the ADM repository. In that repo you can verify what is the needed configuration for each checkpoint. If you are using compute_dire.sh you can directly modify the MODEL_FLAGS variable, otherwise you need to insert them into the configuration dictionary accordingly. For example, this is the configuration for LSUN-Bedroom:

attention_resolutions 32,16,8 
class_cond False 
diffusion_steps 1000 
dropout 0.1 
image_size 256 
learn_sigma True 
noise_schedule linear 
num_channels 256 
num_head_channels 64 
num_res_blocks 2 
resblock_updown True 
use_fp16 True 
use_scale_shift_norm True

hi,sorry to bother you,I changed the parameters according to the given configuration and added images to the folder indicated by 'images_ dir',but no images have been generated in the folder indicated by 'recons_dir' and 'dire_dir'. Why is this? ![Uploading 1700215702775.png…]()

whitebeacon commented 1 year ago
1700215702775
whitebeacon commented 1 year ago

Oh,I forget to modify the parameter 'num_samples'.After I changed 'num_samples' to the number of my images in that folder, this program can't be stopped.Why is it?

1700216940384