kwonminki / Asyrp_official

official repo for Asyrp : Diffusion Models already have a Semantic Latent Space (ICLR2023)
MIT License
249 stars 20 forks source link

Distorted image color #12

Closed hycsy2019 closed 1 year ago

hycsy2019 commented 1 year ago

Thanks for the excellent work! All my generated images had distorted color whether I used self-trained checkpoints or released pretrained models. test_19_4_ngen50.png test_19_4_ngen50 test_7_4_ngen50.png test_7_4_ngen50 train_0_0_ngen50.png train_0_0_ngen50 train_0_1_ngen50.png train_0_1_ngen50 train_0_2_ngen50.png train_0_2_ngen50

I only modified some command options of the scripts:

sh_file_name="script_precompute.sh"
gpu="6"

config="custom.yml" # if you use other dataset, config/path_config.py should be matched
guid="smiling"  # guid should be in utils/text_dic.py

CUDA_VISIBLE_DEVICES=$gpu python main.py --run_train                        \
                        --config $config                                    \
                        --exp ./runs/$guid                                  \
                        --edit_attr $guid                                   \
                        --do_train 1                                        \
                        --do_test 1                                         \
                        --n_train_img 100                                   \
                        --n_test_img 32                                     \
                        --bs_train 1                                        \
                        --get_h_num 1                                       \
                        --train_delta_block                                 \
                        --t_0 999                                           \
                        --n_inv_step 50                                     \
                        --n_train_step 50                                   \
                        --n_test_step 50                                    \
                        --just_precompute                                   \
                        --custom_train_dataset_dir "/data/dataset/CelebA-HQ-1024_0-999"       \
                        --custom_test_dataset_dir "/data/dataset/CelebA-HQ-1024_0-999"         \
                        --sh_file_name "script_precompute.sh"       \
                        --model_path      "/mnt/Asyrp_official/pretrained/celebahq_p2.pt"
#!/bin/bash

sh_file_name="script_train.sh"
gpu="6"

config="custom.yml" # if you use other dataset, config/path_config.py should be matched
guid="smiling" # guid should be in utils/text_dic.py

CUDA_VISIBLE_DEVICES=$gpu python main.py --run_train                        \
                        --config $config                                    \
                        --exp ./runs/$guid                                  \
                        --edit_attr $guid                                   \
                        --do_train 1                                        \
                        --do_test 1                                         \
                        --n_train_img 100                                   \
                        --n_test_img 32                                     \
                        --n_iter 5                                          \
                        --bs_train 4                                        \
                        --t_0 999                                           \
                        --n_inv_step 1000                                     \
                        --n_train_step 50                                   \
                        --n_test_step 1000                                   \
                        --get_h_num 1                                       \
                        --train_delta_block                                 \
                        --sh_file_name $sh_file_name                        \
                        --save_x0                                           \
                        --use_x0_tensor                                     \
                        --hs_coeff_delta_h 1.0                              \
                        --lr_training 0.5                                   \
                        --clip_loss_w 1.0                                   \
                        --l1_loss_w 3.0                                     \
                        --retrain 1                                         \
                        --sh_file_name "script_train.sh"  \
                        --model_path      "/mnt/Asyrp_official/pretrained/celebahq_p2.pt" \
                        --custom_train_dataset_dir "/data/dataset/CelebA-HQ-1024_0-999"       \
                        --custom_test_dataset_dir "/data/dataset/CelebA-HQ-1024_0-999"         \
#!/bin/bash

sh_file_name="script_inference.sh"
gpu="6"
config="custom.yml"
guid="smiling"
test_step=1000    # if large, it takes long time.
dt_lambda=1.0   # hyperparameter for dt_lambda. This is the method that will appear in the next paper.

CUDA_VISIBLE_DEVICES=$gpu python main.py --run_test                         \
                        --config $config                                    \
                        --exp ./runs/${guid}                                \
                        --edit_attr $guid                                   \
                        --do_train 1                                    \
                        --do_test 1                                         \
                        --n_train_img 100                                  \
                        --n_test_img 32                                     \
                        --n_iter 5                                          \
                        --bs_train 1                                        \
                        --t_0 999                                           \
                        --n_inv_step 50                                     \
                        --n_train_step 50                                   \
                        --n_test_step $test_step                            \
                        --get_h_num 1                                       \
                        --train_delta_block                                 \
                        --sh_file_name $sh_file_name                        \
                        --save_x0                                           \
                        --use_x0_tensor                                     \
                        --hs_coeff_delta_h 1.0                              \
                        --dt_lambda $dt_lambda                              \
                        --add_noise_from_xt                                 \
                        --lpips_addnoise_th 1.2                             \
                        --lpips_edit_th 0.33                                \
                        --sh_file_name "script_inference.sh"              \
                        --model_path      "/mnt/Asyrp_official/pretrained/celebahq_p2.pt" \
                        --custom_train_dataset_dir "/data/dataset/CelebA-HQ-1024_0-999"                \
                        --custom_test_dataset_dir "/data/dataset/CelebA-HQ-1024_0-999"     \
                        --manual_checkpoint_name "smiling_LC_CelebA_HQ_t999_ninv40_ngen40_0.pth" \