yjh0410 před 10 měsíci
rodič
revize
1a3a1391c8

+ 1 - 1
yolo/config/yolov3_config.py

@@ -72,7 +72,7 @@ class Yolov3Config(object):
         self.pixel_std  = [255., 255., 255.]
         ## Transforms
         self.train_img_size = 640
-        self.test_img_size  = 640
+        self.test_img_size  = 320
         self.affine_params = {
             'degrees': 0.0,
             'translate': 0.2,

+ 3 - 3
yolo/models/yolov3/loss.py

@@ -10,9 +10,9 @@ class SetCriterion(object):
         self.cfg = cfg
         self.num_classes = cfg.num_classes
         # loss weight
-        self.loss_obj_weight = cfg.loss_obj_weight
-        self.loss_cls_weight = cfg.loss_cls_weight
-        self.loss_box_weight = cfg.loss_box_weight
+        self.loss_obj_weight = cfg.loss_obj
+        self.loss_cls_weight = cfg.loss_cls
+        self.loss_box_weight = cfg.loss_box
 
         # matcher
         self.matcher = Yolov3Matcher(self.num_classes, 3, cfg.anchor_size, cfg.iou_thresh)

+ 2 - 2
yolo/models/yolov4/yolov4_head.py

@@ -50,13 +50,13 @@ if __name__=='__main__':
     from thop import profile
     
     # YOLOv2 configuration
-    class Yolov3BaseConfig(object):
+    class Yolov4BaseConfig(object):
         def __init__(self) -> None:
             # ---------------- Model config ----------------
             self.head_dim  = 256
             self.num_cls_head = 2
             self.num_reg_head = 2
-    cfg = Yolov3BaseConfig()
+    cfg = Yolov4BaseConfig()
 
     # Build a head
     model = DecoupledHead(cfg, in_dim= 256)

+ 7 - 3
yolo/models/yolov4/yolov4_pafpn.py

@@ -67,20 +67,24 @@ class Yolov4PaFPN(nn.Module):
     def forward(self, features):
         c3, c4, c5 = features
 
+        # P5 -> P4
         c6 = self.reduce_layer_1(c5)
         c7 = F.interpolate(c6, scale_factor=2.0)   # s32->s16
         c8 = torch.cat([c7, c4], dim=1)
         c9 = self.top_down_layer_1(c8)
-        # P3/8
+
+        # P4 -> P3
         c10 = self.reduce_layer_2(c9)
         c11 = F.interpolate(c10, scale_factor=2.0)   # s16->s8
         c12 = torch.cat([c11, c3], dim=1)
         c13 = self.top_down_layer_2(c12)  # to det
-        # p4/16
+
+        # P3 -> P4
         c14 = self.reduce_layer_3(c13)
         c15 = torch.cat([c14, c10], dim=1)
         c16 = self.bottom_up_layer_1(c15)  # to det
-        # p5/32
+
+        # P4 -> P5
         c17 = self.reduce_layer_4(c16)
         c18 = torch.cat([c17, c6], dim=1)
         c19 = self.bottom_up_layer_2(c18)  # to det