wgcban / ddpm-cd

Remote Sensing Change Detection using Denoising Diffusion Probabilistic Models
https://www.wgcban.com/research#h.ar24vwqlm021
MIT License
247 stars 29 forks source link

TypeError: 'NoneType' object is not callable help #3

Closed Crawlling closed 1 year ago

Crawlling commented 1 year ago

22-07-18 13:32:55.933 - INFO: Begin Model Evaluation (testing). Traceback (most recent call last): File "D:\project\ddpm-cd-master\ddpm_cd.py", line 344, in change_detection.test() File "D:\project\ddpm-cd-master\model\cd_model.py", line 78, in test self.pred_cm = self.netCD(self.feats_A, self.feats_B) File "C:\Users\10576\AppData\Local\conda\conda\envs\ddpm\lib\site-packages\torch\nn\modules\module.py", line 1110, in _call_impl return forward_call(*input, kwargs) File "D:\project\ddpm-cd-master\model\cd_modules\cd_head_v2.py", line 107, in forward diff = torch.abs( layer(f_A) - layer(f_B) ) File "C:\Users\10576\AppData\Local\conda\conda\envs\ddpm\lib\site-packages\torch\nn\modules\module.py", line 1110, in _call_impl return forward_call(*input, *kwargs) File "D:\project\ddpm-cd-master\model\cd_modules\cd_head_v2.py", line 57, in forward return self.block(x) File "C:\Users\10576\AppData\Local\conda\conda\envs\ddpm\lib\site-packages\torch\nn\modules\module.py", line 1110, in _call_impl return forward_call(input, kwargs) File "C:\Users\10576\AppData\Local\conda\conda\envs\ddpm\lib\site-packages\torch\nn\modules\container.py", line 141, in forward input = module(input) TypeError: 'NoneType' object is not callable

Crawlling commented 1 year ago

help please

Crawlling commented 1 year ago

All the pretrained CD head models i can not use..but i can use the diffusion model.

wgcban commented 1 year ago

Are you using the correct pre-trained CD model? There are different configurations (t).

Crawlling commented 1 year ago

Are you using the correct pre-trained CD model? There are different configurations (t).

thx for reply!i've check the pre-trained CD model and config,it is correct,i don't know why this alway happen,i've already try it on 2 PC. but i try to use pre-trained Diffusion model to train CD head model,in epoch 0,it still got pretty nice F1 and iou.thank you.

wgcban commented 1 year ago

I see. I will look into this problem. The thing is, it is working fine with my machine. I am happy that at least you managed to fine-tune it and got reasonable iou. I will look into this problem and update you if I find the reason. In case if you find the reason, pls post it here so that it will benefit others. Thank you.

Crawlling commented 1 year ago

I see. I will look into this problem. The thing is, it is working fine with my machine. I am happy that at least you managed to fine-tune it and got reasonable iou. I will look into this problem and update you if I find the reason. In case if you find the reason, pls post it here so that it will benefit others. Thank you.

thank you for your patience,i will.

wgcban commented 1 year ago

@Crawlling Did you specify the correct time steps (t) here corresponding to the fine-tuned model you use in the test config: https://github.com/wgcban/ddpm-cd/blob/4876ec604f1dcdac9f8578ee40abbd9acb02c123/config/dsifn_test.json#L63

Crawlling commented 1 year ago

specify

OMG,i forgot this,my bad, sorry for wasting your time.thank you again!

wgcban commented 1 year ago

@Crawlling np.

sitongzhen commented 1 year ago

How much memory does this method take? Is 24GB not enough by default?

wgcban commented 1 year ago

Hi @sitongzhen Do you mean pre-training or fine-tuning? I used one 48GB GPU for my experiments, and I believe a 24GB GPU should be fine. You just need to reduce the batch size in the config file. However, you can significantly save time by initializing your model with the pre-trained models provided here, as that will make the training faster even on new datasets.

Feel free to reach out to me know if you have more questions.

Also, the code works on multiple GPUs as well.

sitongzhen commented 1 year ago

Yes, I understand. Thanks for your answer. When the batch is 8, I find the 24 G memory is insufficient in the training process.

wgcban commented 1 year ago

@sitongzhen I don't expect results to vary significantly, and it is fine given the memory constraint. I see, make it down to 4 and see the results. Good luck!