Skip to content
Back to skills

Data Preparation

ASecurity

"Guides Mask_RCNN dataset subclassing, mask formats, sample dataset

  • 247 stars
  • 0 votes
  • 0 copies
  • 3 views
  • Added September 8, 2026
documentationpythongodocumentation

Security analysis

A100/100

Pro scans all 6 files and shows the line behind each finding

Scanned September 8, 2026

npx -y skills add VectorSpaceLab/AREX-Skill --skill data-preparation --agent claude-code

Installs into .claude/skills of the current project.

Are you the author of Data Preparation?

Add the live security badge to your README. It updates with every re-scan.

Security grade badge for Data Preparation
[![Security: A — Skills Directory](https://www.skillsdirectory.com/api/skills/vectorspacelab-data-preparation-fcf79cce/badge)](https://www.skillsdirectory.com/skills/vectorspacelab-data-preparation-fcf79cce)

More formats (shields.io, HTML) on the badges page. Keep it an A: scan every change in CI with Pro.

Download with Pro
SKILL.md
---
name: data-preparation
description: "Guides Mask_RCNN dataset subclassing, mask formats, sample dataset
  layouts, validation, resizing, and synthetic fixtures."
disable-model-invocation: true
metadata:
  disco-role: operating
license: NOASSERTION
---

# Data Preparation

Use this sub-skill when a task asks how to prepare images, masks, polygons, COCO annotations, VIA JSON, nucleus challenge folders, or custom `mrcnn.utils.Dataset` subclasses for Mask_RCNN.

## Read first by need

- Read [dataset-contract.md](references/dataset-contract.md) for the `Dataset` subclass lifecycle and mask/image requirements.
- Read [data-formats.md](references/data-formats.md) for Shapes, Balloon/VIA, COCO, and Nucleus layouts.
- Read [troubleshooting.md](references/troubleshooting.md) when masks are empty, classes mismatch, polygons fail, or image sizes are wrong.
- Run [scripts/validate_dataset_layout.py](scripts/validate_dataset_layout.py) to check known sample layout conventions without importing Mask_RCNN.
- Run [scripts/generate_shapes_fixture.py](scripts/generate_shapes_fixture.py) to create a tiny synthetic fixture for smoke tests or documentation examples.

## Dataset preparation workflow

1. Subclass `mrcnn.utils.Dataset`.
2. In a loader method, call `add_class(source, class_id, class_name)` and `add_image(source, image_id, path, **metadata)` for each image.
3. Implement `load_mask(image_id)` to return:

   ```python
   mask: np.ndarray  # shape [height, width, instance_count], bool or 0/1
   class_ids: np.ndarray  # shape [instance_count], dtype int32
   ```

4. Override `load_image()` only when images are generated or not stored as ordinary files.
5. Call `dataset.prepare()` before using `dataset.image_ids`, `class_names`, `source_class_ids`, `load_image_gt`, training, or visualization.
6. Use `mrcnn.model.load_image_gt(dataset, config, image_id, augmentation=..., use_mini_mask=...)` to check the full preprocessing path.

## Data-specific routes

- **VIA polygons / Balloon-style one-class dataset**: validate folder split and `via_region_data.json`; read [data-formats.md](references/data-formats.md#balloon--via-polygons).
- **COCO**: validate `annotations/instances_<subset><year>.json` plus `<subset><year>/` images; pycocotools is required for actual loading and evaluation.
- **Nucleus / Data Science Bowl**: validate `<image_id>/images/<image_id>.png` and optional `<image_id>/masks/*.png`; RLE output is owned by [inference-evaluation](../inference-evaluation/SKILL.md).
- **Synthetic Shapes**: use generated shapes for quick data-pipeline checks; do not treat them as proof of real dataset quality.

## Boundary notes

This sub-skill validates and explains data. For training schedules, layer choices, checkpoints, and weight loading, route to [training](../training/SKILL.md). For prediction outputs, COCO AP, visualization, color splash, or RLE submission files, route to [inference-evaluation](../inference-evaluation/SKILL.md).

Files in this skill

  • SKILL.md2.9 KB
  • references/data-formats.md3.1 KB
  • references/dataset-contract.md3.7 KB
  • references/troubleshooting.md2.6 KB
  • scripts/generate_shapes_fixture.py4.1 KB
  • scripts/validate_dataset_layout.py5 KB

Attribution

Is this your skill, or is something wrong with this listing? Request removal or report an issue. Author removals are honored within 72 hours.

Comments

Loading comments…

Newsletter

Get the weekly list of safe new skills, and the ones we pulled.