sail-sg / inceptionnext

InceptionNeXt: When Inception Meets ConvNeXt (CVPR 2024)
https://arxiv.org/abs/2303.16900
Apache License 2.0
233 stars 16 forks source link

inceptionnext performance #10

Open suisui-su-crtl opened 1 year ago

suisui-su-crtl commented 1 year ago

Hello, I tried to use inceptionnext as the encoder, but the experiment results are not ideal ( The performance is even worse than convnext, I think maybe I made a mistake), can you help me to see if there is a problem with my code?

Since the encoder is connected to the decoder at each layer, I need to extract the results of each layer.

original:

def forward(self, x):
    x = self.forward_features(x)
    x = self.forward_head(x)  # I removed this part of the code because of the encoder
    return x

I modified:

def forward(self, x):
    y = x
    y = self.stem(y)
    y = self.stages[0] (y)
    x1 = y

    y = self.stages[1] (y)
    x2 = y

    y = self.stages[2] (y)
    x3 = y

    y = self.stages[3] (y)
    x4 = y

    return x1, x2, x3, x4
yuweihao commented 1 year ago

Hi, for the semantic segmentation task in the paper, we add SyncBN for the output of each stage, like return syncbn1(x1), syncbn2(x2), syncbn3(x3), syncbn4(x4).

suisui-su-crtl commented 1 year ago

Thank you very much for your help. My research area is semantic segmentation.

Do you mean to add SyncBN layer after the output of each layer?

I have some questions about SyncBN layer.

I don't see the use of SyncBN in code. Do I need to add it by myself?

I use a single card for training, search found that SyncBN can support multi-card training, syncbn is useful for my training? Or is it more appropriate to directly add a BN layer?

Looking forward to your reply, which is very important to me.

yuweihao commented 1 year ago

Hi, yes, BN needs to add for the semantic segmentation task. For a single GPU, BN is equal to SyncBN. For multi-GPU training, please remember to use SyncBN.

116022017144 commented 1 year ago

in instance segmentation task,I didn't use the BN for the output of each stage,and my result of experiment is bad.

116022017144 commented 1 year ago

I don't know the reason.I use inceptionnext-tiny to replace resnet50, why the result is worse.

yuweihao commented 1 year ago

Hi @116022017144 ,

Besides adding SyncBN for the output of each stage, remember to replace BN in InceptionNeXt with SyncBN.

116022017144 commented 1 year ago

ok,thank you!Do all the BN is needed to be replaced?

116022017144 commented 1 year ago

还有对每个stage输出做SyncBN,这样可以吗?self.stages = nn.Sequential(norm_layer(dims[0])),还是只需要在声明形参那里这样 norm_layer=nn.SyncBatchNorm,就行

116022017144 commented 1 year ago

这个类class MlpHead(nn.Module),如果做分割任务的话,我看是没有用到的,其norm层不用管了吧?

yuweihao commented 1 year ago

Hi @116022017144 , yes, I remove all MlpHead for semantic segmentation.

116022017144 commented 1 year ago

image I met the error. And my model support distrbuted training.

suisui-su-crtl commented 1 year ago

Hi @116022017144 , yes, I remove all MlpHead for semantic segmentation.

Can you come up with a semantic segmentation version of inceptionnext when you have time? I would really appreciate it if you could!

I added BN layers after each output layer, but the accuracy is only slightly improved, similar to the performance of convnext. I'm having a hard time finding the problem.

116022017144 commented 1 year ago

sorry,I use it in instance segmentation task, so I can't help you! Now I don't replace BN,because I met some errors

---Original--- From: @.> Date: Thu, May 25, 2023 22:03 PM To: @.>; Cc: @.**@.>; Subject: Re: [sail-sg/inceptionnext] inceptionnext performance (Issue #10)

yuweihao commented 1 year ago

image I met the error. And my model support distrbuted training.

Hi, I use MMSeg for semantic segmentation. SyncBN code like this

from mmcv.cnn import build_norm_layer

norm_cfg=dict(type='SyncBN', requires_grad=True)

self.norm = build_norm_layer(norm_cfg, out_chs)[1]
yuweihao commented 1 year ago

Hi @116022017144 , yes, I remove all MlpHead for semantic segmentation.

Can you come up with a semantic segmentation version of inceptionnext when you have time? I would really appreciate it if you could!

I added BN layers after each output layer, but the accuracy is only slightly improved, similar to the performance of convnext. I'm having a hard time finding the problem.

Hi, sorry that I am so busy recently and may have no time to clean the code. Following ConvNeXt, we report mIoU multi-scale testing in Table 5 in the paper, where InceptionNeXt significantly outperforms ConvNeXt. Besides, I also evaluate it with single scale, finding the performance of InceptionNeXt is similar to ConvNeXt. It seems InceptionNeXt is more in favor of multi-scale testing.

suisui-su-crtl commented 1 year ago

Hi @116022017144 , yes, I remove all MlpHead for semantic segmentation.

Can you come up with a semantic segmentation version of inceptionnext when you have time? I would really appreciate it if you could! I added BN layers after each output layer, but the accuracy is only slightly improved, similar to the performance of convnext. I'm having a hard time finding the problem.

Hi, sorry that I am so busy recently and may have no time to clean the code. Following ConvNeXt, we report mIoU multi-scale testing in Table 5 in the paper, where InceptionNeXt significantly outperforms ConvNeXt. Besides, I also evaluate it with single scale, finding the performance of InceptionNeXt is similar to ConvNeXt. It seems InceptionNeXt is more in favor of multi-scale testing.

Ok, I can understand. Thank you very much for your help many times. I will read the paper in detail again to find the answer.