@@ -237,8 +237,8 @@ def parse_model(d, ch):  # model_dict, input_channels(3)
237237                pass 
238238
239239        n  =  n_  =  max (round (n  *  gd ), 1 ) if  n  >  1  else  n   # depth gain 
240-         if  m  in  [Conv , GhostConv , Bottleneck , GhostBottleneck , SPP , DWConv , MixConv2d , Focus , CrossConv ,  BottleneckCSP ,
241-                  C3 , C3TR , C3SPP , C3Ghost ]:
240+         if  m  in  [Conv , GhostConv , Bottleneck , GhostBottleneck , SPP , SPPF ,  DWConv , MixConv2d , Focus , CrossConv ,
241+                  BottleneckCSP ,  C3 , C3TR , C3SPP , C3Ghost ]:
242242            c1 , c2  =  ch [f ], args [0 ]
243243            if  c2  !=  no :  # if not output 
244244                c2  =  make_divisible (c2  *  gw , 8 )
@@ -279,6 +279,7 @@ def parse_model(d, ch):  # model_dict, input_channels(3)
279279    parser  =  argparse .ArgumentParser ()
280280    parser .add_argument ('--cfg' , type = str , default = 'yolov5s.yaml' , help = 'model.yaml' )
281281    parser .add_argument ('--device' , default = '' , help = 'cuda device, i.e. 0 or 0,1,2,3 or cpu' )
282+     parser .add_argument ('--profile' , action = 'store_true' , help = 'profile model speed' )
282283    opt  =  parser .parse_args ()
283284    opt .cfg  =  check_file (opt .cfg )  # check file 
284285    set_logging ()
@@ -289,8 +290,9 @@ def parse_model(d, ch):  # model_dict, input_channels(3)
289290    model .train ()
290291
291292    # Profile 
292-     # img = torch.rand(8 if torch.cuda.is_available() else 1, 3, 320, 320).to(device) 
293-     # y = model(img, profile=True) 
293+     if  opt .profile :
294+         img  =  torch .rand (8  if  torch .cuda .is_available () else  1 , 3 , 640 , 640 ).to (device )
295+         y  =  model (img , profile = True )
294296
295297    # Tensorboard (not working https://github.com/ultralytics/yolov5/issues/2898) 
296298    # from torch.utils.tensorboard import SummaryWriter 
0 commit comments