Datasets:
Tasks:
Image Segmentation
Modalities:
Image
Formats:
imagefolder
Languages:
English
Size:
< 1K
License:
|
Download docs/UNIFIED_SCHEMA.md from COT5415/COT5415_Computer_Vision: direct link, hf CLI and curl.
- Browser
- Download file 7.13 kB
-
https://huggingface.co/datasets/COT5415/COT5415_Computer_Vision/resolve/main/docs/UNIFIED_SCHEMA.md
- Command line
-
hf download hf://datasets/COT5415/COT5415_Computer_Vision/docs/UNIFIED_SCHEMA.md
-
curl -L -o UNIFIED_SCHEMA.md https://huggingface.co/datasets/COT5415/COT5415_Computer_Vision/resolve/main/docs/UNIFIED_SCHEMA.md
7.13 kB
| # Unified part-whole annotation v1 | |
| Each JSONL line describes one image. Paths are relative to the project root; moving the entire project does not require rewriting annotations. `schema.json` is the machine-readable record contract. | |
| Required record fields: `schema_version`, `dataset`, `split`, `image_id`, `image_path`, `image_available`, `width`, `height`, `source_path`, `hierarchy_semantics`, and `nodes`. | |
| Each node contains a unique image-local `id`, optional `parent_id`, `level`, `kind` (`whole` or `part`), dataset-namespaced `category`, `source_label_id`, `provenance`, raster `area`, and a COCO compressed RLE `mask` (`size: [height,width]`, ASCII `counts`). Original image IDs and split assignments are preserved. Numeric class IDs are never compared across datasets without an explicit mapping. | |
| ## PartImageNet | |
| A part node corresponds to one original COCO annotation. Its original annotation ID and segmentation geometry are retained. Whole nodes are unions of decoded masks sharing a source supercategory; this derivation is identified by provenance. Category grouping does not manufacture object instance IDs or additional anatomical levels. | |
| `mask_status` distinguishes valid geometry from invalid or partly invalid source geometry. Fewer than three polygon vertices cannot define an area. Such components are retained as raw geometry, flagged, and excluded from rasterization; valid components are still preserved. An all-invalid polygon has an empty placeholder raster, which is never exposed as a usable part mask by `UnifiedDataset.__getitem__`. The original polygon remains in `record()` for inspection. The checker reports these source defects separately from conversion errors. | |
| ## Pascal-Part | |
| The supplied data contains integer part PNGs and integer whole PNGs, without a category-name or ignore-label table. All numerical values are retained. Whole nodes represent each whole-label region; part nodes represent each nonempty intersection of a part label with a whole label. Thus a single semantic part label can appear below more than one parent without guessing which pixels belong to an instance. | |
| Both source rasters can be recovered exactly: assign each whole node's source_label_id to its mask, and do the same for part nodes. Validation requires pixel equality and exactly one covering node at each raster level. No background label is silently removed. Naming labels or excluding background for training requires an authoritative mapping; the converter does not invent one. | |
| ## PACO-LVIS | |
| Source: the official `paco_lvis_v1.zip` annotations (train/val/test JSON, COCO format) and the COCO 2017 images they reference, stored at `datasets/COCO/<train2017|val2017>/`. The official PACO splits are kept; they are image-disjoint, and the PACO test split draws from both COCO train2017 and val2017. | |
| Unlike the other two sources, PACO-LVIS has real instance-level links. Every LVIS object annotation becomes a level-0 `whole` node `object:<annotation id>`. Every part annotation becomes a level-1 `part` node `part:<annotation id>` whose `parent_id` is taken only from the source `obj_ann_id`; parents are never inferred from overlap. `hierarchy_semantics` is `instance_object_part_links_from_source_obj_ann_id`. | |
| Object masks are rasterized from the source polygons, which are kept in `source_segmentation`. Part masks are the source compressed RLE copied verbatim. Each node also keeps `source_annotation_id`, `source_area`, `source_bbox`, and the PACO attribute fields (`attribute_ids`, `dom_color_ids`, `unknown_*`) under `source_attributes`; parts keep `source_iscrowd`. Each record keeps every other source image field under `source_image_metadata`, including `neg_category_ids`, `not_exhaustive_category_ids` and their `_attrs` counterparts, so LVIS federated-evaluation semantics are not lost. Categories are `PACO-LVIS/whole/<name>` and `PACO-LVIS/part/<object>:<part>`; the full category, part, attribute and object-attribute tables are in `datasets/unified/PACO-LVIS/label_metadata.json`. | |
| PACO parts and LVIS objects were drawn independently, so many part masks extend a few pixels beyond their object's mask. These pixels are kept unchanged. Each part records the overflow as `outside_parent_area`; validation recomputes it, and any mismatch is a conversion error. The overflow itself is reported as a source property, not a conversion error. PartImageNet and Pascal-Part nodes have no such field, and any overflow there is still a conversion error. | |
| ## Shared loader | |
| ```python | |
| from pathlib import Path | |
| from torch.utils.data import DataLoader | |
| from partwhole import UnifiedDataset | |
| root = Path(r'D:\Projects\Computer_Vision_Project') | |
| dataset = UnifiedDataset(root / 'datasets/unified/PartImageNet/val.jsonl', root) | |
| sample = dataset[0] | |
| # sample: record, RGB PIL image, valid masks keyed by node ID, invalid_node_ids | |
| loader = DataLoader(dataset, batch_size=2, collate_fn=list, num_workers=0) | |
| ``` | |
| Images are read with EXIF orientation applied, matching the annotation coordinate dimensions. Original image bytes are preserved. Six PartImageNet images require this orientation handling. | |
| `record(index)` reads metadata without loading images or masks. `dataset[index]` fails visibly if the image is missing; it does not silently skip the record. Variable image sizes and node counts are kept as a list in DataLoader. This is a data-loading API, not a finalized training target or tokenizer. | |
| ## Validation and quality report | |
| Validation checks the JSON schema, safe file references, image and mask dimensions, image/node ID uniqueness, parent references, root/child roles, levels, cycles, mask areas, part containment, split identity, original annotation coverage and categories, COCO mask equivalence for decodable geometry, raw geometry retention, and exact Pascal raster reconstruction. | |
| `conversion_integrity_passed` reports conversion consistency. `passed` additionally requires no missing images, no source geometry defects, and no duplicate image paths across splits. Unresolved source issues remain visible and produce a nonzero strict validation exit code. Empty source masks are counted in the conversion summary; they are not replaced with invented content. | |
| ## Source-backed Pascal metadata (2026-11-01) | |
| The supplied PNG archive itself has no name table. A sidecar table has now been reconstructed from the original author-verified named MAT archive and checked against all 9,425 current images. categories.json adds display_name and is_background without changing numeric category keys or JSONL masks. Background is whole=16, part=54; no ignore code occurs in the processed PNGs. See docs/data/PASCAL_LABELS.md and datasets/unified/Pascal-Part/label_metadata.json. | |
| Raster containment is distinct from semantic parent correctness. The named audit identifies source PNG class conflicts in 512 train and 547 val images; those intersections remain preserved and are flagged in results/preparation/pascal_semantic_quality.json. Do not interpret conversion_integrity_passed as a claim that every source semantic relation is correct. No source pixels were repaired or relabelled. | |