Easy PyTorch image classification library
Project description
Easy Image Model
by Harrison Hensarling
Easy Image Model is a lightweight Python library for quickly building, training, and evaluating image classification models using PyTorch. It is designed for simplicity and ease of use. Supports:
-small datasets
-non-normalized images
-batch training
Features
- Create a custom neural network with any number of hidden layers and nodes.
- Train models on folders of labeled images (each folder represents a category).
- Batch training for faster convergence.
- Automatically preprocesses images (resizing, normalization) — no manual preprocessing required except for labeling.
- Evaluate a single image and return category probabilities.
- Save and reload model weights as JSON for portability.
- Customizable image input size (default 224x224, can be adjusted for your dataset).
- Supported image types:
.jpg.jpeg.png.bmp.gif (only first frame is used).tif.tiffMore supported but untested
Installation
pip install easy-image-model
Or for development:
git clone https://github.com/hhensar/easy-image-model.git
cd easy-image-model
pip install -e ".[dev]"
Example Usage
from easy_image_model import create_model, train_model_batch_folders, evaluate_model
# Define categories
categories = ['Eagles', 'Penguins', 'Owls', 'Others']
# Create model with hidden layers (3 layers with 512, 256, 128 nodes)
# img_size defaults to 224, but can be customized (e.g., 128, 256, 512)
model = create_model([512, 256, 128], categories, img_size=224)
# Train on folders (each folder contains images of one category)
folder_paths = {
'Eagles': 'dataset/Eagles',
'Penguins': 'dataset/Penguins',
'Owls': 'dataset/Owls',
'Others': 'dataset/Others'
}
model = train_model_batch_folders(model, folder_paths, batch_size=4, epochs=5)
# Evaluate a single image
result = evaluate_model(model, 'test_images/test1.jpg')
print(result)
Example Output:
{'Eagles': 0.87,
'Penguins': 0.05,
'Owls': 0.23,
'Others': 0.1}
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file easy_image_model-0.1.1.tar.gz.
File metadata
- Download URL: easy_image_model-0.1.1.tar.gz
- Upload date:
- Size: 6.3 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.13.5
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
ee3785a31b438c9ec9f563435224dc016502741470acea35d0e503275f3a573a
|
|
| MD5 |
746c06af7a7285f15abde56db6f2c086
|
|
| BLAKE2b-256 |
0406c52e13632c622e805527bb3224f357b85169267beee7e8b2c5c32dd5f06e
|
File details
Details for the file easy_image_model-0.1.1-py3-none-any.whl.
File metadata
- Download URL: easy_image_model-0.1.1-py3-none-any.whl
- Upload date:
- Size: 6.8 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.13.5
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
d7c7bdc4430f0e91d3aced79bcc53e66d25278d0e7ddc6a1f8bc7a616761ffb0
|
|
| MD5 |
f94ef2f8b773ce62c67877c57d235290
|
|
| BLAKE2b-256 |
a9768aecc2d9a4a4f27dd9835e461deaf4ab74795ec7f88e50db2d548e84865b
|