Skip to main content

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
    • .tiff
    • More 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


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

easy_image_model-0.1.1.tar.gz (6.3 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

easy_image_model-0.1.1-py3-none-any.whl (6.8 kB view details)

Uploaded Python 3

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

Hashes for easy_image_model-0.1.1.tar.gz
Algorithm Hash digest
SHA256 ee3785a31b438c9ec9f563435224dc016502741470acea35d0e503275f3a573a
MD5 746c06af7a7285f15abde56db6f2c086
BLAKE2b-256 0406c52e13632c622e805527bb3224f357b85169267beee7e8b2c5c32dd5f06e

See more details on using hashes here.

File details

Details for the file easy_image_model-0.1.1-py3-none-any.whl.

File metadata

File hashes

Hashes for easy_image_model-0.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 d7c7bdc4430f0e91d3aced79bcc53e66d25278d0e7ddc6a1f8bc7a616761ffb0
MD5 f94ef2f8b773ce62c67877c57d235290
BLAKE2b-256 a9768aecc2d9a4a4f27dd9835e461deaf4ab74795ec7f88e50db2d548e84865b

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