Prechádzať zdrojové kódy

retrain YOLOv7-Tiny

yjh0410 2 rokov pred
rodič
commit
81dc4f2b29
2 zmenil súbory, kde vykonal 4 pridanie a 13 odobranie
  1. 3 12
      models/yolov7/yolov7_fpn.py
  2. 1 1
      train.sh

+ 3 - 12
models/yolov7/yolov7_fpn.py

@@ -71,22 +71,17 @@ class Yolov7PaFPN(nn.Module):
                                               depthwise=depthwise
                                               )
         
-        # head conv
-        self.head_conv_1 = RepConv(round(128*width), round(256*width), k=3, s=1, p=1, act_type=act_type)
-        self.head_conv_2 = RepConv(round(256*width), round(512*width), k=3, s=1, p=1, act_type=act_type)
-        self.head_conv_3 = RepConv(round(512*width), round(1024*width), k=3, s=1, p=1, act_type=act_type)
-
         # output proj layers
         if out_dim is not None:
             self.out_layers = nn.ModuleList([
                 Conv(in_dim, out_dim, k=1,
                      norm_type=norm_type, act_type=act_type)
-                     for in_dim in [round(256*width), round(512*width), round(1024*width)]
+                     for in_dim in [round(128*width), round(256*width), round(512*width)]
                      ])
             self.out_dim = [out_dim] * 3
         else:
             self.out_layers = None
-            self.out_dim = [round(256*width), round(512*width), round(1024*width)]
+            self.out_dim = [round(128*width), round(256*width), round(512*width)]
 
 
     def forward(self, features):
@@ -114,11 +109,7 @@ class Yolov7PaFPN(nn.Module):
         c18 = torch.cat([c17, c5], dim=1)
         c19 = self.bottom_up_layer_2(c18)
 
-        c20 = self.head_conv_1(c13)
-        c21 = self.head_conv_2(c16)
-        c22 = self.head_conv_3(c19)
-
-        out_feats = [c20, c21, c22] # [P3, P4, P5]
+        out_feats = [c13, c16, c19] # [P3, P4, P5]
         
         # output proj layers
         if self.out_layers is not None:

+ 1 - 1
train.sh

@@ -12,7 +12,7 @@ python train.py \
         --ema \
         --fp16 \
         --multi_scale \
-        --resume weights/coco/yolov7_large/yolov7_large_epoch_151_44.30.pth \
+        # --resume weights/coco/yolov7_large/yolov7_large_epoch_151_44.30.pth \
         # --pretrained weights/coco/yolo_free_medium/yolo_free_medium_39.46.pth \
         # --eval_first