Pascal VOC XML

Pascal VOC is a common XML annotation format that is human readable but doesn't work with any known object detection models.

Overview

The annotation format originally created for the Visual Object Challenge (VOC) has become a common interchange format for object detection labels. It's well-specified and can be exported from many labeling tools including CVAT, VoTT, and RectLabel.

Unfortunately, no known models directly consume VOC XML labels. That's where Roboflow comes in; it's a universal computer vision format converter that can convert PASCAL VOC into any other format so your data is ready to train in a jiffy.

Format Description

Below, learn the structure of Pascal VOC XML.

img0001.xml
<annotation>
	<folder></folder>
	<filename>000001.jpg</filename>
	<path>000001.jpg</path>
	<source>
		<database>roboflow.ai</database>
	</source>
	<size>
		<width>500</width>
		<height>375</height>
		<depth>3</depth>
	</size>
	<segmented>0</segmented>
	<object>
		<name>helmet</name>
		<pose>Unspecified</pose>
		<truncated>0</truncated>
		<difficult>0</difficult>
		<occluded>0</occluded>
		<bndbox>
			<xmin>179</xmin>
			<xmax>231</xmax>
			<ymin>85</ymin>
			<ymax>144</ymax>
		</bndbox>
	</object>
	<object>
		<name>helmet</name>
		<pose>Unspecified</pose>
		<truncated>0</truncated>
		<difficult>0</difficult>
		<occluded>0</occluded>
		<bndbox>
			<xmin>112</xmin>
			<xmax>135</xmax>
			<ymin>145</ymin>
			<ymax>175</ymax>
		</bndbox>
	</object>
</annotation>

Split and Merge Datasets

With Roboflow supervision, an open source Python package with utilities for completing computer vision tasks, you can merge and split detections in Pascal VOC XML. Read our dedicated guides to learn how to merge and split Pascal VOC XML detections.

Split detections in Pascal VOC XML

Python
import supervision as sv

ds = sv.DetectionDataset.from_pascal_voc(
    images_directory_path=f"dataset/train/images",
    annotations_directory_path=f"dataset/train/labels"
)

train_ds, test_ds = ds.split(split_ratio=0.7,
                             random_state=42, shuffle=True)
len(train_ds), len(test_ds)
# (700, 300)

Supported Models

Below, see model architectures that require data in the Pascal VOC XML format when training a new model.

  • YOLOX is Megvii's anchor-free YOLO detector with decoupled heads and SimOTA assignment, achieving 50.0% AP on COCO at 68.9 FPS on NVIDIA V100.

Start where you are

Speak with an AI expert

Our team will help you start solving business problems on the first call.

  • Solution architecting
  • Live demonstration
  • Pricing and specifications
  • Feasibility assessment

Over 80,000 organizations build with Roboflow.

Rivian
Pella
Chobani
USG Corporation
BNSF Railway
American Woodmark
Outcomes
Patrick Industries
Peer Robotics