Hysop: Custom CNN models, SE/CBAM blocks, callbacks, and augmentations
Project description
Hyso
Hyso is a PyTorch-based deep learning library designed for CNN + Bottleneck Residual + CBAM architectures. It simplifies building, training, and evaluating image classification models with integrated callbacks and data augmentation.
Project Structure
hyso/
│
├─ hyso/
│ ├─ models/
│ │ ├─ bcam_model.py # CNNWithBottleneckResidualCBAM
│ │ └─ bcam_fit.py # BCAMWithFit (fit + callbacks)
│ │
│ ├─ augmentation/
│ │ └─ get_loaders.py # Data loader and augmentations
│ │
│ ├─ callbacks/
│ │ └─ callbacks.py # EarlyStopping, ModelCheckpoint, LRSchedulerCallback
│ │
│ └─ init.py
│
├─ setup.py # Installation script
└─ README.md # Project documentation
---
## Features
- CNN with **Bottleneck Residual + CBAM** blocks
- `fit()` and `callbacks()` integration for simplified training
- EarlyStopping, ModelCheckpoint, and LR Scheduler support
- Flexible data loading and augmentation via `get_loaders()`
- EMA support for smoother training (optional)
---
## Installation
### From PyPI (future)
```bash
pip install hyso
From GitHub
git clone https://github.com/huseyin-dgn/hyso.git cd hyso pip install .
Usage
from hyso.models.bcam_fit import BCAMWithFit
from hyso.augmentation.get_loaders import get_loaders
# ---------------- Dataset ----------------
train_loader, val_loader = get_loaders(
train_path="path/to/train",
val_path="path/to/val",
batch_size=64,
img_size=(32,32),
augment="advanced",
channels=3
)
# ---------------- Model ----------------
model = BCAMWithFit(input_channels=3, num_classes=10)
# ---------------- Training ----------------
model.fit(
train_loader=train_loader,
val_loader=val_loader,
scheduler="StepLR",
scheduler_params={"step_size":5,"gamma":0.5},
early_stopping=5,
checkpoint_path="best_bcam_model.pth",
epochs=20
)
Callbacks
-
Hyso supports the following callbacks to improve training:
-
EarlyStopping: Stops training if validation loss stops improving.
-
ModelCheckpoint: Saves the best model weights.
-
LRSchedulerCallback: Automatically adjusts the learning rate based on the chosen scheduler.
Example integration:
model.callbacks(
optimizer="Adam",
scheduler="StepLR",
scheduler_params={"step_size":5,"gamma":0.5},
model_checkpoint=True,
earlystop={"patience":5, "verbose":True}
)
Model Summary
To view a Keras-style summary of your model:
from torchsummary import summary
summary(model.model, input_size=(3, 32, 32))
Contributing
Pull requests, bug reports, and feature requests are welcome!
License
No license is set. Free to use.
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
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 hyso-0.1.6.tar.gz.
File metadata
- Download URL: hyso-0.1.6.tar.gz
- Upload date:
- Size: 15.8 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.10.18
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
9104f2b3f8eb624702dc99400b71c6add3ec8ece378ffc649327db7e621a2c66
|
|
| MD5 |
3c95e40e42b9b90759293b6331702ffd
|
|
| BLAKE2b-256 |
5e80ff75cddda95dce2da4fcccf6d88f889972a5485410f48aff4a6cf2a93135
|
File details
Details for the file hyso-0.1.6-py3-none-any.whl.
File metadata
- Download URL: hyso-0.1.6-py3-none-any.whl
- Upload date:
- Size: 18.8 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.10.18
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
991b5e8e7132a32520222e681f88bc8b6c688180f9f7e2a6ab81ac24ce9d6f99
|
|
| MD5 |
dc3166bc525fcff0975599aa13ebf268
|
|
| BLAKE2b-256 |
e81997c93368aaff3a79846ac4d3402b292766abbbf4f6c110a25839d297bf91
|