insightface icon indicating copy to clipboard operation
insightface copied to clipboard

How to make the head of each branch have a different name loss_cls?

Open borninfreedom opened this issue 2 years ago • 0 comments

I printed the model structure.

  (bbox_head): SCRFDHead(
    (loss_cls): QualityFocalLoss()
    (loss_bbox): DIoULoss()
    (relu): ReLU(inplace=True)
    (cls_stride_convs): ModuleDict(
      ((8, 8)): ModuleList(
        (0): DepthwiseSeparableConvModule(
          (depthwise_conv): ConvModule(
            (conv): Conv2d(24, 24, kernel_size=(3, 3), stride=(1, 1), padding=(1, 1), groups=24, bias=False)
            (bn): BatchNorm2d(24, eps=1e-05, momentum=0.1, affine=True, track_running_stats=True)
            (activate): ReLU(inplace=True)

And then I read the model layer by layer. I found that the loss cls of each head branch is called the same name. I want to use different names to distinguish the loss of each branch, like the cls_stride_convs, which uses the (8, 8), (16, 16), (32, 32) to distinguish each branch.

The result I want may be like this:

(loss_cls): ModuleDict(
(8, 8): QualityFocalLoss()
(16,16): QualityFocalLoss()
(32,32): QualityFocalLoss()

borninfreedom avatar Sep 04 '22 08:09 borninfreedom