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

Uploaded Python 3

File details

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

File metadata

  • Download URL: traincv-0.2.1.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.1.tar.gz
Algorithm Hash digest
SHA256 dfb0b23c18552185d3e9479bd107b36e39fb6091b6051f51f767822b15d3dfa7
MD5 c3d32a149d8aadd1c21ca930ceef1944
BLAKE2b-256 552ee9172c9ad9371459eec5ecf0b6bb535cc6f6a6a373f44720ebd341f8178a

See more details on using hashes here.

File details

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

File metadata

  • Download URL: traincv-0.2.1-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.1-py3-none-any.whl
Algorithm Hash digest
SHA256 a2e9f2ce87012b3f96fbb7b067720d22bba2d8462fb4675caf9e5856730dcd84
MD5 cc4141021b5ce9b8a5ceb55d8171b348
BLAKE2b-256 0d3bb8c20f63ed2701aaf93d952070097cf77f208538ae82d82d40e50c88b98e

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