--- id: pycocotools version: "2.0.11" license: FreeBSD license_treatment: unclear maintenance: active --- # pycocotools — Official APIs for the MS-COCO dataset License: unclear · Maintenance: active · Downloads: 5.7M/mo ## What it is and what it does pycocotools is a maintained fork of the official MS-COCO dataset API, providing Python bindings to load and manipulate COCO-format annotations for object detection, instance segmentation, and keypoint detection tasks. It wraps the original C++ implementation and depends only on numpy. The package includes utilities to parse JSON annotation files, query images and annotations, compute evaluation metrics, and encode/decode run-length encoded segmentation masks. The fork addresses long-standing issues in the original cocoapi: it installs cleanly via pip on Windows and modern Python versions, avoids unnecessary matplotlib imports, fixes file handle leaks, and resolves segmentation faults in RLE decoding. It maintains API compatibility with the original to ensure existing code continues to work without modification. Use it for: - Load COCO-format annotations and retrieve image metadata and ground-truth bounding boxes for training object detection models. - Evaluate detection and segmentation model predictions against COCO ground truth using standard metrics (AP, AR). - Decode and manipulate instance segmentation masks stored in run-length encoded format within COCO JSON files. - Query and filter annotations by category, image ID, or area to prepare dataset splits for training and validation. - Integrate COCO dataset loading into computer vision pipelines that require standard annotation formats. ## Worth the install? AI-flagged interpretation of the facts above — verify before relying. Provides Python APIs for loading, parsing, and working with the MS-COCO dataset, including annotation access and evaluation metrics for object detection and segmentation tasks. Yes, if you work with COCO-format datasets. The package is actively maintained, widely used (top 5000 on PyPI), has no known vulnerabilities, and the fork fixes real issues in the original. Verify the FreeBSD license terms for your use case before committing to a production dependency. ## Install pip install pycocotools uv add pycocotools poetry add pycocotools ## Installing pycocotools Before you install: Medium install friction due to compiled components, but pre-built wheels are available for common platforms (macOS, Linux x86_64/aarch64, Windows). Last release was 242 days ago; repository is active with recent commits. License in practice: License treatment is unclear; the raw license is listed as FreeBSD but SPDX mapping is absent. Verify the actual license terms before use in proprietary or restricted-license projects. Quickstart: pip install pycocotools from pycocotools.coco import COCO import numpy as np coco = COCO('annotations.json') img_ids = coco.getImgIds() img = coco.loadImgs(img_ids[0])[0] Requires Python >= 3.9. Compiled extension; installation may require build tools on platforms without pre-built wheels. Verify before relying: - Exact scope of bug fixes and improvements over the original cocoapi—which specific use cases benefit most. - Whether the FreeBSD license is correctly mapped and what restrictions it imposes in commercial contexts. - Performance characteristics when working with very large annotation files or datasets. ## Package facts - License: FreeBSD (unclear) - Python support: supports_current - Install friction: medium - Maintenance: active - Downloads: 5.7M/month (top 5,000 on PyPI) - Known vulnerabilities: none known ## Tags coco dataset api, object detection annotations, image segmentation dataset, coco evaluation metrics, dataset loading python, annotation parsing, computer vision dataset tools, dataset-tools, computer-vision, coco-format [View on SkillFed](https://skillfed.io/packages/pycocotools) · [View on PyPI](https://pypi.org/project/pycocotools/)