LSH9832 / edgeyolo

an edge-real-time anchor-free object detector with decent performance
Apache License 2.0
446 stars 59 forks source link

TypeError: __init__() got an unexpected keyword argument 'k' #58

Closed dengxiongshi closed 4 months ago

dengxiongshi commented 4 months ago

@LSH9832 ,你好! 当我调用model/yolo.py进行edgeyolo_s.yaml模型结构验证时,出现如下错误:

models/yolo: cfg=models/edgeyolo/edgeyolo_s.yaml, batch_size=1, device=0, profile=True, line_profile=False, test=False
YOLOv5 🚀 2024-4-26 Python-3.8.11 torch-1.9.0+cu111 CUDA:0 (GeForce RTX 3090, 24268MiB)

                 from  n    params  module                                  arguments                     
  0                -1  1       544  models.CSPS.RepConv                     [3, 16, 3, 1]                 
  1                -1  1      5248  models.CSPS.RepConv                     [16, 32, 3, 2]                
  2                -1  1     10368  models.CSPS.RepConv                     [32, 32, 3, 1]                
  3                -1  1     25920  models.CSPS.RepConv                     [32, 80, 3, 2]                
  4                -1  1      1968  models.common.Conv                      [80, 24, 1, 1]                
  5                -2  1      1968  models.common.Conv                      [80, 24, 1, 1]                
  6                -1  1      5856  models.CSPS.RepConv                     [24, 24, 3, 1]                
  7                -1  1      5856  models.CSPS.RepConv                     [24, 24, 3, 1]                
  8                -1  1      5856  models.CSPS.RepConv                     [24, 24, 3, 1]                
  9                -1  1      5856  models.CSPS.RepConv                     [24, 24, 3, 1]                
 10          [-1, -2]  1         0  models.common.Shortcut                  [1]                           
 11          [-4, -5]  1         0  models.common.Shortcut                  [1]                           
 12  [-1, -2, -7, -8]  1         0  models.common.Concat                    [1]                           
 13                -1  1      6272  models.common.Conv                      [96, 64, 1, 1]                
 14                -1  1         0  models.common.MP                        []                            
 15                -1  1      5280  models.common.Conv                      [64, 80, 1, 1]                
 16                -3  1      5280  models.common.Conv                      [64, 80, 1, 1]                
 17                -1  1     64320  models.CSPS.RepConv                     [80, 80, 3, 2]                
 18          [-1, -3]  1         0  models.common.Concat                    [1]                           
 19                -1  1     12960  models.common.Conv                      [160, 80, 1, 1]               
 20                -2  1     12960  models.common.Conv                      [160, 80, 1, 1]               
 21                -1  1       880  models.common.DWConv                    [80, 80, 3, 1]                
 22                -1  1     64320  models.CSPS.RepConv                     [80, 80, 3, 1]                
 23                -1  1       880  models.common.DWConv                    [80, 80, 3, 1]                
 24                -1  1     64320  models.CSPS.RepConv                     [80, 80, 3, 1]                
 25          [-1, -2]  1         0  models.common.Shortcut                  [1]                           
 26          [-4, -5]  1         0  models.common.Shortcut                  [1]                           
 27  [-1, -2, -7, -8]  1         0  models.common.Concat                    [1]                           
 28                -1  1     38640  models.common.Conv                      [320, 120, 1, 1]              
 29                -1  1         0  models.common.MP                        []                            
 30                -1  1      9760  models.common.Conv                      [120, 80, 1, 1]               
 31                -3  1      9760  models.common.Conv                      [120, 80, 1, 1]               
 32                -1  1     64320  models.CSPS.RepConv                     [80, 80, 3, 2]                
 33          [-1, -3]  1         0  models.common.Concat                    [1]                           
 34                -1  1     12960  models.common.Conv                      [160, 80, 1, 1]               
 35                -2  1     12960  models.common.Conv                      [160, 80, 1, 1]               
 36                -1  1       880  models.common.DWConv                    [80, 80, 3, 1]                
 37                -1  1     64320  models.CSPS.RepConv                     [80, 80, 3, 1]                
 38                -1  1       880  models.common.DWConv                    [80, 80, 3, 1]                
 39                -1  1     64320  models.CSPS.RepConv                     [80, 80, 3, 1]                
 40          [-1, -2]  1         0  models.common.Shortcut                  [1]                           
 41          [-4, -5]  1         0  models.common.Shortcut                  [1]                           
 42  [-1, -2, -7, -8]  1         0  models.common.Concat                    [1]                           
 43                -1  1     77280  models.common.Conv                      [320, 240, 1, 1]              
 44                -1  1         0  models.common.MP                        []                            
 45                -1  1     38720  models.common.Conv                      [240, 160, 1, 1]              
 46                -3  1     38720  models.common.Conv                      [240, 160, 1, 1]              
 47                -1  1    256640  models.CSPS.RepConv                     [160, 160, 3, 2]              
 48          [-1, -3]  1         0  models.common.Concat                    [1]                           
 49                -1  1     25760  models.common.Conv                      [320, 80, 1, 1]               
 50                -2  1     25760  models.common.Conv                      [320, 80, 1, 1]               
 51                -1  1       880  models.common.DWConv                    [80, 80, 3, 1]                
 52                -1  1     64320  models.CSPS.RepConv                     [80, 80, 3, 1]                
 53                -1  1       880  models.common.DWConv                    [80, 80, 3, 1]                
 54                -1  1     57760  models.common.Conv                      [80, 80, 3, 1]                
 55          [-1, -2]  1         0  models.common.Shortcut                  [1]                           
 56          [-4, -5]  1         0  models.common.Shortcut                  [1]                           
 57  [-1, -2, -7, -8]  1         0  models.common.Concat                    [1]                           
 58                -1  1     77280  models.common.Conv                      [320, 240, 1, 1]              
 59                -1  1    419280  models.common.SPPCSPC                   [240, 120, 1]                 
 60                -1  1      7808  models.common.Conv                      [120, 64, 1, 1]               
 61                -1  1         0  torch.nn.modules.upsampling.Upsample    [None, 2, 'nearest']          
 62                43  1     15488  models.common.Conv                      [240, 64, 1, 1]               
 63          [-1, -2]  1         0  models.common.Concat                    [1]                           
 64                -1  1      8320  models.common.Conv                      [128, 64, 1, 1]               
 65                -2  1      8320  models.common.Conv                      [128, 64, 1, 1]               
 66                -1  1       640  models.common.DWConv                    [64, 32, 3, 1]                
 67                -1  1     10368  models.CSPS.RepConv                     [32, 32, 3, 1]                
 68                -1  1       352  models.common.DWConv                    [32, 32, 3, 1]                
 69                -1  1     10368  models.CSPS.RepConv                     [32, 32, 3, 1]                
 70[-1, -2, -3, -4, -5, -6]  1         0  models.common.Concat                    [1]                           
 71                -1  1     16512  models.common.Conv                      [256, 64, 1, 1]               
 72                -1  1      2112  models.common.Conv                      [64, 32, 1, 1]                
 73                -1  1         0  torch.nn.modules.upsampling.Upsample    [None, 2, 'nearest']          
 74                28  1      3904  models.common.Conv                      [120, 32, 1, 1]               
 75          [-1, -2]  1         0  models.common.Concat                    [1]                           
 76                -1  1      2112  models.common.Conv                      [64, 32, 1, 1]                
 77                -2  1      2112  models.common.Conv                      [64, 32, 1, 1]                
 78                -1  1       320  models.common.DWConv                    [32, 16, 3, 1]                
 79                -1  1      2624  models.CSPS.RepConv                     [16, 16, 3, 1]                
 80                -1  1       176  models.common.DWConv                    [16, 16, 3, 1]                
 81                -1  1      2624  models.CSPS.RepConv                     [16, 16, 3, 1]                
 82[-1, -2, -3, -4, -5, -6]  1         0  models.common.Concat                    [1]                           
 83                -1  1      4160  models.common.Conv                      [128, 32, 1, 1]               
 84                -1  1         0  models.common.MP                        []                            
 85                -1  1      1088  models.common.Conv                      [32, 32, 1, 1]                
 86                -3  1      1088  models.common.Conv                      [32, 32, 1, 1]                
 87                -1  1     10368  models.CSPS.RepConv                     [32, 32, 3, 2]                
 88      [-1, -3, 71]  1         0  models.common.Concat                    [1]                           
 89                -1  1      8320  models.common.Conv                      [128, 64, 1, 1]               
 90                -2  1      8320  models.common.Conv                      [128, 64, 1, 1]               
 91                -1  1       640  models.common.DWConv                    [64, 32, 3, 1]                
 92                -1  1     10368  models.CSPS.RepConv                     [32, 32, 3, 1]                
 93                -1  1       352  models.common.DWConv                    [32, 32, 3, 1]                
 94                -1  1     10368  models.CSPS.RepConv                     [32, 32, 3, 1]                
 95[-1, -2, -3, -4, -5, -6]  1         0  models.common.Concat                    [1]                           
 96                -1  1     16512  models.common.Conv                      [256, 64, 1, 1]               
 97                -1  1         0  models.common.MP                        []                            
 98                -1  1      4224  models.common.Conv                      [64, 64, 1, 1]                
 99                -3  1      4224  models.common.Conv                      [64, 64, 1, 1]                
100                -1  1     41216  models.CSPS.RepConv                     [64, 64, 3, 2]                
101      [-1, -3, 59]  1         0  models.common.Concat                    [1]                           
102                -1  1     30000  models.common.Conv                      [248, 120, 1, 1]              
103                -2  1     30000  models.common.Conv                      [248, 120, 1, 1]              
104                -1  1      8768  models.common.DWConv                    [120, 64, 3, 1]               
105                -1  1     41216  models.CSPS.RepConv                     [64, 64, 3, 1]                
106                -1  1       704  models.common.DWConv                    [64, 64, 3, 1]                
107                -1  1     41216  models.CSPS.RepConv                     [64, 64, 3, 1]                
108[-1, -2, -3, -4, -5, -6]  1         0  models.common.Concat                    [1]                           
109                -1  1     59760  models.common.Conv                      [496, 120, 1, 1]              
110                83  1     20736  models.CSPS.RepConv                     [32, 64, 3, 1]                
111                96  1     77280  models.CSPS.RepConv                     [64, 120, 3, 1]               
112               109  1    288960  models.CSPS.RepConv                     [120, 240, 3, 1]         
Traceback (most recent call last):
  File "models/yolo.py", line 840, in <module>
    model = Model(opt.cfg).to(device)
  File "models/yolo.py", line 471, in __init__
    self.model, self.save = parse_model(deepcopy(self.yaml), ch=[ch])  # model, savelist
  File "models/yolo.py", line 766, in parse_model
    m_ = nn.Sequential(*(m(*args) for _ in range(n))) if n > 1 else m(*args)  # module
  File "models/yolo.py", line 189, in __init__
    self.cls_convs = nn.ModuleList(conv(x, x, k=3, s=1, act=True) for y in ch)
  File "/opt/conda/lib/python3.8/site-packages/torch/nn/modules/container.py", line 170, in __init__
    self += modules
  File "/opt/conda/lib/python3.8/site-packages/torch/nn/modules/container.py", line 211, in __iadd__
    return self.extend(modules)
  File "/opt/conda/lib/python3.8/site-packages/torch/nn/modules/container.py", line 249, in extend
    for i, module in enumerate(modules):
  File "models/yolo.py", line 189, in <genexpr>
    self.cls_convs = nn.ModuleList(conv(x, x, k=3, s=1, act=True) for y in ch)
TypeError: __init__() got an unexpected keyword argument 'k'

我发现是YOLOXDetect初始化的问题: image 上图中的这两个卷积会造成冲突,导致参数识别失败,我进行了如下更改,直接使用原始的Conv,不使用conv后,可以验证模型结构成功: image

models/yolo: cfg=models/edgeyolo/edgeyolo_s.yaml, batch_size=1, device=0, profile=True, line_profile=False, test=False
YOLOv5 🚀 2024-4-26 Python-3.8.11 torch-1.9.0+cu111 CUDA:0 (GeForce RTX 3090, 24268MiB)

                 from  n    params  module                                  arguments                     
  0                -1  1       544  models.CSPS.RepConv                     [3, 16, 3, 1]                 
  1                -1  1      5248  models.CSPS.RepConv                     [16, 32, 3, 2]                
  2                -1  1     10368  models.CSPS.RepConv                     [32, 32, 3, 1]                
  3                -1  1     25920  models.CSPS.RepConv                     [32, 80, 3, 2]                
  4                -1  1      1968  models.common.Conv                      [80, 24, 1, 1]                
  5                -2  1      1968  models.common.Conv                      [80, 24, 1, 1]                
  6                -1  1      5856  models.CSPS.RepConv                     [24, 24, 3, 1]                
  7                -1  1      5856  models.CSPS.RepConv                     [24, 24, 3, 1]                
  8                -1  1      5856  models.CSPS.RepConv                     [24, 24, 3, 1]                
  9                -1  1      5856  models.CSPS.RepConv                     [24, 24, 3, 1]                
 10          [-1, -2]  1         0  models.common.Shortcut                  [1]                           
 11          [-4, -5]  1         0  models.common.Shortcut                  [1]                           
 12  [-1, -2, -7, -8]  1         0  models.common.Concat                    [1]                           
 13                -1  1      6272  models.common.Conv                      [96, 64, 1, 1]                
 14                -1  1         0  models.common.MP                        []                            
 15                -1  1      5280  models.common.Conv                      [64, 80, 1, 1]                
 16                -3  1      5280  models.common.Conv                      [64, 80, 1, 1]                
 17                -1  1     64320  models.CSPS.RepConv                     [80, 80, 3, 2]                
 18          [-1, -3]  1         0  models.common.Concat                    [1]                           
 19                -1  1     12960  models.common.Conv                      [160, 80, 1, 1]               
 20                -2  1     12960  models.common.Conv                      [160, 80, 1, 1]               
 21                -1  1       880  models.common.DWConv                    [80, 80, 3, 1]                
 22                -1  1     64320  models.CSPS.RepConv                     [80, 80, 3, 1]                
 23                -1  1       880  models.common.DWConv                    [80, 80, 3, 1]                
 24                -1  1     64320  models.CSPS.RepConv                     [80, 80, 3, 1]                
 25          [-1, -2]  1         0  models.common.Shortcut                  [1]                           
 26          [-4, -5]  1         0  models.common.Shortcut                  [1]                           
 27  [-1, -2, -7, -8]  1         0  models.common.Concat                    [1]                           
 28                -1  1     38640  models.common.Conv                      [320, 120, 1, 1]              
 29                -1  1         0  models.common.MP                        []                            
 30                -1  1      9760  models.common.Conv                      [120, 80, 1, 1]               
 31                -3  1      9760  models.common.Conv                      [120, 80, 1, 1]               
 32                -1  1     64320  models.CSPS.RepConv                     [80, 80, 3, 2]                
 33          [-1, -3]  1         0  models.common.Concat                    [1]                           
 34                -1  1     12960  models.common.Conv                      [160, 80, 1, 1]               
 35                -2  1     12960  models.common.Conv                      [160, 80, 1, 1]               
 36                -1  1       880  models.common.DWConv                    [80, 80, 3, 1]                
 37                -1  1     64320  models.CSPS.RepConv                     [80, 80, 3, 1]                
 38                -1  1       880  models.common.DWConv                    [80, 80, 3, 1]                
 39                -1  1     64320  models.CSPS.RepConv                     [80, 80, 3, 1]                
 40          [-1, -2]  1         0  models.common.Shortcut                  [1]                           
 41          [-4, -5]  1         0  models.common.Shortcut                  [1]                           
 42  [-1, -2, -7, -8]  1         0  models.common.Concat                    [1]                           
 43                -1  1     77280  models.common.Conv                      [320, 240, 1, 1]              
 44                -1  1         0  models.common.MP                        []                            
 45                -1  1     38720  models.common.Conv                      [240, 160, 1, 1]              
 46                -3  1     38720  models.common.Conv                      [240, 160, 1, 1]              
 47                -1  1    256640  models.CSPS.RepConv                     [160, 160, 3, 2]              
 48          [-1, -3]  1         0  models.common.Concat                    [1]                           
 49                -1  1     25760  models.common.Conv                      [320, 80, 1, 1]               
 50                -2  1     25760  models.common.Conv                      [320, 80, 1, 1]               
 51                -1  1       880  models.common.DWConv                    [80, 80, 3, 1]                
 52                -1  1     64320  models.CSPS.RepConv                     [80, 80, 3, 1]                
 53                -1  1       880  models.common.DWConv                    [80, 80, 3, 1]                
 54                -1  1     57760  models.common.Conv                      [80, 80, 3, 1]                
 55          [-1, -2]  1         0  models.common.Shortcut                  [1]                           
 56          [-4, -5]  1         0  models.common.Shortcut                  [1]                           
 57  [-1, -2, -7, -8]  1         0  models.common.Concat                    [1]                           
 58                -1  1     77280  models.common.Conv                      [320, 240, 1, 1]              
 59                -1  1    419280  models.common.SPPCSPC                   [240, 120, 1]                 
 60                -1  1      7808  models.common.Conv                      [120, 64, 1, 1]               
 61                -1  1         0  torch.nn.modules.upsampling.Upsample    [None, 2, 'nearest']          
 62                43  1     15488  models.common.Conv                      [240, 64, 1, 1]               
 63          [-1, -2]  1         0  models.common.Concat                    [1]                           
 64                -1  1      8320  models.common.Conv                      [128, 64, 1, 1]               
 65                -2  1      8320  models.common.Conv                      [128, 64, 1, 1]               
 66                -1  1       640  models.common.DWConv                    [64, 32, 3, 1]                
 67                -1  1     10368  models.CSPS.RepConv                     [32, 32, 3, 1]                
 68                -1  1       352  models.common.DWConv                    [32, 32, 3, 1]                
 69                -1  1     10368  models.CSPS.RepConv                     [32, 32, 3, 1]                
 70[-1, -2, -3, -4, -5, -6]  1         0  models.common.Concat                    [1]                           
 71                -1  1     16512  models.common.Conv                      [256, 64, 1, 1]               
 72                -1  1      2112  models.common.Conv                      [64, 32, 1, 1]                
 73                -1  1         0  torch.nn.modules.upsampling.Upsample    [None, 2, 'nearest']          
 74                28  1      3904  models.common.Conv                      [120, 32, 1, 1]               
 75          [-1, -2]  1         0  models.common.Concat                    [1]                           
 76                -1  1      2112  models.common.Conv                      [64, 32, 1, 1]                
 77                -2  1      2112  models.common.Conv                      [64, 32, 1, 1]                
 78                -1  1       320  models.common.DWConv                    [32, 16, 3, 1]                
 79                -1  1      2624  models.CSPS.RepConv                     [16, 16, 3, 1]                
 80                -1  1       176  models.common.DWConv                    [16, 16, 3, 1]                
 81                -1  1      2624  models.CSPS.RepConv                     [16, 16, 3, 1]                
 82[-1, -2, -3, -4, -5, -6]  1         0  models.common.Concat                    [1]                           
 83                -1  1      4160  models.common.Conv                      [128, 32, 1, 1]               
 84                -1  1         0  models.common.MP                        []                            
 85                -1  1      1088  models.common.Conv                      [32, 32, 1, 1]                
 86                -3  1      1088  models.common.Conv                      [32, 32, 1, 1]                
 87                -1  1     10368  models.CSPS.RepConv                     [32, 32, 3, 2]                
 88      [-1, -3, 71]  1         0  models.common.Concat                    [1]                           
 89                -1  1      8320  models.common.Conv                      [128, 64, 1, 1]               
 90                -2  1      8320  models.common.Conv                      [128, 64, 1, 1]               
 91                -1  1       640  models.common.DWConv                    [64, 32, 3, 1]                
 92                -1  1     10368  models.CSPS.RepConv                     [32, 32, 3, 1]                
 93                -1  1       352  models.common.DWConv                    [32, 32, 3, 1]                
 94                -1  1     10368  models.CSPS.RepConv                     [32, 32, 3, 1]                
 95[-1, -2, -3, -4, -5, -6]  1         0  models.common.Concat                    [1]                           
 96                -1  1     16512  models.common.Conv                      [256, 64, 1, 1]               
 97                -1  1         0  models.common.MP                        []                            
 98                -1  1      4224  models.common.Conv                      [64, 64, 1, 1]                
 99                -3  1      4224  models.common.Conv                      [64, 64, 1, 1]                
100                -1  1     41216  models.CSPS.RepConv                     [64, 64, 3, 2]                
101      [-1, -3, 59]  1         0  models.common.Concat                    [1]                           
102                -1  1     30000  models.common.Conv                      [248, 120, 1, 1]              
103                -2  1     30000  models.common.Conv                      [248, 120, 1, 1]              
104                -1  1      8768  models.common.DWConv                    [120, 64, 3, 1]               
105                -1  1     41216  models.CSPS.RepConv                     [64, 64, 3, 1]                
106                -1  1       704  models.common.DWConv                    [64, 64, 3, 1]                
107                -1  1     41216  models.CSPS.RepConv                     [64, 64, 3, 1]                
108[-1, -2, -3, -4, -5, -6]  1         0  models.common.Concat                    [1]                           
109                -1  1     59760  models.common.Conv                      [496, 120, 1, 1]              
110                83  1     20736  models.CSPS.RepConv                     [32, 64, 3, 1]                
111                96  1     77280  models.CSPS.RepConv                     [64, 120, 3, 1]               
112               109  1    288960  models.CSPS.RepConv                     [120, 240, 3, 1]              
113   [110, 111, 112]  1    266494  YOLOXDetect                             [80, [[8, 8], [16, 16], [32, 32]], <class 'models.CSPS.RepConv'>, [64, 120, 240]]
edgeyolo_s summary: 506 layers, 2749534 parameters, 2749534 gradients, 15.7 GFLOPs

YOLOv5 🚀 2024-4-26 Python-3.8.11 torch-1.9.0+cu111 CUDA:0 (GeForce RTX 3090, 24268MiB)

      Params      GFLOPs  GPU_mem (GB)  forward (ms) backward (ms)                   input                  output
     2749534       15.67         0.644         46.59         71.26        (1, 3, 640, 640)                    list
dengxiongshi commented 4 months ago

上面模型的参数量是我将depth_multiple: 0.33 # model depth multiple width_multiple: 0.50 # layer channel multiple得到的结果,参数量是yolov5s.yaml模型结构0.38左右,但我看到你给的模型结构都是使用的depth_multiple: 1.0 # model depth multiple width_multiple: 1.0 # layer channel multiple,这个网络的深度跟yolov5l.yaml相同,有什么特别之处嘛?能否给个跟yolov5s.yaml网络深度一样的效果比较。

yolov5s:

models/yolo: cfg=models/yolov5s.yaml, batch_size=1, device=0, profile=True, line_profile=False, test=False
YOLOv5 🚀 2024-4-26 Python-3.8.11 torch-1.9.0+cu111 CUDA:0 (GeForce RTX 3090, 24268MiB)

                 from  n    params  module                                  arguments                     
  0                -1  1      3520  models.common.Conv                      [3, 32, 6, 2, 2]              
  1                -1  1     18560  models.common.Conv                      [32, 64, 3, 2]                
  2                -1  1     18816  models.common.C3                        [64, 64, 1]                   
  3                -1  1     73984  models.common.Conv                      [64, 128, 3, 2]               
  4                -1  2    115712  models.common.C3                        [128, 128, 2]                 
  5                -1  1    295424  models.common.Conv                      [128, 256, 3, 2]              
  6                -1  3    625152  models.common.C3                        [256, 256, 3]                 
  7                -1  1   1180672  models.common.Conv                      [256, 512, 3, 2]              
  8                -1  1   1182720  models.common.C3                        [512, 512, 1]                 
  9                -1  1    656896  models.common.SPPF                      [512, 512, 5]                 
 10                -1  1    131584  models.common.Conv                      [512, 256, 1, 1]              
 11                -1  1         0  torch.nn.modules.upsampling.Upsample    [None, 2, 'nearest']          
 12           [-1, 6]  1         0  models.common.Concat                    [1]                           
 13                -1  1    361984  models.common.C3                        [512, 256, 1, False]          
 14                -1  1     33024  models.common.Conv                      [256, 128, 1, 1]              
 15                -1  1         0  torch.nn.modules.upsampling.Upsample    [None, 2, 'nearest']          
 16           [-1, 4]  1         0  models.common.Concat                    [1]                           
 17                -1  1     90880  models.common.C3                        [256, 128, 1, False]          
 18                -1  1    147712  models.common.Conv                      [128, 128, 3, 2]              
 19          [-1, 14]  1         0  models.common.Concat                    [1]                           
 20                -1  1    296448  models.common.C3                        [256, 256, 1, False]          
 21                -1  1    590336  models.common.Conv                      [256, 256, 3, 2]              
 22          [-1, 10]  1         0  models.common.Concat                    [1]                           
 23                -1  1   1182720  models.common.C3                        [512, 512, 1, False]          
 24      [17, 20, 23]  1    229245  Detect                                  [80, [[10, 13, 16, 30, 33, 23], [30, 61, 62, 45, 59, 119], [116, 90, 156, 198, 373, 326]], [128, 256, 512]]
YOLOv5s summary: 214 layers, 7235389 parameters, 7235389 gradients, 16.6 GFLOPs

YOLOv5 🚀 2024-4-26 Python-3.8.11 torch-1.9.0+cu111 CUDA:0 (GeForce RTX 3090, 24268MiB)

      Params      GFLOPs  GPU_mem (GB)  forward (ms) backward (ms)                   input                  output
     7235389       16.63         0.445         41.91          39.6        (1, 3, 640, 640)                    list

原始edgeyolo_s:

models/yolo: cfg=models/edgeyolo/edgeyolo_s.yaml, batch_size=1, device=0, profile=True, line_profile=False, test=False
YOLOv5 🚀 2024-4-26 Python-3.8.11 torch-1.9.0+cu111 CUDA:0 (GeForce RTX 3090, 24268MiB)

                 from  n    params  module                                  arguments                     
  0                -1  1      1088  models.CSPS.RepConv                     [3, 32, 3, 1]                 
  1                -1  1     20736  models.CSPS.RepConv                     [32, 64, 3, 2]                
  2                -1  1     41216  models.CSPS.RepConv                     [64, 64, 3, 1]                
  3                -1  1     51520  models.CSPS.RepConv                     [64, 80, 3, 2]                
  4                -1  1      3280  models.common.Conv                      [80, 40, 1, 1]                
  5                -2  1      3280  models.common.Conv                      [80, 40, 1, 1]                
  6                -1  1     16160  models.CSPS.RepConv                     [40, 40, 3, 1]                
  7                -1  1     16160  models.CSPS.RepConv                     [40, 40, 3, 1]                
  8                -1  1     16160  models.CSPS.RepConv                     [40, 40, 3, 1]                
  9                -1  1     16160  models.CSPS.RepConv                     [40, 40, 3, 1]                
 10          [-1, -2]  1         0  models.common.Shortcut                  [1]                           
 11          [-4, -5]  1         0  models.common.Shortcut                  [1]                           
 12  [-1, -2, -7, -8]  1         0  models.common.Concat                    [1]                           
 13                -1  1     19440  models.common.Conv                      [160, 120, 1, 1]              
 14                -1  1         0  models.common.MP                        []                            
 15                -1  1      9760  models.common.Conv                      [120, 80, 1, 1]               
 16                -3  1      9760  models.common.Conv                      [120, 80, 1, 1]               
 17                -1  1     64320  models.CSPS.RepConv                     [80, 80, 3, 2]                
 18          [-1, -3]  1         0  models.common.Concat                    [1]                           
 19                -1  1     12960  models.common.Conv                      [160, 80, 1, 1]               
 20                -2  1     12960  models.common.Conv                      [160, 80, 1, 1]               
 21                -1  1       880  models.common.DWConv                    [80, 80, 3, 1]                
 22                -1  1     64320  models.CSPS.RepConv                     [80, 80, 3, 1]                
 23                -1  1       880  models.common.DWConv                    [80, 80, 3, 1]                
 24                -1  1     64320  models.CSPS.RepConv                     [80, 80, 3, 1]                
 25          [-1, -2]  1         0  models.common.Shortcut                  [1]                           
 26          [-4, -5]  1         0  models.common.Shortcut                  [1]                           
 27  [-1, -2, -7, -8]  1         0  models.common.Concat                    [1]                           
 28                -1  1     77280  models.common.Conv                      [320, 240, 1, 1]              
 29                -1  1         0  models.common.MP                        []                            
 30                -1  1     38720  models.common.Conv                      [240, 160, 1, 1]              
 31                -3  1     38720  models.common.Conv                      [240, 160, 1, 1]              
 32                -1  1    256640  models.CSPS.RepConv                     [160, 160, 3, 2]              
 33          [-1, -3]  1         0  models.common.Concat                    [1]                           
 34                -1  1     51520  models.common.Conv                      [320, 160, 1, 1]              
 35                -2  1     51520  models.common.Conv                      [320, 160, 1, 1]              
 36                -1  1      1760  models.common.DWConv                    [160, 160, 3, 1]              
 37                -1  1    256640  models.CSPS.RepConv                     [160, 160, 3, 1]              
 38                -1  1      1760  models.common.DWConv                    [160, 160, 3, 1]              
 39                -1  1    256640  models.CSPS.RepConv                     [160, 160, 3, 1]              
 40          [-1, -2]  1         0  models.common.Shortcut                  [1]                           
 41          [-4, -5]  1         0  models.common.Shortcut                  [1]                           
 42  [-1, -2, -7, -8]  1         0  models.common.Concat                    [1]                           
 43                -1  1    308160  models.common.Conv                      [640, 480, 1, 1]              
 44                -1  1         0  models.common.MP                        []                            
 45                -1  1    154240  models.common.Conv                      [480, 320, 1, 1]              
 46                -3  1    154240  models.common.Conv                      [480, 320, 1, 1]              
 47                -1  1   1025280  models.CSPS.RepConv                     [320, 320, 3, 2]              
 48          [-1, -3]  1         0  models.common.Concat                    [1]                           
 49                -1  1    102720  models.common.Conv                      [640, 160, 1, 1]              
 50                -2  1    102720  models.common.Conv                      [640, 160, 1, 1]              
 51                -1  1      1760  models.common.DWConv                    [160, 160, 3, 1]              
 52                -1  1    256640  models.CSPS.RepConv                     [160, 160, 3, 1]              
 53                -1  1      1760  models.common.DWConv                    [160, 160, 3, 1]              
 54                -1  1    230720  models.common.Conv                      [160, 160, 3, 1]              
 55          [-1, -2]  1         0  models.common.Shortcut                  [1]                           
 56          [-4, -5]  1         0  models.common.Shortcut                  [1]                           
 57  [-1, -2, -7, -8]  1         0  models.common.Concat                    [1]                           
 58                -1  1    308160  models.common.Conv                      [640, 480, 1, 1]              
 59                -1  1   1673760  models.common.SPPCSPC                   [480, 240, 1]                 
 60                -1  1     29040  models.common.Conv                      [240, 120, 1, 1]              
 61                -1  1         0  torch.nn.modules.upsampling.Upsample    [None, 2, 'nearest']          
 62                43  1     57840  models.common.Conv                      [480, 120, 1, 1]              
 63          [-1, -2]  1         0  models.common.Concat                    [1]                           
 64                -1  1     29040  models.common.Conv                      [240, 120, 1, 1]              
 65                -2  1     29040  models.common.Conv                      [240, 120, 1, 1]              
 66                -1  1      8768  models.common.DWConv                    [120, 64, 3, 1]               
 67                -1  1     41216  models.CSPS.RepConv                     [64, 64, 3, 1]                
 68                -1  1       704  models.common.DWConv                    [64, 64, 3, 1]                
 69                -1  1     41216  models.CSPS.RepConv                     [64, 64, 3, 1]                
 70[-1, -2, -3, -4, -5, -6]  1         0  models.common.Concat                    [1]                           
 71                -1  1     59760  models.common.Conv                      [496, 120, 1, 1]              
 72                -1  1      7808  models.common.Conv                      [120, 64, 1, 1]               
 73                -1  1         0  torch.nn.modules.upsampling.Upsample    [None, 2, 'nearest']          
 74                28  1     15488  models.common.Conv                      [240, 64, 1, 1]               
 75          [-1, -2]  1         0  models.common.Concat                    [1]                           
 76                -1  1      8320  models.common.Conv                      [128, 64, 1, 1]               
 77                -2  1      8320  models.common.Conv                      [128, 64, 1, 1]               
 78                -1  1       640  models.common.DWConv                    [64, 32, 3, 1]                
 79                -1  1     10368  models.CSPS.RepConv                     [32, 32, 3, 1]                
 80                -1  1       352  models.common.DWConv                    [32, 32, 3, 1]                
 81                -1  1     10368  models.CSPS.RepConv                     [32, 32, 3, 1]                
 82[-1, -2, -3, -4, -5, -6]  1         0  models.common.Concat                    [1]                           
 83                -1  1     16512  models.common.Conv                      [256, 64, 1, 1]               
 84                -1  1         0  models.common.MP                        []                            
 85                -1  1      4224  models.common.Conv                      [64, 64, 1, 1]                
 86                -3  1      4224  models.common.Conv                      [64, 64, 1, 1]                
 87                -1  1     41216  models.CSPS.RepConv                     [64, 64, 3, 2]                
 88      [-1, -3, 71]  1         0  models.common.Concat                    [1]                           
 89                -1  1     30000  models.common.Conv                      [248, 120, 1, 1]              
 90                -2  1     30000  models.common.Conv                      [248, 120, 1, 1]              
 91                -1  1      8768  models.common.DWConv                    [120, 64, 3, 1]               
 92                -1  1     41216  models.CSPS.RepConv                     [64, 64, 3, 1]                
 93                -1  1       704  models.common.DWConv                    [64, 64, 3, 1]                
 94                -1  1     41216  models.CSPS.RepConv                     [64, 64, 3, 1]                
 95[-1, -2, -3, -4, -5, -6]  1         0  models.common.Concat                    [1]                           
 96                -1  1     59760  models.common.Conv                      [496, 120, 1, 1]              
 97                -1  1         0  models.common.MP                        []                            
 98                -1  1     14640  models.common.Conv                      [120, 120, 1, 1]              
 99                -3  1     14640  models.common.Conv                      [120, 120, 1, 1]              
100                -1  1    144480  models.CSPS.RepConv                     [120, 120, 3, 2]              
101      [-1, -3, 59]  1         0  models.common.Concat                    [1]                           
102                -1  1    115680  models.common.Conv                      [480, 240, 1, 1]              
103                -2  1    115680  models.common.Conv                      [480, 240, 1, 1]              
104                -1  1      2400  models.common.DWConv                    [240, 120, 3, 1]              
105                -1  1    144480  models.CSPS.RepConv                     [120, 120, 3, 1]              
106                -1  1      1320  models.common.DWConv                    [120, 120, 3, 1]              
107                -1  1    144480  models.CSPS.RepConv                     [120, 120, 3, 1]              
108[-1, -2, -3, -4, -5, -6]  1         0  models.common.Concat                    [1]                           
109                -1  1    230880  models.common.Conv                      [960, 240, 1, 1]              
110                83  1     77280  models.CSPS.RepConv                     [64, 120, 3, 1]               
111                96  1    288960  models.CSPS.RepConv                     [120, 240, 3, 1]              
112               109  1   1153920  models.CSPS.RepConv                     [240, 480, 3, 1]              
113   [110, 111, 112]  1    912030  YOLOXDetect                             [80, [[8, 8], [16, 16], [32, 32]], <class 'models.CSPS.RepConv'>, [120, 240, 480]]
edgeyolo_s summary: 506 layers, 9793718 parameters, 9793718 gradients, 44.8 GFLOPs

YOLOv5 🚀 2024-4-26 Python-3.8.11 torch-1.9.0+cu111 CUDA:0 (GeForce RTX 3090, 24268MiB)

      Params      GFLOPs  GPU_mem (GB)  forward (ms) backward (ms)                   input                  output
     9793718       44.84         1.267         47.36         88.74        (1, 3, 640, 640)                    list