voc2012 / README.md
shijli's picture
Add the dataset card
15a6f98 verified
|
Raw History Blame Contribute Delete
7.52 kB
metadata
pretty_name: PASCAL VOC 2012
license: other
license_name: pascal-voc
license_link: https://host.robots.ox.ac.uk/pascal/VOC/voc2012/
language:
  - en
size_categories:
  - 10K<n<100K
task_categories:
  - image-segmentation
  - object-detection
tags:
  - pascal-voc
  - voc2012
  - semantic-segmentation
  - sbd
dataset_info:
  - config_name: detection
    features:
      - name: id
        dtype: string
      - name: image
        dtype: image
      - name: width
        dtype: int32
      - name: height
        dtype: int32
      - name: objects
        struct:
          - name: label
            list:
              class_label:
                names:
                  '0': aeroplane
                  '1': bicycle
                  '2': bird
                  '3': boat
                  '4': bottle
                  '5': bus
                  '6': car
                  '7': cat
                  '8': chair
                  '9': cow
                  '10': diningtable
                  '11': dog
                  '12': horse
                  '13': motorbike
                  '14': person
                  '15': pottedplant
                  '16': sheep
                  '17': sofa
                  '18': train
                  '19': tvmonitor
          - name: bbox
            list:
              list: float32
              length: 4
          - name: difficult
            list: bool
          - name: truncated
            list: bool
          - name: pose
            list: string
    splits:
      - name: train
        num_bytes: 635750358
        num_examples: 5717
      - name: validation
        num_bytes: 635709020
        num_examples: 5823
    download_size: 1341225715
    dataset_size: 1271459378
  - config_name: segmentation
    features:
      - name: id
        dtype: string
      - name: image
        dtype: image
      - name: mask
        dtype: image
    splits:
      - name: train
        num_bytes: 166090210
        num_examples: 1464
      - name: validation
        num_bytes: 164358042
        num_examples: 1449
    download_size: 332295988
    dataset_size: 330448252
  - config_name: segmentation_aug
    features:
      - name: id
        dtype: string
      - name: image
        dtype: image
      - name: mask
        dtype: image
    splits:
      - name: train
        num_bytes: 1112130120
        num_examples: 10582
      - name: validation
        num_bytes: 164358042
        num_examples: 1449
    download_size: 1407690427
    dataset_size: 1276488162
configs:
  - config_name: detection
    data_files:
      - split: train
        path: detection/train-*
      - split: validation
        path: detection/validation-*
  - config_name: segmentation
    data_files:
      - split: train
        path: segmentation/train-*
      - split: validation
        path: segmentation/validation-*
    default: true
  - config_name: segmentation_aug
    data_files:
      - split: train
        path: segmentation_aug/train-*
      - split: validation
        path: segmentation_aug/validation-*

PASCAL VOC 2012

PASCAL VOC 2012, packed once with a config per task view, so that a project can pull the split it needs without unpacking VOCtrainval_11-May-2012.tar and wiring up paths first.

from datasets import load_dataset

seg = load_dataset("shijli/voc2012", "segmentation")            # 1464 train / 1449 val
aug = load_dataset("shijli/voc2012", "segmentation_aug")        # 10582 train / 1449 val
det = load_dataset("shijli/voc2012", "detection")               # 5717 train / 5823 val

Configs

config train val columns
segmentation (default) 1464 1449 id, image, mask
segmentation_aug 10582 1449 id, image, mask
detection 5717 5823 id, image, width, height, objects

id is the original VOC image id (2007_000032), so any row joins back to a local VOC checkout.

VOC 2012 withholds its test annotations, so there is no test split.

Masks are labels, not pictures

A mask pixel's value is the class id. Masks are palette (mode P) PNGs, exactly as VOC ships them: 0 is background, 1–20 are the classes below, and 255 marks the void border, which is excluded from both training and scoring rather than being a 21st class.

import numpy as np
mask = np.array(seg["val"][0]["mask"])   # uint8, values in {0..20, 255}

Do not call .convert("RGB") on a mask: that turns class ids into display colors and destroys the labels. The palette attached to each mask is for viewing only. Several VOC mirrors store masks as RGB, which forces every consumer to reverse the VOC colormap before the labels mean anything; this one does not.

Classes

background (0), then aeroplane, bicycle, bird, boat, bottle, bus, car, cat, chair, cow, diningtable, dog, horse, motorbike, person, pottedplant, sheep, sofa, train, tvmonitor (1–20). The detection config's objects.label is a ClassLabel over the 20 object classes only, with no background entry, so its indices run 0–19.

The augmented split

segmentation_aug is the standard 10582-image train_aug set: the SBD annotations minus every image held out for validation. Its train masks come from SBD, not from VOC. Its val split uses the official VOC masks, the same 1449 images segmentation scores on, so a model trained on the augmented set is measured against the same ground truth as one that was not.

Detection boxes

objects is a struct of parallel lists: label, bbox, difficult, truncated, pose.

r = det["train"][0]
for label, box in zip(r["objects"]["label"], r["objects"]["bbox"]):
    ...

Boxes are [xmin, ymin, xmax, ymax] exactly as the VOC XML gives them, which is 1-indexed and inclusive on both corners. They are not converted, so they compare directly against the original annotation files. The difficult flag is carried through rather than filtered, since whether to drop those objects is the evaluation protocol's decision.

How this was packed

create_dataset.py in this repo is the script that produced these parquet files, from an unpacked VOC2012 folder. Masks that already carry the VOC palette are published byte for byte; the SBD masks, which ship as mode L with the same pixel values, are re-tagged as mode P with the VOC palette so that every config decodes the same way.

Every mask in every split was checked against the source files after packing: all 14944 of them decode to arrays identical to the originals, with the void marker intact.

The same image appears in more than one config, since each config is self-contained. That is deliberate: it means loading segmentation downloads that split alone rather than the whole image pool.

License and attribution

The images come from flickr and remain under the copyright of their respective owners. They are distributed for non-commercial research and educational use under the terms of the PASCAL VOC challenge. This packaging adds no rights: use it under those same terms and cite the original work.

@article{everingham2015pascal,
    title={The Pascal Visual Object Classes Challenge: A Retrospective},
    author={Everingham, Mark and Eslami, S. M. Ali and Van Gool, Luc and
            Williams, Christopher K. I. and Winn, John and Zisserman, Andrew},
    journal={International Journal of Computer Vision},
    volume={111}, number={1}, pages={98--136}, year={2015}
}

The segmentation_aug train masks are from SBD and should be cited separately:

@inproceedings{hariharan2011semantic,
    title={Semantic Contours from Inverse Detectors},
    author={Hariharan, Bharath and Arbelaez, Pablo and Bourdev, Lubomir and
            Maji, Subhransu and Malik, Jitendra},
    booktitle={International Conference on Computer Vision (ICCV)},
    year={2011}
}