Skip to main content

No-code labeling and training toolkit for computer vision

Project description

TrainCV

traincv logo

PyPI Python License

A no-code labeling and training toolkit for computer vision. Train object detection, classification, and segmentation models with minimal code via CLI or Python API.

Supports local HuggingFace models. Pre-trained models can be downloaded from HuggingFace Hub and cached locally for offline training and fine-tuning.

Built by NRL.ai


Installation

# Core (no training backends)
pip install traincv

# With PyTorch backend
pip install traincv[torch]

# With YOLO backend
pip install traincv[yolo]

# Everything
pip install traincv[full]

Quick Start

CLI

# Train an object detection model
traincv train --task detection --data ./dataset --model yolov8n --epochs 50

# Train an image classifier
traincv train --task classification --data ./images --model mobilenetv2

# Export a trained model to ONNX
traincv export --model ./best.pt --format onnx

# Validate dataset format
traincv validate --data ./dataset --format coco

Python API

import traincv

# Train a detector
traincv.train(task="detection", data="./dataset", model="yolov8n", epochs=50)

# Export to ONNX
traincv.export(model="./best.pt", format="onnx")

# Load and inspect a dataset
dataset = traincv.Dataset.load("./dataset", format="coco")
print(dataset.summary())

Supported Tasks

Task Models Backend
Object Detection YOLOv8n/s/m/l/x, YOLOv5 ultralytics
Image Classification MobileNetV2, ResNet18/34/50, EfficientNet-B0 torchvision
Segmentation YOLOv8n/s/m-seg, DeepLabV3 ultralytics / torchvision

Dataset Formats

TrainCV supports the following annotation formats:

Format Description File Type
COCO COCO JSON format .json
YOLO YOLO darknet format .txt per image
VOC Pascal VOC XML format .xml per image

COCO Format

dataset/
  images/
    img001.jpg
    img002.jpg
  annotations/
    instances.json

YOLO Format

dataset/
  images/
    img001.jpg
    img002.jpg
  labels/
    img001.txt
    img002.txt

Pascal VOC Format

dataset/
  JPEGImages/
    img001.jpg
  Annotations/
    img001.xml

Model Zoo

Model Task Size Speed
yolov8n Detection 6.2M Fast
yolov8s Detection 11.2M Fast
yolov8m Detection 25.9M Medium
yolov8l Detection 43.7M Slow
yolov8x Detection 68.2M Slow
mobilenetv2 Classification 3.5M Fast
resnet18 Classification 11.7M Fast
resnet50 Classification 25.6M Medium
efficientnet_b0 Classification 5.3M Fast

Export Formats

Format Extension Use Case
ONNX .onnx Cross-platform inference
TorchScript .torchscript PyTorch production

Configuration

Training parameters can be set via CLI flags, Python kwargs, or a YAML config file:

# config.yaml
task: detection
model: yolov8n
data: ./dataset
epochs: 50
batch_size: 16
lr: 0.001
augmentation: medium
input_size: [640, 640]
device: auto
traincv train --config config.yaml

Data Augmentation

Built-in augmentation presets:

Preset Transforms
light Horizontal flip, slight rotation
medium Flip, rotation, color jitter, scale
heavy Flip, rotation, color jitter, scale, mosaic, mixup

Local-First / Edge AI

This package supports downloading pre-trained models from HuggingFace Hub for offline use. After initial download, no internet connection is required for training or fine-tuning.

# Pre-download a model for offline use
python -m traincv download yolov8n

# Download a classification model
python -m traincv download mobilenetv2 --task classification
import traincv

# Download and cache a model locally
model_path = traincv.download_model("yolov8n")

# Train using the cached model (works offline)
traincv.train(task="detection", data="./dataset", model=str(model_path))

Links

License

MIT License - see LICENSE for details.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

traincv-0.2.0.tar.gz (35.3 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

traincv-0.2.0-py3-none-any.whl (34.1 kB view details)

Uploaded Python 3

File details

Details for the file traincv-0.2.0.tar.gz.

File metadata

  • Download URL: traincv-0.2.0.tar.gz
  • Upload date:
  • Size: 35.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.9

File hashes

Hashes for traincv-0.2.0.tar.gz
Algorithm Hash digest
SHA256 53d142c11978e7a21aefc855a3d3ccd0b3aa8939ca797e20acbb529ae116ee52
MD5 5fbd61f45e4c37d38aa21c11ca240272
BLAKE2b-256 1a353b365d268235da40ed9833e26cebb786660508746df6ccd83526edc12b72

See more details on using hashes here.

File details

Details for the file traincv-0.2.0-py3-none-any.whl.

File metadata

  • Download URL: traincv-0.2.0-py3-none-any.whl
  • Upload date:
  • Size: 34.1 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.9

File hashes

Hashes for traincv-0.2.0-py3-none-any.whl
Algorithm Hash digest
SHA256 5c6b3aa9e2d09709924ab29a8064232b3939060a4effefaf38fde441d6670adc
MD5 4b27d261864a5b5dca3a1ddbe90d064a
BLAKE2b-256 40b0ebb7a74d63e776f3f2450f3a3994fcd6c4dc4c5145fe5dae44707ef8e343

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page