@Bobo-y
farzadimanpour opened this issue · comments
@Bobo-y
Hello,
Can you explain this answer more?
Which parts should I modify? And what is your suggestion for possible modifications to have better results in the case of small object detection with this baseline?
Thanks
Originally posted by @farzadips in #97 (comment)
@farzadimanpour OK,I'll give you a detailed answer at the weekend. I'm busy with my work. sorry
Originally posted by @farzadips in #97 (comment)
for backbone, such as YOLO backbone, you want to detect more small object. you need output C2
'
def forward(self, x):
c1 = self.C1(x)
c2 = self.C2(c1)
conv1 = self.conv1(c2)
c3 = self.C3(conv1)
conv2 = self.conv2(c3)
c4 = self.C4(conv2)
conv3 = self.conv3(c4)
c5 = self.C5(conv3)
conv4 = self.conv4(c5)
sppf = self.sppf(conv4)
return c2, c3, c4, sppf
'
for FPN
`
def forward(self, inputs):
C2, C3, C4, C5 = inputs
P5 = self.P5(C5)
up5 = self.P5_upsampled(P5)
concat1 = self.concat([up5, C4])
conv1 = self.conv1(concat1)
P4 = self.P4(conv1)
up4 = self.P4_upsampled(P4)
concat2 = self.concat([C3, up4])
PP3 = self.P3(concat2)
PP2 = ......
you should add some op in here, inclue conv PP3 then upsample and concat, so you will get PP2
return PP2, PP3, P4, P5
`
for PAN ,just like FPN,
`
def forward(self, inputs):
PP2, PP3, P4, P5 = inputs
PP3 = ......
you should add some op in here, just like PP4, PP5
convp3 = self.convP3(PP3)
concat3_4 = self.concat([convp3, P4])
PP4 = self.P4(concat3_4)
convp4 = self.convP4(PP4)
concat4_5 = self.concat([convp4, P5])
PP5 = self.P5(concat4_5)
return PP2, PP3, PP4, PP5
`
for class YOLOHead
`
class YOLOHead(nn.Module):
stride = None
export = False
onnx_dynamic = False
def __init__(self, nc, anchors=None, ch=(256, 512, 1024), stride=[8., 16., 32.], inplace=True): # detection layer
super(YOLOHead, self).__init__()
if anchors is None:
anchors = [[10, 13, 16, 30, 33, 23], [30, 61, 62, 45, 59, 119], [116, 90, 156, 198, 373, 326]]
else:
anchors = anchors
`
you should change ch as a tuple with four elements, stride as (4., 8., 16., 32.)
for configs/model_yolo.yaml
rewrite as
`
stride: [4.0, 8.0, 16.0, 32.0]
anchors:
- [9,11, 21,19, 17,41] # this init value may not right
- [10,13, 16,30, 33,23] # P3/8
- [30,61, 62,45, 59,119] # P4/16
- [116,90, 156,198, 373,326] # P5/32
`