GithubHelp home page GithubHelp logo

Comments (6)

csuhan avatar csuhan commented on August 22, 2024

Hi, @PressEtoRace . Following the trend of anchor-free models, s2anet uses one anchor per location in the feature maps, which saves computations and runs faster. So we haven't implemented multiple anchors learning. But it is not impossible to train s2anet with multiple anchors. Some methods in s2anet_head should be modified:

  1. _init_layers, forward_single. You need add multiple anchors like RetinaNet. Also, modify anchor generation method and bbox_decode method for a batch of anchors. Besides, modify anchor2offset in AlignConv so that multiple anchors in per location can get multiple offset (see here).
  2. loss and get_refine_anchors. Modify get_refine_anchors, loss_fam_single and loss_odm_single.
  3. get_bboxes.

Take Retinanet as a reference, it will be not hard if you fully understand our paper and mmdetection.

from s2anet.

vision-zhu avatar vision-zhu commented on August 22, 2024

Have you implemented multiple scales? @PressEtoRace , Can you share me the model after change? Thank you very much! My e-mail is [email protected]

from s2anet.

LoveDLWujing avatar LoveDLWujing commented on August 22, 2024

i just modified the AlignConv to support multi scale and multi ratio anchor setting, it seems to work

    def forward(self, x, anchors, stride):
        out = list()
        for i in range(self.anchor_num):
            offset = anchor2offset(anchors[..., i * 5: (i+1) * 5], self.kernel_size, stride)
            out.append(self.relu(self.deform_conv(x, offset)))
        # TODO: max-pooling over multi anchor to get feature
        out = torch.stack(out, dim=1)
        out, _ = torch.max(out, dim=1, keepdim=False)
        return out

and modified the _init_layers

self.fam_reg = nn.Conv2d(self.feat_channels, self.num_anchors * 5, 1)
self.fam_cls = nn.Conv2d(self.feat_channels, self.num_anchors * self.cls_out_channels, 1)

self.odm_cls = nn.Conv2d(self.feat_channels, self.num_anchors * self.cls_out_channels, 3, padding=1)
self.odm_reg = nn.Conv2d(self.feat_channels, self.num_anchors * 5, 3, padding=1)

from s2anet.

taoboyang avatar taoboyang commented on August 22, 2024

i just modified the AlignConv to support multi scale and multi ratio anchor setting, it seems to work

    def forward(self, x, anchors, stride):
        out = list()
        for i in range(self.anchor_num):
            offset = anchor2offset(anchors[..., i * 5: (i+1) * 5], self.kernel_size, stride)
            out.append(self.relu(self.deform_conv(x, offset)))
        # TODO: max-pooling over multi anchor to get feature
        out = torch.stack(out, dim=1)
        out, _ = torch.max(out, dim=1, keepdim=False)
        return out

and modified the _init_layers

self.fam_reg = nn.Conv2d(self.feat_channels, self.num_anchors * 5, 1)
self.fam_cls = nn.Conv2d(self.feat_channels, self.num_anchors * self.cls_out_channels, 1)

self.odm_cls = nn.Conv2d(self.feat_channels, self.num_anchors * self.cls_out_channels, 3, padding=1)
self.odm_reg = nn.Conv2d(self.feat_channels, self.num_anchors * 5, 3, padding=1)

Hi I want to know How to set self.anchor_num

from s2anet.

seacloud-0420 avatar seacloud-0420 commented on August 22, 2024

@LoveDLWujing
Hi,I followed the code you posted with no success. Could you please post all the changed code?

from s2anet.

seacloud-0420 avatar seacloud-0420 commented on August 22, 2024

@PressEtoRace @vision-zhu @taoboyang
Use multiple anchors to train, have you implemented it successfully? Can you share me the model after change? Thank you very much!

from s2anet.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.