Skip to main content

A CLI tool for managing and analyzing image datasets for model training

Project description

ModelPrep

A command-line tool for managing image datasets, optimized for training object detection models.

Installation

# Quick install
pip install modelprep

# Development install
make develop

Commands

Dataset Management

# Show dataset information
modelprep show                  # Show all images and their properties
modelprep show --small-images   # Show only small images (<32x32)

# Remove images
modelprep remove --small-images # Remove small images (<32x32)

Person Crop Operations

# Create and manage person crops
modelprep person-crop create --padding 20          # Create person crops with 20% padding
modelprep person-crop show                         # Show all person crops
modelprep person-crop show --sort-by-size          # Sort by size (large to small)
modelprep person-crop show --sort-by-size --reverse # Sort by size (small to large)

# Manage small person crops
modelprep person-crop show-small --min-size-kb 10 --min-pixels 100   # Preview small crops
modelprep person-crop remove-small --min-size-kb 10 --min-pixels 100 # Remove small crops

# Dataset integration
modelprep person-crop add-to-dataset --train-split 0.7 --valid-split 0.2 --test-split 0.1
modelprep person-crop remove-from-dataset

Training YOLOv8 Models

# Basic training (auto-names with current date)
modelprep train

# Model size options
modelprep train --size nano    # Fastest training
modelprep train --size small   # Default
modelprep train --size medium  # Better accuracy
modelprep train --size large   # High accuracy
modelprep train --size xlarge  # Best accuracy

# Advanced training options
modelprep train \
    --size medium \           # Model size
    --epochs 300 \           # Number of epochs
    --batch 256 \            # Batch size (adjust for GPU)
    --img 640 \              # Image size
    --device 0 \             # GPU device (empty for auto)
    --project "my_project" \ # Project name
    --name "exp1"            # Experiment name

# Training management
modelprep train --resume                                    # Resume from last checkpoint
modelprep train --weights "runs/train/Nov14/weights/best.pt" # Resume from specific weights
modelprep train --val-only --weights "runs/train/best.pt"    # Validation only
modelprep train --nohup                                      # SSH-safe training

# Start training
modelprep train --nohup  # Creates nohup_train_Nov14.py and nohup_train_Nov14.log

# Monitor training
modelprep status                    # Show latest training status
modelprep status --name Nov14       # Show specific training status
modelprep status --follow           # Follow log output (like tail -f)
modelprep status -f -n Nov14 -n 100 # Follow specific training, show 100 lines

Roboflow Integration

# Project management
modelprep roboflow create-project --project-name "my_project" \
    --project-type "object-detection" \
    --project-license "CC BY 4.0" \
    --annotation "object-detection"

# Upload datasets
modelprep roboflow upload --project-name "my_project" --dataset-name "person-crops"

Features

  • Complete dataset management and analysis
  • Automated person cropping with annotation adjustment
  • Size-based filtering and sorting
  • YOLOv8 training optimized for small object detection
  • SSH-safe training with nohup
  • Roboflow integration for dataset management
  • Rich CLI output with formatted tables

Requirements

  • Python 3.7+
  • Ultralytics (YOLOv8)
  • Pillow (PIL)
  • Typer
  • Rich
  • Roboflow
  • python-dotenv
  • tqdm

Development

# Installation
make help     # Show all make commands
make develop  # Install for development
make install  # Install for production
make clean    # Clean up everything
make format   # Format code

# Testing
make test              # Run all tests
make test-ci          # Run tests with coverage report
pytest tests/ -v      # Run tests directly

# Release Management
make release          # Create a new release

Testing

# Install test dependencies
pip install -e

License

MIT License

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

modelprep-0.2.5.tar.gz (17.5 kB view details)

Uploaded Source

Built Distribution

modelprep-0.2.5-py3-none-any.whl (14.2 kB view details)

Uploaded Python 3

File details

Details for the file modelprep-0.2.5.tar.gz.

File metadata

  • Download URL: modelprep-0.2.5.tar.gz
  • Upload date:
  • Size: 17.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.1 CPython/3.9.20

File hashes

Hashes for modelprep-0.2.5.tar.gz
Algorithm Hash digest
SHA256 a878496ba96028d9a99138d615ca7d69db18ef533b16ed2fa481bc8b13e91cf5
MD5 b2c09ff0e993619f9084e531466bdb96
BLAKE2b-256 48b8c4307fbb7ba165e54915f303f0b4ea6250b8c0039715ce873b29b91bcb91

See more details on using hashes here.

File details

Details for the file modelprep-0.2.5-py3-none-any.whl.

File metadata

  • Download URL: modelprep-0.2.5-py3-none-any.whl
  • Upload date:
  • Size: 14.2 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.1 CPython/3.9.20

File hashes

Hashes for modelprep-0.2.5-py3-none-any.whl
Algorithm Hash digest
SHA256 1119ace3d90f59ed070786de3dbb33713aa84b4a451d2771d902b5f7b59dafb5
MD5 b34ea3c8af2d30430863f1411a67c589
BLAKE2b-256 90a470911068c8af6ea914d2be40d8b2618a7f4131bd8735249670405ac4c060

See more details on using hashes here.

Supported by

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