From where can I import the get_coco_api_from_dataset module?

I have been following this tutorial: Transformers-Tutorials/Fine_tuning_DetrForObjectDetection_on_custom_dataset_(balloon).ipynb at master 路 NielsRogge/Transformers-Tutorials 路 GitHub

While trying to evaluate the model, I should be using from datasets import get_coco_api_from_dataset. However, I am getting an ImportError while doing that:

ImportError: cannot import name 'get_coco_api_from_dataset'

I don鈥檛 seem to find the coco_eval module too. So, this line fails: from datasets.coco_eval import CocoEvaluator. Were the coco-related modules shifted somewhere, or do I need to import them from a different package?

Can someone please help me understand how do I import this module?

Hi! The linked notebook uses COCO from this repository (notice the datasets package in it), and not the one from :hugs: datasets (we are in the process of adding it to the lib). As long as you execute all the commands from the notebook up to that import, the import should work, and locally you can clone the repo and add it to sys.path (import sys; sys.path.insert(0, "path/to/repo")) to make it visible to the import system.

2 Likes