question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Can't evaluate model retinanet_R_50_FPN_3x on COCO

See original GitHub issue
  1. what changes you made (git diff) or what code you wrote No changes like the tutorials

  2. what exact command you run: register_coco_instances(“my_test”, {}, “dataset/test.json”, “dataset/test/images”) evaluator = COCOEvaluator(“my_test”, cfg, False, output_dir=“./output/”) val_loader = build_detection_test_loader(cfg, “my_test”) inference_on_dataset(trainer.model, val_loader, evaluator)

  3. what you observed (including the full logs): I trained the model on my own dataset. With Faster R-CNN models the evaluation feature works with NO problems and delivers metrics

If I train with retina config and retina weights cfg.MODEL.WEIGHTS = “detectron2://COCO-Detection/retinanet_R_50_FPN_3x/137849486/model_final_4cafe0.pkl”

The same code that works for Faster R-CNN: delivers an error in RetinaNet: [12/04 18:05:36 d2.evaluation.coco_evaluation]: Preparing results for COCO format …

~/detectron2/detectron2/evaluation/coco_evaluation.py in _eval_predictions(self, tasks) 147 } 148 for result in self._coco_results: –> 149 result[“category_id”] = reverse_id_mapping[result[“category_id”]] 150 151 if self._output_dir:

KeyError: 39

I only have one class. But there is no problem with the category_id (i’m starting on 1) as it works with Faster R-CNN with the same json files. As a comment, Retina has no ROI_heads so we have to use different threshold parameter cfg.MODEL.RETINANET.SCORE_THRESH_TEST = 0.4

This is the same error documented here

Environment

detectron2 has been successfully installed.

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Reactions:3
  • Comments:5

github_iconTop GitHub Comments

5reactions
ebrahim31commented, Nov 16, 2020

@shamim-io Maybe try cfg.MODEL.RETINANET.NUM_CLASSES = 1?

5reactions
ppwwyyxxcommented, Dec 5, 2019

Your model predicts classes 39 that’s not in your dataset. You may have missed https://detectron2.readthedocs.io/tutorials/datasets.html#update-the-config-for-new-datasets

Read more comments on GitHub >

github_iconTop Results From Across the Web

Detectron2: Retinanet R50 FPN 3x - COCO - object detection
Your browser can't play this video. Learn more. Switch camera.
Read more >
arXiv:2105.04905v1 [cs.CV] 11 May 2021
In this paper, we study the behaviour of different configurations of RetinaNet, Faster R-CNN and Mask. R-CNN presented in Detectron2. First, we ...
Read more >
RetinaNet | Papers With Code
Summary RetinaNet is a one-stage object detection model that utilizes a focal loss function to address class imbalance during training.
Read more >
Replicating Airbnb's Amenity Detection with Detectron2
You'll often see tutorial computer vision models being built on datasets like MNIST ... model alias : model setup instructions "R50-FPN-1x": ...
Read more >
latest PDF - MMDetection's documentation!
If you can't find those values, check the config file which in ... We can use the COCO pretrained Cascade Mask R-CNN R50...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found