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.4.tar.gz
(17.5 kB
view details)
Built Distribution
modelprep-0.2.4-py3-none-any.whl
(14.2 kB
view details)
File details
Details for the file modelprep-0.2.4.tar.gz
.
File metadata
- Download URL: modelprep-0.2.4.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
Algorithm | Hash digest | |
---|---|---|
SHA256 | 7b2bd40a6d687fe7a4ec39501279eeb4d0caa654f329a9f90ba99f950b77c034 |
|
MD5 | cfee27c6c1fc1439b1d2f7739b7b723f |
|
BLAKE2b-256 | aa04a7de206638befa56d7b430460ff97e1853ebf6ddf4b095344cdfb81618d3 |
File details
Details for the file modelprep-0.2.4-py3-none-any.whl
.
File metadata
- Download URL: modelprep-0.2.4-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
Algorithm | Hash digest | |
---|---|---|
SHA256 | 60d5e8ac075bb5311b9d1d90a2c70d8a1f522aa5592d3b5ecdb89cbf08a9e387 |
|
MD5 | 63d2898d79d065ea51cacd1a831bcfd4 |
|
BLAKE2b-256 | a33068282d636e19978c7edb3a78461723f8f4e3648a55c15dfc1098b5020ede |