Get Started
Dataset Structure
Learn how to organize your computer vision datasets for optimal compatibility with cvPal.
Overview
cvPal supports multiple dataset formats and structures. The recommended structure follows a clean separation of images and labels, with metadata stored in YAML configuration files. This organization ensures compatibility with popular frameworks like YOLO, COCO, and custom formats.
Basic Dataset Structure
The most common and recommended structure for cvPal datasets:
dataset/βββ images/β βββ train/β β βββ image001.jpgβ β βββ image002.jpgβ β βββ ...β βββ test/β β βββ image101.jpgβ β βββ image102.jpgβ β βββ ...β βββ valid/β βββ image201.jpgβ βββ image202.jpgβ βββ ...βββ labels/β βββ train/β β βββ image001.txtβ β βββ image002.txtβ β βββ ...β βββ test/β β βββ image101.txtβ β βββ image102.txtβ β βββ ...β βββ valid/β βββ image201.txtβ βββ image202.txtβ βββ ...βββ data.yaml
π Images Folder
Contains all image files organized by split (train/test/valid). Supports JPG, PNG, and other common formats.
π·οΈ Labels Folder
Contains corresponding label files in TXT or JSON format. Each label file matches an image file.
βοΈ data.yaml
Configuration file containing dataset metadata, class names, and paths to training/validation sets.
YAML Configuration File
The data.yaml file contains essential metadata about your dataset:
Example data.yaml
# Dataset configurationnames:- cat- dog- birdnc: 3 # number of classes# Dataset pathstrain: images/trainval: images/validtest: images/test# Optional: Additional metadataroboflow:license: Privateproject: animal-detectionurl: https://universe.roboflow.com/your-projectversion: 1workspace: your-workspace# Optional: Dataset infoinfo:description: "Animal detection dataset with cats, dogs, and birds"version: "1.0"created: "2024-01-01"author: "Your Name"
Required Fields
names- List of class namesnc- Number of classestrain- Path to training imagesval- Path to validation images
Optional Fields
test- Path to test imagesroboflow- Roboflow metadatainfo- Additional dataset info
Label Formats
cvPal supports multiple label formats. Choose the one that best fits your workflow:
TXT Format (YOLO)
Each line represents one object: class_id x_center y_center width height
# image001.txt0 0.5 0.3 0.2 0.4 # cat at center-left1 0.7 0.6 0.15 0.3 # dog at bottom-right# image002.txt2 0.2 0.8 0.1 0.2 # bird at bottom-left
Note: All coordinates are normalized (0-1) relative to image dimensions.
JSON Format (COCO)
Structured format with detailed annotations and metadata:
{"images": [{"id": 1,"file_name": "image001.jpg","width": 640,"height": 480}],"annotations": [{"id": 1,"image_id": 1,"category_id": 1,"bbox": [100, 50, 200, 150],"area": 30000,"iscrowd": 0}],"categories": [{"id": 1,"name": "cat","supercategory": "animal"}]}
Alternative Structures
cvPal also supports other common dataset organizations:
Flat Structure
All images and labels in single directories:
dataset/βββ images/β βββ image001.jpgβ βββ image002.jpgβ βββ ...βββ labels/β βββ image001.txtβ βββ image002.txtβ βββ ...βββ data.yaml
Paired Structure
Images and labels in the same directory:
dataset/βββ image001.jpgβββ image001.txtβββ image002.jpgβββ image002.txtβββ data.yaml
Best Practices
β Do
- β’ Use consistent naming conventions
- β’ Keep images and labels synchronized
- β’ Include comprehensive YAML metadata
- β’ Validate label coordinates (0-1 range)
- β’ Use meaningful class names
- β’ Organize by train/test/valid splits
β Don't
- β’ Mix different label formats
- β’ Use absolute pixel coordinates in TXT
- β’ Skip the data.yaml file
- β’ Use spaces in file names
- β’ Have mismatched image/label pairs
- β’ Forget to update class counts
Quick Start
Using cvPal with Your Dataset
from cvpal.preprocessing import ImagesDetection# Load your datasetcp = ImagesDetection()cp.read_data("/path/to/your/dataset", data_type="txt")# Generate a reportcp.report()# Merge with another datasetcp.merge_datasets(["/path/to/dataset1","/path/to/dataset2"])