likyoo / Siam-NestedUNet

The pytorch implementation for "SNUNet-CD: A Densely Connected Siamese Network for Change Detection of VHR Images"
MIT License
252 stars 60 forks source link

some issues #7

Closed Diane0323 closed 3 years ago

Diane0323 commented 3 years ago

Thank you very much for your excellent work. The FLOPs I calculated are inconsistent with the results in this letter. I want to know how you calculate FLOPs? If it is convenient, can you share the code for calculating FLOPs? And I noticed that the accuracy of the public model is higher than that in this letter. Is this the best model you trained?Or is it different test results caused by different hardware? I'm looking forward to your reply.

likyoo commented 3 years ago

Hi @Diane0323, the FLOPs is calculated by thop (https://github.com/Lyken17/pytorch-OpCounter). And yes, the public model is almost our best model, we have written a relatively average result in the letter.

Diane0323 commented 3 years ago

@likyoo Thank you!I use thop like this. The output obtained under c16 is 13.78GFLOPs. I don’t know if I have used it wrong.

model = SNUNet_ECAM(in_ch=3,out_ch=2) x = torch.randn(1, 3, 256, 256) y = torch.randn(1, 3, 256, 256) from thop import profile flop, para = profile(model.cpu(), inputs=[x,y]) print("%.2fGFLOPs" % (flop / 1e9), "%.2fM" % (para / 1e6))

Diane0323 commented 3 years ago

我发现和文章里是2倍关系,但是用乘2吗

likyoo commented 3 years ago

是的,这里参考的是 https://github.com/sovrasov/flops-counter.pytorch/issues/16#issuecomment-518585837

Diane0323 commented 3 years ago

非常感谢!