Metadata-Version: 2.4
Name: easy-image-model
Version: 0.1.1
Summary: Easy PyTorch image classification library
Author-email: Harrison Hensarling <harrisonhensarling@gmail.com>
Maintainer-email: Harrison Hensarling <harrisonhensarling@gmail.com>
License-Expression: MIT
Project-URL: Homepage, https://github.com/HHensar/easy_image_model
Project-URL: Documentation, https://github.com/HHensar/easy_image_model#readme
Project-URL: Repository, https://github.com/HHensar/easy_image_model
Project-URL: Issues, https://github.com/HHensar/easy_image_model/issues
Project-URL: Changelog, https://github.com/HHensar/easy_image_model/blob/main/CHANGELOG.md
Keywords: machine learning,pytorch,image classification
Classifier: Development Status :: 3 - Alpha
Classifier: Intended Audience :: Developers
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.9
Classifier: Programming Language :: Python :: 3.10
Classifier: Programming Language :: Python :: 3.11
Classifier: Operating System :: OS Independent
Classifier: Topic :: Scientific/Engineering :: Artificial Intelligence
Requires-Python: >=3.9
Description-Content-Type: text/markdown
License-File: LICENSE
Requires-Dist: torch>=2.0
Requires-Dist: torchvision>=0.15
Requires-Dist: pillow>=9.0
Provides-Extra: dev
Requires-Dist: pytest>=7.0; extra == "dev"
Requires-Dist: pytest-cov>=4.0; extra == "dev"
Requires-Dist: black>=22.0; extra == "dev"
Requires-Dist: isort>=5.0; extra == "dev"
Requires-Dist: flake8>=4.0; extra == "dev"
Requires-Dist: mypy>=1.0; extra == "dev"
Dynamic: license-file

# 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

```bash
pip install easy-image-model
```

Or for development:

```bash
git clone https://github.com/hhensar/easy-image-model.git
cd easy-image-model
pip install -e ".[dev]"
```

---

## Example Usage

```python
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}
```
