# UNET SEGMENTATION PYTORCH
## Installation
```bash
pip install segment-torch
```
## Usage
```python
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**
```python
# 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]
```
Raw data
{
"_id": null,
"home_page": "https://github.com/lacykaltgr/agriculture-image-processing",
"name": "segment-torch",
"maintainer": "",
"docs_url": null,
"requires_python": "",
"maintainer_email": "",
"keywords": "unet,image segmentation,segmentation",
"author": "L\u00e1szl\u00f3 Freund",
"author_email": "freundl0509@gmail.com",
"download_url": "https://files.pythonhosted.org/packages/cb/8e/568f9b8d6898dfc0e3dccc7c1195d298863d0291ebc116dc01087c69079a/segment_torch-0.0.10.tar.gz",
"platform": null,
"description": "# UNET SEGMENTATION PYTORCH\n\n## Installation\n\n```bash\npip install segment-torch\n```\n\n## Usage\n\n```python\nfrom segment_torch.unet import UNet\nfrom torch import nn\n\ndevice = \"cuda\"\n\nconfig = dict(\n in_channels=3,\n out_channels=1,\n hiddens=[4, 8, 16, 32],\n dropouts=[0, 0.15, 0.15, 0.15], # hiddens\n maxpools=2, # hiddens - 1\n kernel_sizes=3, # 2*hiddens + 3*hiddens + 2\n paddings='same', # 2*hiddens + 3*hiddens + 2\n strides=1, # 2*hiddens + 3*hiddens\n dilation=1,\n criterion=nn.BCELoss(),\n output_activation=nn.Sigmoid(),\n activation=nn.ReLU(),\n dimensions=2,\n device=device\n)\nunet = UNet(**config)\n```\n\n**Different ways to define configs**\n\n```python\n\n# 0. None: default values are used\nkernel_sizes=None\n\n# 1. Single value or tuple: all layers have the same value\nkernel_sizes = 3 \nkernel_sizes = (3, 3)\n\n# 2. Lists of values\nencooder_kernel_sizes = [3, 3, 3, 3]\ndecoder_kernel_sizes = [3, 3, 3, 3, 3]\nkernel_sizes = [encooder_kernel_sizes, decoder_kernel_sizes]\n```\n\n\n",
"bugtrack_url": null,
"license": "MIT",
"summary": "Universal implementation of the UNet architecture for image segmentation.",
"version": "0.0.10",
"project_urls": {
"Homepage": "https://github.com/lacykaltgr/agriculture-image-processing"
},
"split_keywords": [
"unet",
"image segmentation",
"segmentation"
],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "fcc47985c80f1d68f57ddc4976e09fabc0004f9dd81799c08603ef6491a93cf4",
"md5": "ab695e28530d3ae07aa76eef5b533fa6",
"sha256": "c0939b296e404d7a9a9269261eb26272f53133659d2a03bab04e45c9c363b062"
},
"downloads": -1,
"filename": "segment_torch-0.0.10-py3-none-any.whl",
"has_sig": false,
"md5_digest": "ab695e28530d3ae07aa76eef5b533fa6",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": null,
"size": 10762,
"upload_time": "2024-01-19T04:24:20",
"upload_time_iso_8601": "2024-01-19T04:24:20.530901Z",
"url": "https://files.pythonhosted.org/packages/fc/c4/7985c80f1d68f57ddc4976e09fabc0004f9dd81799c08603ef6491a93cf4/segment_torch-0.0.10-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "cb8e568f9b8d6898dfc0e3dccc7c1195d298863d0291ebc116dc01087c69079a",
"md5": "f71adccab8bbdce393f4e489253b0bc3",
"sha256": "badc19d6817e1d9e8ee2defb8b7bd13ba358bf0db467bd9ae8c451c8578bd5a5"
},
"downloads": -1,
"filename": "segment_torch-0.0.10.tar.gz",
"has_sig": false,
"md5_digest": "f71adccab8bbdce393f4e489253b0bc3",
"packagetype": "sdist",
"python_version": "source",
"requires_python": null,
"size": 8537,
"upload_time": "2024-01-19T04:24:24",
"upload_time_iso_8601": "2024-01-19T04:24:24.174642Z",
"url": "https://files.pythonhosted.org/packages/cb/8e/568f9b8d6898dfc0e3dccc7c1195d298863d0291ebc116dc01087c69079a/segment_torch-0.0.10.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2024-01-19 04:24:24",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "lacykaltgr",
"github_project": "agriculture-image-processing",
"travis_ci": false,
"coveralls": false,
"github_actions": false,
"lcname": "segment-torch"
}