Folder layout
- The folders must be named
imagesandmasksand sit side by side, next to the labels CSV. - Masks are PNG files named
<image stem>_mask.png. Every image needs a mask and every mask needs an image. - Masks must be readable images with exactly the same width and height as the images. Use single-channel (grayscale) PNGs whose pixel values are class indices
0toN-1, where N is the number of classes (seeimage_labelbelow). - Images share one extension (
.jpg,.jpegor.png; default.jpg) and one resolution. Nothing is resized at ingest.
Labels CSV
The number of classes, N, is the number of distinct
image_label values in the dataset. A model links to the dataset only if its output classes equal N, and training reads mask pixel values 0 to N-1 as those classes. If 0 is background, background is one of the N classes, so background must appear as an image_label value too.
Training reads each CSV row as one sample. An image listed on several rows is trained on once per row and can end up in both the training and validation split, so list each image once where you can.
Ingest with the tracebloc CLI
--label-column is required. The CLI stages masks/ and declares mask_id for you. It reads the image size from the first image; pass --target-size WxH to override it.
ingest.yaml
What the ingestor checks
Plus the checks every ingest runs. A record is copied only when both its image and its mask copy succeed.
Size limit
Onetracebloc data ingest takes at most 1 GiB in total and 500 MiB per file, masks included. If your dataset is larger:
- Save the images as JPEG instead of PNG (masks stay PNG).
- Lower the resolution: resize every image and its mask to one smaller size. Resize masks with nearest-neighbour resampling so their pixel values stay valid class indices.
- Use fewer images.
Sample dataset
The template ships three 512×512 RGB JPEG images, three matching single-channel PNG masks and a three-row labels CSV (road, building, person). The ingest.yaml above ingests it with no overrides. Use it to try ingestion only: its masks use pixel values 0 to 8, while the CSV names three classes, so it is not a valid training set.
Next steps
- Ingest the data: Prepare Data
- Shared rules for every template: Dataset templates