Ldhlwh / DFMGAN

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

Seek error in Stage 2 #4

Closed sweetdream33 closed 1 year ago

sweetdream33 commented 1 year ago

Describe the bug A clear and concise description of what the bug is. Traceback (most recent call last): File "train.py", line 651, in main() # pylint: disable=no-value-for-parameter File "/home/vision-ai/.local/lib/python3.6/site-packages/click/core.py", line 1128, in call return self.main(args, kwargs) File "/home/vision-ai/.local/lib/python3.6/site-packages/click/core.py", line 1053, in main rv = self.invoke(ctx) File "/home/vision-ai/.local/lib/python3.6/site-packages/click/core.py", line 1395, in invoke return ctx.invoke(self.callback, ctx.params) File "/home/vision-ai/.local/lib/python3.6/site-packages/click/core.py", line 754, in invoke return __callback(args, kwargs) File "/home/vision-ai/.local/lib/python3.6/site-packages/click/decorators.py", line 26, in new_func return f(get_current_context(), *args, kwargs) File "train.py", line 644, in main subprocess_fn(rank=0, args=args, temp_dir=temp_dir) File "train.py", line 478, in subprocess_fn training_loop.training_loop(rank=rank, args) File "/home/vision-ai/nas_data/hmjung/2023/02.multi_channel/DFMGAN/training/training_loop.py", line 146, in training_loop training_set = dnnlib.util.construct_class_by_name(*training_set_kwargs) # subclass of training.dataset.Dataset File "/home/vision-ai/nas_data/hmjung/2023/02.multi_channel/DFMGAN/dnnlib/util.py", line 296, in construct_class_by_name return call_func_by_name(args, func_name=class_name, kwargs) File "/home/vision-ai/nas_data/hmjung/2023/02.multi_channel/DFMGAN/dnnlib/util.py", line 291, in call_func_by_name return func_obj(*args, **kwargs) File "/home/vision-ai/nas_data/hmjung/2023/02.multi_channel/DFMGAN/training/dataset.py", line 178, in init raw_shape = [len(self._image_fnames)] + list(self._load_raw_image(0).shape) File "/home/vision-ai/nas_data/hmjung/2023/02.multi_channel/DFMGAN/training/dataset.py", line 217, in _load_raw_image image = np.load(f) File "/opt/conda/lib/python3.6/site-packages/numpy/lib/npyio.py", line 426, in load fid.seek(-min(N, len(magic)), 1) # back-up io.UnsupportedOperation: seek

To Reproduce Steps to reproduce the behavior:

  1. In Stage 2: Transfer Learning python train.py --data ./data/hazelnut_hole_mask.zip \ --outdir runs/hazelnut_hole --resume pkls/hazelnut_good.pkl \ --gpus 2 --kimg 400 --snap 10 --transfer res_block_match_dis
  2. Hello, Thanks for providing the code. The train in stage 1 went well, but in stage 2, during transfer learning using the mask file, a seek error occurs in the load part. how can i fix it?

Desktop (please complete the following information):

Ldhlwh commented 1 year ago

Hello @sweetdream33,

Haven't seen a similar error. Could you provide your numpy version btw?

sweetdream33 commented 1 year ago

Hello @Ldhlwh , Thanks for your answer. numpy version is 1.19.1

Ldhlwh commented 1 year ago

Still not sure of the reason. Maybe try unzipping hazelnut_hole_mask.zip and loading one of the npy files manually?

15931012764 commented 1 year ago

I'm having another problem with a stage 2 . File "DFMGAN/training/networks.py", line 590, in forward return img, mask UnboundLocalError: local variable 'mask' referenced before assignment I've tried a lot of methods and nothing has fixed it. It has been troubling me for days now. please help.

Ldhlwh commented 1 year ago

Hello @15931012764,

It seems that the program did not go into the branch in line 583 if res >= self.res_st and not fix_residual_to_zero:

You may check whether you have set --res-st correctly

15931012764 commented 1 year ago

Would changing the default 256 for width and height in the dataset section cause this problem? (File "DFMGAN/training/networks.py", line 590, in forward    return img, mask UnboundLocalError: local variable 'mask' referenced before assignment) Thank you!

魏静静 @.***

 

------------------ 原始邮件 ------------------ 发件人: "Ldhlwh/DFMGAN" @.>; 发送时间: 2023年7月27日(星期四) 晚上9:25 @.>; @.**@.>; 主题: Re: [Ldhlwh/DFMGAN] Seek error in Stage 2 (Issue #4)

Hello @15931012764,

It seems that the program did not go into the branch in line 583 if res >= self.res_st and not fix_residual_to_zero:

You may check whether you have set --res-st correctly

— Reply to this email directly, view it on GitHub, or unsubscribe. You are receiving this because you were mentioned.Message ID: @.***>

Ldhlwh commented 1 year ago

Yes, you should make sure that res_st is not greater than image resolution