Skip to main content

Hyso: 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

hyso-0.1.1.tar.gz (14.5 kB view details)

Uploaded Source

Built Distribution

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

hyso-0.1.1-py3-none-any.whl (18.5 kB view details)

Uploaded Python 3

File details

Details for the file hyso-0.1.1.tar.gz.

File metadata

  • Download URL: hyso-0.1.1.tar.gz
  • Upload date:
  • Size: 14.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.5

File hashes

Hashes for hyso-0.1.1.tar.gz
Algorithm Hash digest
SHA256 5cffdd6d12a8eef9f9c9ec8e768d57e1e18664369df8d34687c8d767ad160536
MD5 50830f706210c099ce4375b05bc3ac77
BLAKE2b-256 b75fe834127326d5e44966c2617720d147c7be4b3a16f2d232d7ec4e1dc0c57f

See more details on using hashes here.

File details

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

File metadata

  • Download URL: hyso-0.1.1-py3-none-any.whl
  • Upload date:
  • Size: 18.5 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.5

File hashes

Hashes for hyso-0.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 f2b5a579e208c5760fa710de8ccd75850931e691ad71d72188326218b9c6eb9b
MD5 5e1988425aee130951d36703f0c5b9b6
BLAKE2b-256 682af20a19624b4cd412cc65781d00e14f7a025bac830f03f129c70ab5c264f4

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