Skip to main content

unet-pytorch

PyTorch implementation of a convolutional neural network (U-Net) for semantic segmentation of biomedical images.

Overview

This repository contains a PyTorch implementation of the U-Net architecture for semantic segmentation tasks.

U-Net is a convolutional neural network architecture that was originally designed for biomedical image segmentation.

Installation

You can install the U-Net model using pip.

pip install unet-pytorch

We recommend using Python 3.11 or later and PyTorch 2.6 or later.

You can also clone the repository and install it in local development mode using poetry.

git clone https://github.com/giansimone/unet-pytorch.git

cd unet-pytorch

pip install poetry

poetry install

Usage

To use the U-Net model, you can import the UNet class from the unet_pytorch.model module and create an instance of the model.

import torch

from unet_pytorch.model import UNet

model = UNet(in_channels=1, out_channels=2)

input_tensor = torch.randn(1, 1, 512, 512)

output_tensor = model(input_tensor)

print(output_tensor.shape)  # Should be (1, 2, 512, 512)

Training

To train the U-Net model, you can use the unet_pytorch.train module.

License

This project is licensed under the MIT License. See the LICENSE file for details.

Metadata

Release files for unet-pytorch 0.4.3

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for unet-pytorch 0.4.3
File Size Uploaded
unet_pytorch-0.4.3.tar.gz 6.8 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for unet-pytorch 0.4.3
File Interpreter ABI Platform
unet_pytorch-0.4.3-py3-none-any.whl Python 3 none any Details

Total release size: 14.9 kB

Release files / unet_pytorch-0.4.3.tar.gz

Download URL unet_pytorch-0.4.3.tar.gz
Size 6.8 kB
Tags Source
SHA-256 checksum
How to use checksums
36b7123c977a96a30be6eec50fe38ee69726684ac479cb11aaabb350c23a4913
BLAKE2b-256 checksum
How to use checksums
03860d4fc5c3804b1c0c00b450173f35da541e6349f20e170ddf1e6b879ce306
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/1.8.4 CPython/3.13.2 Darwin/24.4.0

Release files / unet_pytorch-0.4.3-py3-none-any.whl

Download URL unet_pytorch-0.4.3-py3-none-any.whl
Size 8.1 kB
Tags Python 3
SHA-256 checksum
How to use checksums
1671582cc36c27a3738f36691bfb180446dd04fbd15854305e2bf8dc1a36ecf3
BLAKE2b-256 checksum
How to use checksums
ef3423724a25521d77c5145cad58a9938fd8b15ece55e02838cf85b8b1fac36d
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/1.8.4 CPython/3.13.2 Darwin/24.4.0

Release history Release notifications | RSS feed

This release

0.4.3 This release

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page