Skip to content

YOLOv5 Tutorial Colab COCO test-dev2017 issue #2649

Closed

Description

@NicoloPosta

❔Question

I'm using the Colab YOLOv5 Tutorial jupyter notebook, i'm in the section COCO test-dev2017 and i'm getting this output when i run the following command !python test.py --weights yolov5s.pt --data coco.yaml --task test:

Namespace(augment=False, batch_size=32, conf_thres=0.001, data='./data/coco.yaml', device='', exist_ok=False, img_size=640, iou_thres=0.6, name='exp', project='runs/test', save_conf=False, save_hybrid=False, save_json=True, save_txt=False, single_cls=False, task='test', verbose=False, weights=['yolov5s.pt'])
YOLOv5 🚀 v4.0-169-g1e8ab3f torch 1.8.0+cu101 CUDA:0 (Tesla T4, 15109.75MB)

Fusing layers... 
Model Summary: 224 layers, 7266973 parameters, 0 gradients, 17.0 GFLOPS
test: Scanning '../coco/test-dev2017' images and labels... 0 found, 20288 missing, 0 empty, 0 corrupted: 100% 20288/20288 [00:17<00:00, 1142.06it/s]
test: WARNING: No labels found in ../coco/test-dev2017.cache. See https://github.com/ultralytics/yolov5/wiki/Train-Custom-Data
test: New cache created: ../coco/test-dev2017.cache
               Class      Images      Labels           P           R      mAP@.5  mAP@.5:.95: 100% 634/634 [03:38<00:00,  2.90it/s]
                 all       20288           0           0           0           0           0
Speed: 3.0/3.0/6.0 ms inference/NMS/total per 640x640 image at batch-size 32
/usr/local/lib/python3.7/dist-packages/seaborn/matrix.py:194: RuntimeWarning: All-NaN slice encountered
  vmin = np.nanmin(calc_data)
/usr/local/lib/python3.7/dist-packages/seaborn/matrix.py:199: RuntimeWarning: All-NaN slice encountered
  vmax = np.nanmax(calc_data)

Evaluating pycocotools mAP... saving runs/test/exp2/yolov5s_predictions.json...
loading annotations into memory...
Done (t=0.96s)
creating index...
index created!
Loading and preparing results...
pycocotools unable to run: Results do not correspond to current coco set
Results saved to runs/test/exp

I think the problem is in this line:

test: Scanning '../coco/test-dev2017' images and labels... 0 found, 20288 missing, 0 empty, 0 corrupted: 100% 20288/20288

because the ../coco/test-dev2017 does not exist in the coco folder that gets downloaded by following the jupyter notebook line by line.

I've noticed that the test-dev2017 lables aren't present in the coco folder mentioned before, maybe that's the reason why i'm getting this other error too:

pycocotools unable to run: Results do not correspond to current coco set

Probably since it was a competition the test-dev2017 lables are not publicly available and so the results must be submitted to the evaluation server.
If it's how i said can you explain me how to submit them to the correct evaluation server since i can't figure it out myself?

In addition i've found another error in the same section:

(Original)

torch.hub.download_url_to_file('https://github.com/ultralytics/yolov5/releases/download/v1.0/coco2017labels.zip', 'tmp.zip')
!unzip -q tmp.zip -d ../ && rm tmp.zip  # unzip labels
!f="test2017.zip" && curl http://images.cocodataset.org/zips/$f -o $f && unzip -q $f && rm $f  # 7GB,  41k images
%mv ./test2017 ./coco/images && mv ./coco ../  # move images to /coco and move /coco next to /yolov5

(Resolved)

torch.hub.download_url_to_file('https://github.com/ultralytics/yolov5/releases/download/v1.0/coco2017labels.zip', 'tmp.zip')
!unzip -q tmp.zip -d ../ && rm tmp.zip  # unzip labels
!f="test2017.zip" && curl http://images.cocodataset.org/zips/$f -o $f && unzip -q $f && rm $f  # 7GB,  41k images
%mv ./test2017 ../coco/images  # move images to /coco

Additional context

I'm using free version of Google Colab for funning the jupyter

Activity

  1. github-actions commented on Mar 29, 2021

    @github-actions
    Contributor

    👋 Hello @NicoloPosta, thank you for your interest in 🚀 YOLOv5! Please visit our ⭐️ Tutorials to get started, where you can find quickstart guides for simple tasks like Custom Data Training all the way to advanced concepts like Hyperparameter Evolution.

    If this is a 🐛 Bug Report, please provide screenshots and minimum viable code to reproduce your issue, otherwise we can not help you.

    If this is a custom training ❓ Question, please provide as much information as possible, including dataset images, training logs, screenshots, and a public link to online W&B logging if available.

    For business inquiries or professional support requests please visit https://www.ultralytics.com or email Glenn Jocher at glenn.jocher@ultralytics.com.

    Requirements

    Python 3.8 or later with all requirements.txt dependencies installed, including torch>=1.7. To install run:

    $ pip install -r requirements.txt

    Environments

    YOLOv5 may be run in any of the following up-to-date verified environments (with all dependencies including CUDA/CUDNN, Python and PyTorch preinstalled):

    Status

    CI CPU testing

    If this badge is green, all YOLOv5 GitHub Actions Continuous Integration (CI) tests are currently passing. CI tests verify correct operation of YOLOv5 training (train.py), testing (test.py), inference (detect.py) and export (export.py) on MacOS, Windows, and Ubuntu every 24 hours and on every commit.

  2. glenn-jocher commented on Mar 29, 2021

    @glenn-jocher
    Member

    @NicoloPosta for COCO test-dev2017 results:

    1. Run Setup cell in notebook.
    2. Run both cells in COCO test-dev2017 section (download data and evaluate model)
    3. Submit JSON results to server https://competitions.codalab.org/competitions/20794
  3. glenn-jocher commented on Mar 29, 2021

    @glenn-jocher
    Member

    @NicoloPosta I see the bug in cell you mentioned, I think your fix looks good, I will update the notebook with this, thank you for the recommendation!

  4. NicoloPosta commented on Mar 29, 2021

    @NicoloPosta
    Author

    @glenn-jocher Thanks for your replies, i have another problem.
    On the submission server (the link you gave me), i go on the Participate tab, i select test-dev2019 (bbox) and click the Submit button, then after choosing the json file to submit the server gives me this error Invalid file type (application/json).
    Am i submitting the json file to the wrong section/server or am i fillowing the wrong procedure to evaluate the results? Sorry for bothering you.

  5. glenn-jocher commented on Mar 29, 2021

    @glenn-jocher
    Member

    @NicoloPosta I've updated Colab notebook now per your feedback in 1b100cd

    You may need to update the json file name to conform to the conventions they require, but I'm not sure. What site are you going to and what steps are you doing exactly?

  6. NicoloPosta commented on Mar 29, 2021

    @NicoloPosta
    Author

    @glenn-jocher I've seen the commint, it's not a major bug but i hope my contribution helped to make the Tutorial better for other people.

    The site i'm going to is: https://competitions.codalab.org/competitions/20794

    1. I click on the Participate tab.
    2. I click the test-dev2019 (bbox) button (the orange one, just next to the light blue one called val2017 (bbox) ).
    3. I scroll all the way down and click on Submit and browse for the yolov5s_predictions.json file that i saved on my computer from the test-dev2017 results obtained from the Colab Tutorial.
    4. I get the error message form the browser Invalid file type (application/json).

    I even tried renaming the json file as you suggested but i can't find any standard.
    I tryed with test-dev2017_yolov5s_predictions.json but i get the same error message as before.

    Thanks for the patience and the help.

  7. glenn-jocher commented on Mar 29, 2021

    @glenn-jocher
    Member

    @NicoloPosta I see. If I remember I think you might need to zip the JSON file before upload? If this doesn't work let me know and I'll add a TODO to investigate this week. Thanks!

  8. glenn-jocher commented on Mar 29, 2021

    @glenn-jocher
    Member

    @NicoloPosta your JSON filename might need to follow this format (not sure, but this is what we use), and then I confirm the upload must be a zip file:
    Screenshot 2021-03-29 at 17 54 40

  9. NicoloPosta commented on Mar 29, 2021

    @NicoloPosta
    Author

    @glenn-jocher It worked!
    The problem was the required zip extension, thanks a lot for the help, i admire your work on the Yolo models and the support you gave me.
    In my opinion if your team can put a few lines on how to submit the results and the extension they need to be in the Colab Tutorial it might be helpfull for others in the future, a part from that thanks again for the help!

  10. glenn-jocher commented on Mar 29, 2021

    @glenn-jocher
    Member

    That's a good idea! Should we update the text like this?

    COCO test-dev2017

    Download COCO test2017 dataset (7GB - 40,000 images), to test model accuracy on test-dev set (20,000 images). Results are saved to a *.json file which can be submitted to the evaluation server at https://competitions.codalab.org/competitions/20794.

    COCO test-dev2017

    Download COCO test2017 dataset (7GB - 40,000 images), to test model accuracy on test-dev set (20,000 images, no labels). Results are saved to a *.json file which should be zipped and submitted to the evaluation server at https://competitions.codalab.org/competitions/20794.

  11. NicoloPosta commented on Mar 29, 2021

    @NicoloPosta
    Author

    The second version seems more clear on how to commit it, i would go with that.

  12. glenn-jocher commented on Mar 30, 2021

    @glenn-jocher
    Member

    @NicoloPosta updated in 1b475c1. Thank you for your contributions!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    questionFurther information is requested

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions