A lightweight and flexible PyTorch library providing a modular UNet implementation with advanced attention and normalization blocks for fast image processing and deep learning development.
Project description
easy-unet: Modular UNet Backbone in PyTorch
A lightweight and flexible PyTorch library providing a modular UNet implementation with advanced attention and normalization blocks. Designed for fast experimentation and development across diverse image processing and deep learning tasks.
🚀 Features
- 🧱 UNet backbone with residual blocks and flexible channel multipliers
- 🎯 Advanced attention modules including linear and flash attention for improved feature modeling
- ⚙️ Configurable architecture for dropout, channels, and dimensions
- 🧪 Modular and clean PyTorch codebase suitable for research and production
- 🔄 Supports easy integration with diffusion models, segmentation, or any custom pipeline
📦 Installation
You can access the PyPI page or install the package directly.
pip install easy-unet
📁 Project Structure
easy-unet/
├── easy_unet/
│ ├── __init__.py
│ ├── module.py # All architecture classes and logic
├── pyproject.toml
├── LICENSE
└── README.md
🚀 Quick Start
Import and create the model
import torch
from easy_unet import UNet
model = UNet(
dim=64,
dim_mults=(1, 2, 4, 8),
channels=3,
out_channels=1,
dropout=0.1
)
x = torch.randn(1, 3, 256, 256) # sample input
output = model(x)
print(output.shape) # e.g., torch.Size([1, 3, 256, 256])
⚙️ Configuration Options
| Argument | Type | Default | Description |
|---|---|---|---|
dim |
int |
64 |
Base number of feature channels |
dim_mults |
tuple |
(1, 2, 4, 8) |
Channel multipliers per U-Net stage |
channels |
int |
3 |
Number of input channels (e.g., 3 for RGB) |
out_channels |
int |
1 |
Number of output channels (e.g., 1 for binary and 2 or more for multi-class) |
dropout |
float |
0.0 |
Dropout rate for regularization. |
🙋♂️ Author
Developed by Mehran Bazrafkan
Created for general-purpose use cases and research requiring flexible UNet architectures in PyTorch.
⭐️ Support & Contribute
If you find this project useful, please:
-
⭐️ Star the repo
-
🐛 Report issues
-
📦 Suggest features or improvements
🔗 Related Projects
- diffusion-pytorch-lib · PyPI (by me)
- variational-autoencoder-pytorch-lib · PyPI (by me)
- convolutional-autoencoder-pytorch · PyPI (by me)
📜 License
This project is licensed under the terms of the MIT LICENSE.
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 easy_unet-1.0.1.tar.gz.
File metadata
- Download URL: easy_unet-1.0.1.tar.gz
- Upload date:
- Size: 6.1 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.10.0
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
9e67dde81e5a2f23f52c695950692553459a17a9965c0db6c605d70dae72f519
|
|
| MD5 |
4756f160a0608d6e755b63848409fd19
|
|
| BLAKE2b-256 |
f3530cce90a0abc947e7e6e584ddf8b7cd7378990cae87c91cb64246add53f62
|
File details
Details for the file easy_unet-1.0.1-py3-none-any.whl.
File metadata
- Download URL: easy_unet-1.0.1-py3-none-any.whl
- Upload date:
- Size: 6.4 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.10.0
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
b8a22b3295e3707c05a3d70040eaafb6662351a92fc268fa54e4e5ecdf47f29e
|
|
| MD5 |
a3d04dfb187a758c22b756c5a190e81f
|
|
| BLAKE2b-256 |
dda7990e5bd19f1117ac32a099ef996478f6cb3abba9e7db0c7d10e1fcd3ae1e
|