Ldhlwh / DFMGAN

[AAAI 2023] Official implementation of "Few-Shot Defect Image Generation via Defect-Aware Feature Manipulation".
https://arxiv.org/abs/2303.02389
Other
87 stars 12 forks source link

res_block_match_dis error #31

Closed CVKim closed 6 months ago

CVKim commented 6 months ago

training/training_loop.py", line 368, in training_loop assert phase_real_img.ndim == 4 and phase_real_img.shape[1] == 4 AssertionError

/opt/conda/lib/python3.8/multiprocessing/resource_tracker.py:216: UserWarning: resource_tracker: There appear to be 17 leaked semaphore objects to clean up at shutdown warnings.warn('resource_tracker: There appear to be %d '

assert phase_real_img.ndim == 4 and phase_real_img.shape[1] == 4

When res_block_match_dis is enabled, the above error occurs.

Ldhlwh commented 6 months ago

Please make sure you have preprocessed and used image & mask dataset here: https://github.com/Ldhlwh/DFMGAN/tree/main?tab=readme-ov-file#dataset

CVKim commented 6 months ago

image

I have an additional question.

The attached image is the result of training the mvtec-ad "leather_good" dataset, but it seems that good images are not being generated properly. What actions should be taken?

Please refer to the command below.


python train.py --data ./data/leather_good.zip \ --outdir runs/leather_good \ --gpus 2 --kimg 4000

Ldhlwh commented 6 months ago

You may check that whether you messed up RGB and BGR when using torchvision and opencv, or you may try turning off the differentiable augmentation.

CVKim commented 6 months ago

I created the leather_good.zip as specified in the official code and proceeded without making any changes to the code. Is there anything I need to change?

Additionally, I'm not sure where in the code the augmentation feature is turned off. Could you let me know?

Ldhlwh commented 6 months ago

The current codes should be good to use, but sometimes the augmentation may leak into the generated samples.

Such augmentation is a feature of StyleGAN2-ADA, you may refer to its original repo for options.