COCO, short for Common Objects in Context and often called MS COCO, is a large public image dataset that pairs everyday photographs with object bounding boxes, instance segmentation masks, human keypoints and natural-language captions. In the field of training data for artificial intelligence, it serves as the reference benchmark for object detection and segmentation, and its evaluation protocol defines how most vision models report accuracy.
Released in 2014 by a team led by researchers at Microsoft, COCO deliberately collected non-iconic images: cluttered scenes in which objects appear small, partially hidden and surrounded by other objects. That design choice made it much harder than earlier datasets and pushed models toward reasoning about objects in context rather than recognizing a single centered subject.
What the COCO dataset contains
COCO contains roughly 330,000 images, of which more than 200,000 carry full annotations, with about 1.5 million labeled object instances. The core label set covers 80 object categories called “things”, such as person, car, dog, chair and cup, grouped into 12 supercategories.
Several annotation layers were added to the same images over time, which is why the name refers to a family of tasks rather than one label type. The table below summarizes the main layers and what each one supports.
| Annotation layer | Content | Typical task |
|---|---|---|
| Bounding boxes | Axis-aligned box per object instance | Object detection |
| Instance masks | Polygon or run-length encoded mask | Instance segmentation |
| Keypoints | 17 body joints per annotated person | Human pose estimation |
| Captions | At least 5 sentences per image | Image captioning, retrieval |
| Background and panoptic labels | 91 amorphous background classes; 133 panoptic classes | Semantic and panoptic segmentation |
| DensePose | Mapping of body pixels to a 3D surface | Dense human pose |
The labels were produced through crowdsourced labeling on Amazon Mechanical Turk, using a staged pipeline: workers first marked which categories were present, then located each instance, and finally traced its outline. This multi-stage workflow reduced cost while keeping recall high, although it still left some missed and imprecise labels.
How COCO structures splits and annotation files
The current standard release uses the 2017 splits, which reorganized the earlier 2014 split into a larger training set and a fixed validation set. Test labels are withheld on an evaluation server so that published results cannot be tuned against them.
| Split | Approximate images | Labels public | Purpose |
|---|---|---|---|
| train2017 | 118,000 | Yes | Model training |
| val2017 | 5,000 | Yes | Validation and ablation studies |
| test-dev2017 | 20,000 | No | Leaderboard reporting |
| unlabeled2017 | 123,000 | No labels exist | Semi-supervised learning |
Annotations ship as JSON files with three central arrays: images, annotations and categories. Each annotation stores a bbox in the form [x, y, width, height] measured in pixels from the top-left corner, a segmentation field, an area and an iscrowd flag. The COCO JSON format became a de facto exchange standard, so labeling tools such as CVAT, Label Studio and Labelbox can export to it directly.
The iscrowd flag marks dense groups of objects that annotators could not separate, such as a crowd of spectators. These regions are encoded as run-length masks and are ignored during evaluation, so a detector is neither rewarded nor penalized for predictions that fall inside them.
How COCO evaluation measures accuracy
The COCO evaluation protocol reports mean average precision (AP) averaged over ten intersection over union (IoU) thresholds, from 0.50 to 0.95 in steps of 0.05. A prediction counts as correct only when its overlap with a ground-truth object reaches the threshold, so the averaged metric rewards precise localization, not just finding the object.
Results are also broken down by object size, because small objects remain the hardest case for nearly every architecture. The official pycocotools library computes all of these numbers, and differences between reimplementations can shift scores enough to matter when papers are compared.
| Metric | Definition | What it reveals |
|---|---|---|
| AP | Mean over IoU 0.50 to 0.95 | Overall detection and localization quality |
| AP50 | AP at IoU 0.50 | Loose localization, comparable to Pascal VOC |
| AP75 | AP at IoU 0.75 | Strict, tight-box accuracy |
| APs | Objects under 32 x 32 pixels | Small-object performance |
| APm | Objects from 32 x 32 to 96 x 96 pixels | Medium-object performance |
| APl | Objects above 96 x 96 pixels | Large-object performance |
Recall is reported in a similar way as average recall (AR) at fixed numbers of detections per image, typically 1, 10 and 100. The limit of 100 detections per image is part of the protocol, so models must rank their outputs sensibly rather than flood the image with boxes.
How COCO compares with other vision datasets
COCO sits between small, clean benchmarks and very large, loosely labeled corpora. Its strength is dense, instance-level annotation at moderate scale, which is why it remains the default detection benchmark even after much larger datasets appeared.
| Dataset | Main label type | Scale and scope | Key difference from COCO |
|---|---|---|---|
| ImageNet | Image-level class | About 1.3 million images, 1,000 classes | Mostly iconic, single-object images |
| Pascal VOC | Boxes and masks | About 11,000 images, 20 classes | Smaller, simpler scenes, single IoU metric |
| Open Images | Boxes, masks, relations | About 9 million images, 600 box classes | Larger but sparser, partly machine-verified labels |
| LVIS | Instance masks | COCO images, about 1,200 classes | Long-tail vocabulary on COCO photographs |
| Visual Genome | Scene graphs, regions | About 108,000 images | Focus on relationships and attributes |
Because ImageNet emphasizes classification and COCO emphasizes localization, a common practice is pretraining a backbone on large image collections and then fine-tuning on COCO. Results on COCO are therefore often a measure of how well general visual features transfer to dense prediction.
Known limitations and common mistakes
COCO is carefully built but not error-free, and experienced practitioners treat its labels as a strong but imperfect gold standard. Audits have found missing instances, loose masks and inconsistent category boundaries, which places a ceiling on how meaningful very small score gains are.
- Label noise near the top of the leaderboard: once models exceed about 60 AP, part of the remaining error reflects annotation errors rather than model weakness.
- Closed vocabulary: the 80 categories omit many everyday objects, so strong COCO scores do not guarantee open-world performance.
- Geographic and demographic bias: most photographs come from Flickr users in North America and Europe, and caption studies have shown gender and cultural skew.
- Mixed image licensing: annotations are released under a Creative Commons attribution license, but each image keeps its original Flickr license, which matters for commercial training data.
- Evaluation leakage: tuning hyperparameters repeatedly on val2017 and then reporting val2017 numbers produces optimistic estimates.
A frequent technical mistake is confusing box formats: COCO uses corner plus width and height, while many libraries expect two corner coordinates. Converting incorrectly produces boxes that look plausible but silently degrade training, so a visual check of a sample batch is a sensible safeguard.
The idea in brief
COCO is a big collection of everyday photos with careful labels. People drew boxes around objects, traced their outlines and wrote short descriptions of each scene. A computer can study these examples and learn to find cars, dogs or people in new pictures.
It also works like a shared exam for vision systems. Teams test their models on the same pictures and use the same scoring rules. That makes it easy to see which approach finds objects more accurately.
A practical scenario
A small engineering team at a logistics company needs a model that spots people and forklifts in warehouse camera footage. Collecting and labeling thousands of their own images from scratch would take months, so they start from a detector pretrained on COCO, which already recognizes the person category and many vehicle-like shapes.
The team labels about 2,500 warehouse frames in CVAT, exports them in the COCO JSON format and fine-tunes the detector for a few hours on a single GPU. They evaluate with pycocotools and track AP and APs separately, because distant workers appear as small objects under 32 x 32 pixels.
After fine-tuning, the model reaches production-ready detection quality on their held-out footage, and the team spends its effort on hard cases such as partially hidden workers instead of rebuilding a training pipeline. Reusing the COCO format also lets them swap in newer detector architectures later without relabeling anything.