WongKinYiu / yolov7

Implementation of paper - YOLOv7: Trainable bag-of-freebies sets new state-of-the-art for real-time object detectors
GNU General Public License v3.0
13.03k stars 4.12k forks source link

yolov7 test mAP@.5 is lower than yolov5 for the same custom data. #743

Closed Digital2Slave closed 1 year ago

Digital2Slave commented 1 year ago

yolov5 use yolov5l.

1. yolov5

$ python3 train.py --img-size 640 --batch-size 16 --epochs 300 --data data/epbox_1zhanshou.yaml --weights weights/yolov5l.pt --device '0' --workers 24 --cache-images | tee log/pddf_yolov5l_v0.3.6.log
Using torch 1.7.1+cu110 CUDA:0 (NVIDIA GeForce RTX 3060, 12046MB)

Namespace(adam=False, batch_size=16, bucket='', cache_images=True, cfg='', data='data/epbox_1zhanshou.yaml', device='0', epochs=300, evolve=False, exist_ok=False, global_rank=-1, hyp='data/hyp.scratch.yaml', image_weights=False, img_size=[640, 640], local_rank=-1, log_imgs=16, multi_scale=False, name='pddf_yolov5l_v0.3.6', noautoanchor=False, nosave=False, notest=False, project='runs/train', rect=False, resume=False, save_dir='runs/train/pddf_yolov5l_v0.3.6', single_cls=False, sync_bn=False, total_batch_size=16, weights='weights/yolov5l.pt', workers=24, world_size=1)
Start Tensorboard with "tensorboard --logdir runs/train", view at http://localhost:6006/
Hyperparameters {'lr0': 0.01, 'lrf': 0.2, 'momentum': 0.937, 'weight_decay': 0.0005, 'warmup_epochs': 3.0, 'warmup_momentum': 0.8, 'warmup_bias_lr': 0.1, 'box': 0.05, 'cls': 0.5, 'cls_pw': 1.0, 'obj': 1.0, 'obj_pw': 1.0, 'iou_t': 0.2, 'anchor_t': 4.0, 'fl_gamma': 0.0, 'hsv_h': 0.015, 'hsv_s': 0.7, 'hsv_v': 0.4, 'degrees': 0.0, 'translate': 0.1, 'scale': 0.5, 'shear': 0.0, 'perspective': 0.0, 'flipud': 0.0, 'fliplr': 0.5, 'mosaic': 1.0, 'mixup': 0.0}
Overriding model.yaml nc=80 with nc=15

                 from  n    params  module                                  arguments                     
  0                -1  1      7040  models.common.Focus                     [3, 64, 3]                    
  1                -1  1     73984  models.common.Conv                      [64, 128, 3, 2]               
  2                -1  1    161152  models.common.BottleneckCSP             [128, 128, 3]                 
  3                -1  1    295424  models.common.Conv                      [128, 256, 3, 2]              
  4                -1  1   1627904  models.common.BottleneckCSP             [256, 256, 9]                 
  5                -1  1   1180672  models.common.Conv                      [256, 512, 3, 2]              
  6                -1  1   6499840  models.common.BottleneckCSP             [512, 512, 9]                 
  7                -1  1   4720640  models.common.Conv                      [512, 1024, 3, 2]             
  8                -1  1   2624512  models.common.SPP                       [1024, 1024, [5, 9, 13]]      
  9                -1  1  10234880  models.common.BottleneckCSP             [1024, 1024, 3, False]        
 10                -1  1    525312  models.common.Conv                      [1024, 512, 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   2823680  models.common.BottleneckCSP             [1024, 512, 3, False]         
 14                -1  1    131584  models.common.Conv                      [512, 256, 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    707328  models.common.BottleneckCSP             [512, 256, 3, False]          
 18                -1  1    590336  models.common.Conv                      [256, 256, 3, 2]              
 19          [-1, 14]  1         0  models.common.Concat                    [1]                           
 20                -1  1   2561536  models.common.BottleneckCSP             [512, 512, 3, False]          
 21                -1  1   2360320  models.common.Conv                      [512, 512, 3, 2]              
 22          [-1, 10]  1         0  models.common.Concat                    [1]                           
 23                -1  1  10234880  models.common.BottleneckCSP             [1024, 1024, 3, False]        
 24      [17, 20, 23]  1    107700  models.yolo.Detect                      [15, [[10, 13, 16, 30, 33, 23], [30, 61, 62, 45, 59, 119], [116, 90, 156, 198, 373, 326]], [256, 512, 1024]]
Model Summary: 499 layers, 47468724 parameters, 47468724 gradients, 116.5 GFLOPS

Transferred 652/658 items from weights/yolov5l.pt
......
     Epoch   gpu_mem       box       obj       cls     total   targets  img_size
                 all    2.65e+03    1.39e+04       0.428       0.419       0.353       0.138
   299/299     9.32G   0.01996   0.02128 0.0006552   0.04189        66       640: 100%|███████████████████████████████████████████████████████| 581/581 [07:52<00:00,  1.23it/s]
               Class      Images     Targets           P           R      mAP@.5  mAP@.5:.95: 100%|███████████████████████████████████████████| 166/166 [00:24<00:00,  6.88it/s]
300 epochs completed in 41.694 hours.

                 all    2.65e+03    1.39e+04       0.429       0.419       0.354       0.138
Optimizer stripped from runs/train/pddf_yolov5l_v0.3.6/weights/last.pt, 95.4MB
Optimizer stripped from runs/train/pddf_yolov5l_v0.3.6/weights/best.pt, 95.4MB

# test
$ python3 test.py --weights runs/train/pddf_yolov5l_v0.3.6/weights/best.pt --task test --data data/epbox_1zhanshou.yaml --img-size 640 --conf-thres 0.30 --iou-thres 0.45 --name pddf_yolov5l_v0.3.6
Namespace(augment=False, batch_size=32, conf_thres=0.3, data='data/epbox_1zhanshou.yaml', device='', exist_ok=False, img_size=640, iou_thres=0.45, name='pddf_yolov5l_v0.3.6', project='runs/test', save_conf=False, save_json=False, save_txt=False, single_cls=False, task='test', verbose=False, weights=['runs/train/pddf_yolov5l_v0.3.6/weights/best.pt'])
Using torch 1.7.1+cu110 CUDA:0 (NVIDIA GeForce RTX 3060, 12046MB)

Fusing layers... 
Model Summary: 400 layers, 47440052 parameters, 0 gradients
Scanning images: 100%|█████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████| 1308/1308 [00:00<00:00, 16439.53it/s]
Scanning labels /home/epbox/AI/dataset/pf/tradeInBox/v0.3.5_yolov7/labels/test.cache (968 found, 0 missing, 340 empty, 0 duplicate, for 1308 images): 1308it [00:00, 36413.63it/s]
               Class      Images     Targets           P           R      mAP@.5  mAP@.5:.95: 100%|███████████████████████████████████████████████████████████████████████████| 41/41 [00:12<00:00,  3.37it/s]
                 all    1.31e+03    6.08e+03       0.518       0.444       0.613        0.29
Speed: 7.3/0.5/7.8 ms inference/NMS/total per 640x640 image at batch-size 32
Results saved to runs/test/pddf_yolov5l_v0.3.6

2. yolov7

# train
$ python train.py --workers 8 --device 0 --batch-size 16 --epochs 300 --data data/epbox_1zhanshou.yaml --img 640 640 --cfg cfg/training/yolov7_1zhanshou.yaml --weights '/home/epbox/AI/pre_weights/yolov7/yolov7_training.pt' --name yolov7_1zhanshou_fixed_res --hyp data/hyp.scratch.custom.yaml
OLOR 🚀 v0.1-107-g44d8ab4 torch 1.7.1+cu110 CUDA:0 (NVIDIA GeForce RTX 3060, 12046.75MB)

Namespace(adam=False, artifact_alias='latest', batch_size=16, bbox_interval=-1, bucket='', cache_images=False, cfg='cfg/training/yolov7_1zhanshou.yaml', data='data/epbox_1zhanshou.yaml', device='0', entity=None, epochs=300, evolve=False, exist_ok=False, freeze=[0], global_rank=-1, hyp='data/hyp.scratch.custom.yaml', image_weights=False, img_size=[640, 640], label_smoothing=0.0, linear_lr=False, local_rank=-1, multi_scale=False, name='yolov7_1zhanshou_fixed_res', noautoanchor=False, nosave=False, notest=False, project='runs/train', quad=False, rect=False, resume=False, save_dir='runs/train/yolov7_1zhanshou_fixed_res', save_period=-1, single_cls=False, sync_bn=False, total_batch_size=16, upload_dataset=False, weights='/home/epbox/AI/pre_weights/yolov7/yolov7_training.pt', workers=8, world_size=1)
tensorboard: Start with 'tensorboard --logdir runs/train', view at http://localhost:6006/
hyperparameters: lr0=0.01, lrf=0.1, momentum=0.937, weight_decay=0.0005, warmup_epochs=3.0, warmup_momentum=0.8, warmup_bias_lr=0.1, box=0.05, cls=0.3, cls_pw=1.0, obj=0.7, obj_pw=1.0, iou_t=0.2, anchor_t=4.0, fl_gamma=0.0, hsv_h=0.015, hsv_s=0.7, hsv_v=0.4, degrees=0.0, translate=0.2, scale=0.5, shear=0.0, perspective=0.0, flipud=0.0, fliplr=0.5, mosaic=1.0, mixup=0.0, copy_paste=0.0, paste_in=0.0, loss_ota=1
wandb: Install Weights & Biases for YOLOR logging with 'pip install wandb' (recommended)

                 from  n    params  module                                  arguments                     
  0                -1  1       928  models.common.Conv                      [3, 32, 3, 1]                 
  1                -1  1     18560  models.common.Conv                      [32, 64, 3, 2]                
  2                -1  1     36992  models.common.Conv                      [64, 64, 3, 1]                
  3                -1  1     73984  models.common.Conv                      [64, 128, 3, 2]               
  4                -1  1      8320  models.common.Conv                      [128, 64, 1, 1]               
  5                -2  1      8320  models.common.Conv                      [128, 64, 1, 1]               
  6                -1  1     36992  models.common.Conv                      [64, 64, 3, 1]                
  7                -1  1     36992  models.common.Conv                      [64, 64, 3, 1]                
  8                -1  1     36992  models.common.Conv                      [64, 64, 3, 1]                
  9                -1  1     36992  models.common.Conv                      [64, 64, 3, 1]                
 10  [-1, -3, -5, -6]  1         0  models.common.Concat                    [1]                           
 11                -1  1     66048  models.common.Conv                      [256, 256, 1, 1]              
 12                -1  1         0  models.common.MP                        []                            
 13                -1  1     33024  models.common.Conv                      [256, 128, 1, 1]              
 14                -3  1     33024  models.common.Conv                      [256, 128, 1, 1]              
 15                -1  1    147712  models.common.Conv                      [128, 128, 3, 2]              
 16          [-1, -3]  1         0  models.common.Concat                    [1]                           
 17                -1  1     33024  models.common.Conv                      [256, 128, 1, 1]              
 18                -2  1     33024  models.common.Conv                      [256, 128, 1, 1]              
 19                -1  1    147712  models.common.Conv                      [128, 128, 3, 1]              
 20                -1  1    147712  models.common.Conv                      [128, 128, 3, 1]              
 21                -1  1    147712  models.common.Conv                      [128, 128, 3, 1]              
 22                -1  1    147712  models.common.Conv                      [128, 128, 3, 1]              
 23  [-1, -3, -5, -6]  1         0  models.common.Concat                    [1]                           
 24                -1  1    263168  models.common.Conv                      [512, 512, 1, 1]              
 25                -1  1         0  models.common.MP                        []                            
 26                -1  1    131584  models.common.Conv                      [512, 256, 1, 1]              
 27                -3  1    131584  models.common.Conv                      [512, 256, 1, 1]              
 28                -1  1    590336  models.common.Conv                      [256, 256, 3, 2]              
 29          [-1, -3]  1         0  models.common.Concat                    [1]                           
 30                -1  1    131584  models.common.Conv                      [512, 256, 1, 1]              
 31                -2  1    131584  models.common.Conv                      [512, 256, 1, 1]              
 32                -1  1    590336  models.common.Conv                      [256, 256, 3, 1]              
 33                -1  1    590336  models.common.Conv                      [256, 256, 3, 1]              
 34                -1  1    590336  models.common.Conv                      [256, 256, 3, 1]              
 35                -1  1    590336  models.common.Conv                      [256, 256, 3, 1]              
 36  [-1, -3, -5, -6]  1         0  models.common.Concat                    [1]                           
 37                -1  1   1050624  models.common.Conv                      [1024, 1024, 1, 1]            
 38                -1  1         0  models.common.MP                        []                            
 39                -1  1    525312  models.common.Conv                      [1024, 512, 1, 1]             
 40                -3  1    525312  models.common.Conv                      [1024, 512, 1, 1]             
 41                -1  1   2360320  models.common.Conv                      [512, 512, 3, 2]              
 42          [-1, -3]  1         0  models.common.Concat                    [1]                           
 43                -1  1    262656  models.common.Conv                      [1024, 256, 1, 1]             
 44                -2  1    262656  models.common.Conv                      [1024, 256, 1, 1]             
 45                -1  1    590336  models.common.Conv                      [256, 256, 3, 1]              
 46                -1  1    590336  models.common.Conv                      [256, 256, 3, 1]              
 47                -1  1    590336  models.common.Conv                      [256, 256, 3, 1]              
 48                -1  1    590336  models.common.Conv                      [256, 256, 3, 1]              
 49  [-1, -3, -5, -6]  1         0  models.common.Concat                    [1]                           
 50                -1  1   1050624  models.common.Conv                      [1024, 1024, 1, 1]            
 51                -1  1   7609344  models.common.SPPCSPC                   [1024, 512, 1]                
 52                -1  1    131584  models.common.Conv                      [512, 256, 1, 1]              
 53                -1  1         0  torch.nn.modules.upsampling.Upsample    [None, 2, 'nearest']          
 54                37  1    262656  models.common.Conv                      [1024, 256, 1, 1]             
 55          [-1, -2]  1         0  models.common.Concat                    [1]                           
 56                -1  1    131584  models.common.Conv                      [512, 256, 1, 1]              
 57                -2  1    131584  models.common.Conv                      [512, 256, 1, 1]              
 58                -1  1    295168  models.common.Conv                      [256, 128, 3, 1]              
 59                -1  1    147712  models.common.Conv                      [128, 128, 3, 1]              
 60                -1  1    147712  models.common.Conv                      [128, 128, 3, 1]              
 61                -1  1    147712  models.common.Conv                      [128, 128, 3, 1]              
 62[-1, -2, -3, -4, -5, -6]  1         0  models.common.Concat                    [1]                           
 63                -1  1    262656  models.common.Conv                      [1024, 256, 1, 1]             
 64                -1  1     33024  models.common.Conv                      [256, 128, 1, 1]              
 65                -1  1         0  torch.nn.modules.upsampling.Upsample    [None, 2, 'nearest']          
 66                24  1     65792  models.common.Conv                      [512, 128, 1, 1]              
 67          [-1, -2]  1         0  models.common.Concat                    [1]                           
 68                -1  1     33024  models.common.Conv                      [256, 128, 1, 1]              
 69                -2  1     33024  models.common.Conv                      [256, 128, 1, 1]              
 70                -1  1     73856  models.common.Conv                      [128, 64, 3, 1]               
 71                -1  1     36992  models.common.Conv                      [64, 64, 3, 1]                
 72                -1  1     36992  models.common.Conv                      [64, 64, 3, 1]                
 73                -1  1     36992  models.common.Conv                      [64, 64, 3, 1]                
 74[-1, -2, -3, -4, -5, -6]  1         0  models.common.Concat                    [1]                           
 75                -1  1     65792  models.common.Conv                      [512, 128, 1, 1]              
 76                -1  1         0  models.common.MP                        []                            
 77                -1  1     16640  models.common.Conv                      [128, 128, 1, 1]              
 78                -3  1     16640  models.common.Conv                      [128, 128, 1, 1]              
 79                -1  1    147712  models.common.Conv                      [128, 128, 3, 2]              
 80      [-1, -3, 63]  1         0  models.common.Concat                    [1]                           
 81                -1  1    131584  models.common.Conv                      [512, 256, 1, 1]              
 82                -2  1    131584  models.common.Conv                      [512, 256, 1, 1]              
 83                -1  1    295168  models.common.Conv                      [256, 128, 3, 1]              
 84                -1  1    147712  models.common.Conv                      [128, 128, 3, 1]              
 85                -1  1    147712  models.common.Conv                      [128, 128, 3, 1]              
 86                -1  1    147712  models.common.Conv                      [128, 128, 3, 1]              
 87[-1, -2, -3, -4, -5, -6]  1         0  models.common.Concat                    [1]                           
 88                -1  1    262656  models.common.Conv                      [1024, 256, 1, 1]             
 89                -1  1         0  models.common.MP                        []                            
 90                -1  1     66048  models.common.Conv                      [256, 256, 1, 1]              
 91                -3  1     66048  models.common.Conv                      [256, 256, 1, 1]              
 92                -1  1    590336  models.common.Conv                      [256, 256, 3, 2]              
 93      [-1, -3, 51]  1         0  models.common.Concat                    [1]                           
 94                -1  1    525312  models.common.Conv                      [1024, 512, 1, 1]             
 95                -2  1    525312  models.common.Conv                      [1024, 512, 1, 1]             
 96                -1  1   1180160  models.common.Conv                      [512, 256, 3, 1]              
 97                -1  1    590336  models.common.Conv                      [256, 256, 3, 1]              
 98                -1  1    590336  models.common.Conv                      [256, 256, 3, 1]              
 99                -1  1    590336  models.common.Conv                      [256, 256, 3, 1]              
100[-1, -2, -3, -4, -5, -6]  1         0  models.common.Concat                    [1]                           
101                -1  1   1049600  models.common.Conv                      [2048, 512, 1, 1]             
102                75  1    328704  models.common.RepConv                   [128, 256, 3, 1]              
103                88  1   1312768  models.common.RepConv                   [256, 512, 3, 1]              
104               101  1   5246976  models.common.RepConv                   [512, 1024, 3, 1]             
105   [102, 103, 104]  1    109672  models.yolo.IDetect                     [15, [[12, 16, 19, 36, 40, 28], [36, 75, 76, 55, 72, 146], [142, 110, 192, 243, 459, 401]], [256, 512, 1024]]
Model Summary: 415 layers, 37272072 parameters, 37272072 gradients, 105.4 GFLOPS

Transferred 555/566 items from /home/epbox/AI/pre_weights/yolov7/yolov7_training.pt
Scaled weight_decay = 0.0005
Optimizer groups: 95 .bias, 95 conv.weight, 98 other
......
     Epoch   gpu_mem       box       obj       cls     total    labels  img_size
   299/299       11G    0.0187  0.008005 0.0002686   0.02698        48       640: 100%|███████████████████████████████████████████████| 581/581 [09:10<00:00,  1.06it/s]
               Class      Images      Labels           P           R      mAP@.5  mAP@.5:.95: 100%|█████████████████████████████████████| 83/83 [00:26<00:00,  3.19it/s]
                 all        2650       13868       0.469       0.443       0.369       0.139
             scratch        2650         586       0.343       0.361       0.233      0.0773
               crack        2650        7760       0.475       0.531       0.401       0.134
             leakage        2650         880       0.695       0.566       0.572       0.251
            membrane        2650        1520       0.552        0.63       0.557       0.191
         wiredscreen        2650         830       0.618       0.586       0.545       0.232
       blurredscreen        2650         148       0.315       0.357       0.279       0.119
           highlight        2650         358       0.455       0.534       0.517       0.195
               crush        2650         210       0.541       0.324       0.248       0.062
            agingred        2650         280       0.542       0.452        0.42       0.133
          aginggreen        2650         968       0.481       0.499       0.436        0.17
           agingdark        2650          34       0.472       0.263       0.215      0.0798
          aginglight        2650          44       0.407       0.205       0.165      0.0666
               clash        2650          58       0.325       0.224       0.119      0.0326
          dotleakage        2650         192       0.342       0.677       0.463       0.203
300 epochs completed in 48.124 hours.

Optimizer stripped from runs/train/yolov7_1zhanshou_fixed_res/weights/last.pt, 75.0MB
Optimizer stripped from runs/train/yolov7_1zhanshou_fixed_res/weights/best.pt, 75.0MB

# test
python test.py --weights runs/train/yolov7_1zhanshou_fixed_res/weights/best.pt --task test --data data/epbox_1zhanshou.yaml --img-size 640 --conf-thres 0.001 --iou-thres 0.45 --name yolov7_1zhanshou_fixed_res

Namespace(augment=False, batch_size=32, conf_thres=0.001, data='data/epbox_1zhanshou.yaml', device='', exist_ok=False, img_size=640, iou_thres=0.45, name='yolov7_1zhanshou_fixed_res', no_trace=False, project='runs/test', save_conf=False, save_hybrid=False, save_json=False, save_txt=False, single_cls=False, task='test', verbose=False, weights=['runs/train/yolov7_1zhanshou_fixed_res/weights/best.pt'])
YOLOR 🚀 v0.1-107-g44d8ab4 torch 1.7.1+cu110 CUDA:0 (NVIDIA GeForce RTX 3060, 12046.75MB)

Fusing layers... 
RepConv.fuse_repvgg_block
RepConv.fuse_repvgg_block
RepConv.fuse_repvgg_block
IDetect.fuse
Model Summary: 314 layers, 36557288 parameters, 6194944 gradients, 103.4 GFLOPS
 Convert model to Traced-model... 
 traced_script_module saved! 
 model is traced! 

test: Scanning '/home/epbox/AI/dataset/pf/tradeInBox/v0.3.5_yolov7/labels/test.cache' images and labels... 1308 found, 0 missing, 340 empty, 0 corrupted: 100%|█| 1308/1
               Class      Images      Labels           P           R      mAP@.5  mAP@.5:.95: 100%|█████████████████████████████████████| 41/41 [00:14<00:00,  2.91it/s]
                 all        1308        6082       0.492       0.477       0.452       0.184
             scratch        1308         306       0.401       0.402       0.326       0.116
               crack        1308        2918       0.528       0.551       0.502       0.176
             leakage        1308         400       0.708        0.66       0.673       0.308
            membrane        1308         746       0.643       0.538       0.617       0.207
         wiredscreen        1308         430       0.681       0.584       0.632       0.259
       blurredscreen        1308          84       0.583       0.483       0.522       0.206
           highlight        1308         170       0.504       0.624       0.575       0.199
               crush        1308         100       0.535        0.29         0.3       0.127
            agingred        1308         122       0.563       0.549       0.464       0.224
          aginggreen        1308         626       0.516        0.57       0.501       0.222
           agingdark        1308          12       0.374        0.25       0.276       0.135
          aginglight        1308          20       0.259        0.35       0.224       0.112
               clash        1308          16       0.201       0.125      0.0732      0.0229
          dotleakage        1308         132        0.39       0.705       0.638       0.265
Speed: 7.9/0.6/8.6 ms inference/NMS/total per 640x640 image at batch-size 32
Results saved to runs/test/yolov7_1zhanshou_fixed_res

3. yolov5 vs yolov7 PR curve

3.1 yolov5

precision_recall_curve

3.2 yolov7

PR_curve

rovebot commented 1 year ago

The image of yolov5-P-R shows that something wrong during testing

Digital2Slave commented 1 year ago

The image of yolov5-P-R shows that something wrong during testing

Thanks.

I change yolov5 version from v5.0 to v6.1, and rerun val.py.

$ python3 val.py --weights runs/train/pddf_yolov5l_v0.3.6/weights/best.pt --task test --data data/epbox_1zhanshou.yaml --img-size 640 --conf-thres 0.30 --iou-thres 0.45 --name pddf_yolov5l_v0.3.6
val: data=data/epbox_1zhanshou.yaml, weights=['runs/train/pddf_yolov5l_v0.3.6/weights/best.pt'], batch_size=32, imgsz=640, conf_thres=0.3, iou_thres=0.45, task=test, device=, workers=8, single_cls=False, augment=False, verbose=False, save_txt=False, save_hybrid=False, save_conf=False, save_json=False, project=runs/val, name=pddf_yolov5l_v0.3.6, exist_ok=False, half=False, dnn=False
WARNING: confidence threshold 0.3 >> 0.001 will produce invalid mAP values.
YOLOv5 🚀 2022-2-22 torch 1.7.1+cu110 CUDA:0 (NVIDIA GeForce RTX 3060, 12047MiB)

Fusing layers... 
Model Summary: 400 layers, 47440052 parameters, 0 gradients
test: Scanning '/home/epbox/AI/dataset/pf/tradeInBox/v0.3.5_yolov7/labels/test' images and labels...1308 found, 0 missing, 340 empty, 0 corrupt: 100%|█████████████████| 1308/1308 [00:00<00:00, 23696.43it/s]
test: New cache created: /home/epbox/AI/dataset/pf/tradeInBox/v0.3.5_yolov7/labels/test.cache
               Class     Images     Labels          P          R     mAP@.5 mAP@.5:.95: 100%|██████████| 41/41 [00:20<00:00,  2.03it/s]                                                                       
                 all       1308       6082      0.527      0.437      0.472      0.213
             scratch       1308        306      0.406      0.346      0.335      0.146
               crack       1308       2918      0.507      0.518      0.476      0.194
             leakage       1308        400      0.661      0.596      0.659      0.349
            membrane       1308        746      0.649      0.512      0.599       0.25
         wiredscreen       1308        430      0.672      0.563      0.616      0.313
       blurredscreen       1308         84      0.674      0.488      0.592      0.281
           highlight       1308        170      0.556      0.629      0.638      0.272
               crush       1308        100      0.419       0.25      0.364      0.142
            agingred       1308        122      0.449      0.443      0.389      0.195
          aginggreen       1308        626      0.534       0.46      0.449      0.219
           agingdark       1308         12        0.6       0.25      0.375      0.188
          aginglight       1308         20      0.318       0.35      0.259      0.118
               clash       1308         16        0.5     0.0625      0.266     0.0531
          dotleakage       1308        132      0.432      0.644      0.592      0.256
Speed: 0.1ms pre-process, 11.8ms inference, 2.0ms NMS per image at shape (32, 3, 640, 640)
Results saved to runs/val/pddf_yolov5l_v0.3.6

PR_curve

WongKinYiu commented 1 year ago

In your yolov5 testing results: WARNING: confidence threshold 0.3 >> 0.001 will produce invalid mAP values.

From training, your could find: yolov5: mAP@.5=0.354, mAP@.5:.9=0.138. yolov7: mAP@.5=0.369, mAP@.5:.9=0.139.

By the way, metric code of yolov7 and yolov5 have a little bit different, you have to use same metric code for evaluation. For example, from your P-R curve, you could find that metric code of yolov5 force set max value of recall to one. So usually, metric code of yolov7 usually shows 1\~3% lower value than metric code of yolov5 when evaluating a same model.

Digital2Slave commented 1 year ago

Got it! Thanks a lot. @WongKinYiu

zhjw0927 commented 1 year ago

Why is yolov7's inference speed slower than yolov5l? @WongKinYiu