Skip to main content

A package for training and testing image classification models using PyTorch.

Project description

FAI-Trainer

FAI-Trainer, the ultimate one-liner for image classification tasks in PyTorch! This user-friendly Python package simplifies the entire data preparation and model training process, allowing you to focus on what matters most - developing accurate models.

With FAI-Trainer, you can effortlessly convert your images into a format that's perfect for machine learning, resize them to the ideal size, and even eliminate duplicate images from your dataset. And if you're worried about splitting your data into training and validation sets? Don't be! FAI-Trainer takes care of that too.

Also: with just a a single line of code, you can train a powerful ResNet50 model using PyTorch and torchvision. No more tedious setup or manual configuration required. Just load your dataset, specify some basic parameters, and let FAI-Trainer do the rest.

Whether you're a seasoned AI expert needing a quick trained model turnaround or just starting out with deep learning, FAI-Trainer is designed to make image classification tasks easier than ever before.

Authors: Nizamuddin Mohamed (@webnizam) GitHub: webnizam | Michael Stattelman (@mstatt) GitHub: mstatt

Features

  • Data Preparation: Convert image formats, resize images, remove duplicates, and ensure no corrupted images.
  • Dataset Splitting: Automatically split datasets into training and validation sets with a specified ratio.
  • Model Training: Train a ResNet50 model on the prepared dataset with configurable batch size, number of epochs, and image dimensions.
  • Progress Tracking: Visual progress tracking for both training and validation phases.
  • Model Testing: Load a trained model to test on a specific image or the validation dataset, and save the results.

Installation

To install the FAI-Trainer package, use pip:

pip install fai-trainer

Usage

Data Preparation and Model Training

To run both data preparation and model training in sequence:

fai-trainer --prepare-data --train --batch-size 32 --epochs 3 --image-size 96 96

Model Testing

To test the model on a specific image:

fai-trainer --test --image-path path/to/your/image.jpg --image-size 96 96

Directory Structure

Ensure your dataset directory has the following structure:

datasets/
├── class1/
│   ├── image1.jpg
│   ├── image2.jpg
│   └── ...
├── class2/
│   ├── image1.jpg
│   ├── image2.jpg
│   └── ...
└── class3/
    ├── image1.jpg
    ├── image2.jpg
    └── ...

Directory Clean up

To clean up any prior processing or training:

fai-trainer --clean

Contributing

Contributions are welcome! Please open an issue or submit a pull request on GitHub.

©️2024 Falcons.AI | Vition.AI

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

fai_trainer-0.4.2.tar.gz (12.2 kB view details)

Uploaded Source

Built Distribution

fai_trainer-0.4.2-py3-none-any.whl (14.0 kB view details)

Uploaded Python 3

File details

Details for the file fai_trainer-0.4.2.tar.gz.

File metadata

  • Download URL: fai_trainer-0.4.2.tar.gz
  • Upload date:
  • Size: 12.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.0 CPython/3.9.19

File hashes

Hashes for fai_trainer-0.4.2.tar.gz
Algorithm Hash digest
SHA256 6514027fa8f531d31396b93050246fa39dd52e4f77a7a6f96a2564f53e0d9065
MD5 5f79af213feb673e4d0d94ba217d2042
BLAKE2b-256 14c9232b0ba581d8ee23003c2ecc74446eaf48de4e5e13afdf98623d9b53de25

See more details on using hashes here.

File details

Details for the file fai_trainer-0.4.2-py3-none-any.whl.

File metadata

  • Download URL: fai_trainer-0.4.2-py3-none-any.whl
  • Upload date:
  • Size: 14.0 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.0 CPython/3.9.19

File hashes

Hashes for fai_trainer-0.4.2-py3-none-any.whl
Algorithm Hash digest
SHA256 b9273feab4baed4026306025c418c977a49b104b8654a033511407f4688ec0fb
MD5 68079efc0bb8f43c2be5225d82b49b92
BLAKE2b-256 e05075f68bc41a7a690c3281a10fd51022d4023dbda8575e5c370d067a55027d

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