Skip to main content

No-code labeling and training toolkit for computer vision

Project description

TrainCV

No-code computer vision training

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.2.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.2-py3-none-any.whl (34.1 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: traincv-0.2.2.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.2.tar.gz
Algorithm Hash digest
SHA256 47303d4e9465fc622911304f52dbd522d47509aa7a0f50a91dceccbbe9d7e67d
MD5 5c6ef6451c9cc25c8cd88812ed9805d6
BLAKE2b-256 79706544246925bbf015b1e5aecbbf9a24a3c6c98db756efbc342bbd5a33bbf2

See more details on using hashes here.

File details

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

File metadata

  • Download URL: traincv-0.2.2-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.2-py3-none-any.whl
Algorithm Hash digest
SHA256 0beae08892d51bcef1e5e5f12724e8e2b22f8b793ebf324aa7c15bcdeda23cfd
MD5 8fcbe02cd2cb63dd8941f16c96b77e49
BLAKE2b-256 e2e761c552ab2e3f54f34506580d949a57ae427996814c6b3cf2da25b922fda8

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