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.
Below, learn the structure of Pascal VOC 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>
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.
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)
Below, see model architectures that require data in the Pascal VOC XML format when training a new model.
On each page below, you can find links to our guides that show how to plot predictions from the model, and complete other common tasks like detecting small objects with the model.