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.2.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.2-py3-none-any.whl (18.5 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: hyso-0.1.2.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.2.tar.gz
Algorithm Hash digest
SHA256 05a239883f7078fbfe4c8bf99991c0be9a01504e560966216f0ea85d04191ad3
MD5 00e7ca8b0ebf2bc8b5de2e2c6fd1adad
BLAKE2b-256 b80110bfce8670d5dccb2d0a655c159f32434c5d3401852e31dde630551f4565

See more details on using hashes here.

File details

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

File metadata

  • Download URL: hyso-0.1.2-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.2-py3-none-any.whl
Algorithm Hash digest
SHA256 ac8bf573de971a155f2bb78f58d94a5dd7c6eddd24943c3619d968eb12f962aa
MD5 ec11713a830d5b71a1c193b7fb97c2ca
BLAKE2b-256 d07fd364dacc66ef083296f42fbaf1fb0c09f6ca0eedabf1aba05c20001c7a85

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