TexasInstruments / edgeai-yolov5

YOLOv5 🚀 in PyTorch > ONNX > CoreML > TFLite. Forked from https://ultralytics.com/yolov5
https://github.com/TexasInstruments/edgeai
GNU General Public License v3.0
650 stars 120 forks source link

Labels, P, R, mAP50, and mAP90 in VAL are 0 for each training #55

Closed Oneliangzai closed 1 year ago

Oneliangzai commented 2 years ago

❔Question

Hello! Thank you for your work! However, such a problem occurred when I reproduced your code. When I tried to train the COCO dataset, the Labels, P, R, mAP50, and mAP90 in the val of each training were all Zero. Since I made a few changes, I'm not sure what the problem is, and I'll show my changes below.

Additional context

Here are the changes I made to address the error in the original code

1.Data set format ![Uploading b083cea0aa52d1903d9351b1d3c9f04.jpg…]()

    edgeai-yolov5
     │ coco_kpts
          │   images
          │   annotations
          |   labels
               │   └─────train2017
               │       │       └───
               |       |       └───
               |       |       '
               |       |       .
               │       └─val2017
               |               └───
               |               └───
               |               .
               |               .
           |    train2017.txt
           |    val2017.txt   
    │   README.md
    │   ...   
    │

2.My configuration environment Windows 2080 cunda=11.6

  cudatoolkit               11.6.0              hc0ea762_10    conda-forge

  torch                     1.12.1                   pypi_0    pypi
  torchaudio                0.12.1               py38_cu116    pytorch
  torchvision               0.13.1                   pypi_0    pypi

  vc                        14.2                 h21ff451_1    https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main
  vs2015_runtime            14.27.29016          h5e58377_2    https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main

..... 3.loss.py Under the 'def build_targets' function of loss.py

①  anchors = self.anchors[i]   Replace with     anchors, shape = self.anchors[i], p[i].shape

②
  indices.append((b, a, gj.clamp_(0, gain[3] - 1), gi.clamp_(0, gain[2] - 1)))  # image, anchor, grid indices 
  Replace with  
   indices.append((b, a, gj.clamp_(0, shape[2] - 1), gi.clamp_(0, shape[3] - 1)))

I am not sure whether it is the above problem or other reasons that cause the labels, P, R and map values in Val to be 0. If you have any suggestions, please let me know. If you need to provide any other information, I will be happy to do so

NotemyName commented 2 years ago

It was an incomplete data set that caused the problem, and it's now working