Pascal VOC annotation format
An XML file of labeled boxes for every image, segmentation masks as PNG by class and by object, and text lists of the train and val images.
- Data
- Images
- Labels
- BoxesMasks
- Files
.xml, .png- Import / export
- Yes / Yes
What is the Pascal VOC format?
Pascal VOC is the format of the PASCAL Visual Object Classes project, which published standardised image datasets for object class recognition with tools to read their annotations, and ran challenges from 2005 to 2012.
Each image has an XML file in Annotations with the image size and an <object> per instance: the class <name> and a <bndbox> with xmin, ymin, xmax and ymax in pixels. Segmentation is stored as PNG masks: SegmentationClass colors pixels by class and SegmentationObject by instance. ImageSets lists which images belong to train and val.
Folder structure and an example
VOCdevkit
└── VOC2012
├── Annotations
├── ImageSets
│ ├── Main
│ └── Segmentation
├── JPEGImages
├── SegmentationClass
├── SegmentationObject
└── colors.txt<annotation>
<filename>IMG_1836.jpg</filename>
<size>
<width>1067</width>
<height>800</height>
<depth>3</depth>
</size>
<segmented>1</segmented>
<object>
<name>lemon</name>
<bndbox>
<xmin>752</xmin>
<ymin>421</ymin>
<xmax>1009</xmax>
<ymax>588</ymax>
</bndbox>
</object>
</annotation>neutral 224 224 192
kiwi 255 0 0
lemon 81 198 170Import and export Pascal VOC in Supervisely
Import Pascal VOC into Supervisely
- Import data (Auto Import)
Reads
.xmlboxes and.pngsegmentation masks from aVOCdevkitfolder or archive. - Import Pascal VOC
Imports the original Pascal VOC datasets or a custom one from Team Files. A custom dataset needs
colors.txt; Action and Layout image sets are not supported.
Export from Supervisely to Pascal VOC
- Export to Pascal VOC
Exports polygon, bitmap and rectangle classes: boxes to XML, polygons and bitmaps also to
SegmentationClassandSegmentationObjectmasks, withcolors.txt. Other shapes and other image tags are skipped. - Python SDK
sly.convert.project_to_pascal_voc()converts a downloaded project.
All apps are in the Ecosystem, under Import and Export. Every project is stored in Supervisely JSON in between.
Converting Pascal VOC to and from Supervisely JSON
| Pascal VOC | Supervisely JSON | Notes |
|---|---|---|
<object><name> | class title | One class per object name. |
<bndbox> xmin ymin xmax ymax | rectangle [[xmin, ymin], [xmax, ymax]] | Pixel corners on both sides. |
SegmentationObject PNG | bitmap, one per instance | The class of each instance comes from its color in SegmentationClass and colors.txt. |
SegmentationClass, SegmentationObject PNG | polygon, bitmap | On export, polygons and bitmaps are drawn into both masks. |
ImageSets/Main train, val | image tags train, val | Without these tags the export splits the images 80% train, 20% val. |