Skip to main content

Universal implementation of the UNet architecture for image segmentation.

Project description

UNET SEGMENTATION PYTORCH

Installation

pip install segment-torch

Usage

from segment_torch.unet import UNet
from torch import nn

device = "cuda"

config = dict(
    in_channels=3,
    out_channels=1,
    hiddens=[4, 8, 16, 32],
    dropouts=[0, 0.15, 0.15, 0.15],  # hiddens
    maxpools=2,  # hiddens - 1
    kernel_sizes=3,  # 2*hiddens + 3*hiddens + 2
    paddings='same',  # 2*hiddens + 3*hiddens + 2
    strides=1,  # 2*hiddens + 3*hiddens
    dilation=1,
    criterion=nn.BCELoss(),
    output_activation=nn.Sigmoid(),
    activation=nn.ReLU(),
    dimensions=2,
    device=device
)
unet = UNet(**config)

Different ways to define configs

# 0. None: default values are used
kernel_sizes=None

# 1. Single value or tuple: all layers have the same value
kernel_sizes = 3 
kernel_sizes = (3, 3)

# 2. Lists of values
encooder_kernel_sizes = [3, 3, 3, 3]
decoder_kernel_sizes = [3, 3, 3, 3, 3]
kernel_sizes = [encooder_kernel_sizes, decoder_kernel_sizes]

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

segment_torch-0.0.10.tar.gz (8.5 kB view details)

Uploaded Source

Built Distribution

segment_torch-0.0.10-py3-none-any.whl (10.8 kB view details)

Uploaded Python 3

File details

Details for the file segment_torch-0.0.10.tar.gz.

File metadata

  • Download URL: segment_torch-0.0.10.tar.gz
  • Upload date:
  • Size: 8.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.8.16

File hashes

Hashes for segment_torch-0.0.10.tar.gz
Algorithm Hash digest
SHA256 badc19d6817e1d9e8ee2defb8b7bd13ba358bf0db467bd9ae8c451c8578bd5a5
MD5 f71adccab8bbdce393f4e489253b0bc3
BLAKE2b-256 cb8e568f9b8d6898dfc0e3dccc7c1195d298863d0291ebc116dc01087c69079a

See more details on using hashes here.

File details

Details for the file segment_torch-0.0.10-py3-none-any.whl.

File metadata

File hashes

Hashes for segment_torch-0.0.10-py3-none-any.whl
Algorithm Hash digest
SHA256 c0939b296e404d7a9a9269261eb26272f53133659d2a03bab04e45c9c363b062
MD5 ab695e28530d3ae07aa76eef5b533fa6
BLAKE2b-256 fcc47985c80f1d68f57ddc4976e09fabc0004f9dd81799c08603ef6491a93cf4

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page