docs/en/datasets/detect/voc.md
The PASCAL VOC (Visual Object Classes) dataset is a classic object detection benchmark with 20 everyday object classes. The Ultralytics VOC.yaml configuration combines the VOC2007 and VOC2012 trainval splits into a 16,551-image training set, validates on the 4,952 publicly annotated VOC2007 test images, and downloads everything automatically (2.8 GB) on first use.
<strong>Watch:</strong> How to Train Ultralytics YOLO on the Pascal VOC Dataset | Object Detection | Computer Vision 🚀
</p>The PASCAL VOC challenges ran from 2005 to 2012 and shaped how object detection models are evaluated: the benchmark spans image classification, detection, and segmentation tasks, and popularized mean Average Precision (mAP) as the standard detection metric. The Ultralytics VOC.yaml configuration uses the detection annotations, converting the original XML bounding boxes to YOLO format during download.
The Ultralytics VOC.yaml configuration defines the following splits:
| Split | Images | Source |
|---|---|---|
| Train | 16,551 | VOC2007 trainval (5,011) + VOC2012 trainval (11,540) |
| Validation | 4,952 | VOC2007 test, used for evaluation during training |
| Test | 4,952 | The same VOC2007 test images — the config defines no separate held-out split |
VOC2007 test annotations were released publicly after that year's challenge, which is what allows this split to serve as a labeled validation set. VOC2012 test annotations remain withheld — results on them can only be scored through the official PASCAL evaluation server — so they are not part of this configuration.
!!! note "Difficult objects excluded"
The automatic converter skips objects flagged `difficult` in the original VOC XML annotations, so per-class instance counts differ slightly from official VOC statistics.
Explore VOC on Ultralytics Platform to browse the images with their annotation overlays, view the class distribution and bounding-box heatmaps in the Charts tab, and clone it to train your own model in the cloud.
PASCAL VOC was the primary benchmark for object detection research in the years before the larger COCO dataset: detectors such as Faster R-CNN and SSD reported their original results on it, and Ultralytics YOLO models train on it out of the box. Today it remains popular for:
The VOC.yaml file defines the dataset configuration — the dataset paths, the 20 class names, and the automatic download-and-convert script. It is maintained in the Ultralytics repository at https://github.com/ultralytics/ultralytics/blob/main/ultralytics/cfg/datasets/VOC.yaml.
!!! example "ultralytics/cfg/datasets/VOC.yaml"
```yaml
--8<-- "ultralytics/cfg/datasets/VOC.yaml"
```
!!! note "2.8 GB download"
VOC downloads automatically the first time you train — three archives totaling 2.8 GB — and needs roughly 6 GB of free disk space during extraction and conversion.
To train a YOLO26n model on the VOC dataset for 100 epochs with an image size of 640, you can use the following code snippets. For a comprehensive list of available arguments, refer to the model Training page.
!!! example "Train Example"
=== "Python"
```python
from ultralytics import YOLO
# Load a model
model = YOLO("yolo26n.pt") # load a pretrained model (recommended for training)
# Train the model - dataset will auto-download on first run
results = model.train(data="VOC.yaml", epochs=100, imgsz=640)
```
=== "CLI"
```bash
# Start training from a pretrained *.pt model
# Dataset will auto-download and convert on first run
yolo detect train data=VOC.yaml model=yolo26n.pt epochs=100 imgsz=640
```
The image below shows a mosaiced training batch from the VOC dataset. Mosaicing combines multiple images into a single training sample, increasing the variety of objects, scales, and scene contexts the model sees in each batch — see the YOLO data augmentation guide for details.
If you use the VOC dataset in your research or development work, please cite the following paper:
!!! quote ""
=== "BibTeX"
```bibtex
@article{everingham2010pascal,
author={Everingham, Mark and Van Gool, Luc and Williams, Christopher K. I. and Winn, John and Zisserman, Andrew},
journal={International Journal of Computer Vision},
title={The Pascal Visual Object Classes (VOC) Challenge},
year={2010},
volume={88},
number={2},
pages={303-338},
doi={10.1007/s11263-009-0275-4}}
```
We would like to acknowledge the PASCAL VOC Consortium for creating and maintaining this valuable resource for the computer vision community. For more information about the VOC dataset and its creators, visit the PASCAL VOC dataset website.
PASCAL VOC is used to train and benchmark object detection models on 20 everyday object classes such as person, car, dog, and chair. Because it is compact, fully labeled, and backed by years of published baselines, it is a common choice for validating new architectures, running coursework experiments, and quick transfer learning studies.
The Ultralytics VOC configuration contains 21,503 images: 16,551 for training (VOC2007 trainval + VOC2012 trainval) and 4,952 for validation (the VOC2007 test set). All splits share the same 20 classes. See Dataset Structure for the full breakdown.
VOC downloads automatically the first time you train with data="VOC.yaml" — no manual steps are required. The script fetches three archives (2.8 GB) from Ultralytics GitHub release assets and converts the XML annotations to YOLO format.
Train a YOLO26n model on VOC for 100 epochs at an image size of 640:
!!! example "Train Example"
=== "Python"
```python
from ultralytics import YOLO
# Load a model
model = YOLO("yolo26n.pt") # load a pretrained model (recommended for training)
# Train the model
results = model.train(data="VOC.yaml", epochs=100, imgsz=640)
```
=== "CLI"
```bash
# Start training from a pretrained *.pt model
yolo detect train data=VOC.yaml model=yolo26n.pt epochs=100 imgsz=640
```
For detailed configurations, see the Training page and model training tips.
Both challenges share the same 20 classes but contribute different images. VOC2007 provides 5,011 trainval images plus a 4,952-image test set whose annotations are public; VOC2012 provides 11,540 trainval images, while its test annotations are withheld and scored only by the official evaluation server. The Ultralytics VOC.yaml merges both trainval sets for training and validates on VOC2007 test.
VOC is smaller and simpler: 20 classes and 21,503 images versus COCO's 80 classes and 330K images. VOC results are traditionally reported as mAP at 0.5 IoU, while COCO averages mAP over IoU thresholds from 0.5 to 0.95. VOC trains much faster and suits quick experiments; the COCO dataset is the standard for production-scale benchmarking.
No — VOC.yaml is a detection-only configuration: its converter extracts bounding boxes from the VOC XML annotations, and the segmentation masks included in the original benchmark are not converted. To train an instance segmentation model, use a dataset with polygon labels such as COCO-Seg with a yolo26n-seg.pt model.