pytorch module for T-Net image segmentation model with DiceLoss and code for visualization of model
Project description
TNet-Segmentation
- It is a pytorch based Segmentation model inspired by the research paper
T. M. Khan, A. Robles-Kelly and S. S. Naqvi, "T-Net: A Resource-Constrained Tiny Convolutional Neural Network for Medical Image Segmentation," 2022 IEEE/CVF Winter Conference on Applications of Computer Vision (WACV), Waikoloa, HI, USA, 2022, pp. 1799-1808, doi: 10.1109/WACV51458.2022.00186.
published in CVPR 2022
How to install
- run
pip install TNet-Segmentation
to install the package
How to use
Creating Model
- The model takes three parameters: -
- input_channnel (defaults to 3)
- emb_size (size of the output channel after first downsampling conv layer.Defaults to 512)
- num_classes (the num of segmentation classes, defaults to 3)
- Usage is as simple as below:-
>>> from TNet_Segmentation import TNet >>> net = TNet(input_channel=3, emb_size=256, num_classes=3)
Visualizing
- After creating the model call visualize function as follows:-
>>> from TNet_Segmentation import visualize >>> visualize(net) ================================================================= Layer (type:depth-idx) Param # ================================================================= TNet -- ├─Conv2d: 1-1 7,168 ├─TNetConvBlock: 1-2 -- │ └─ModuleList: 2-1 -- │ │ └─Conv2d: 3-1 590,080 │ │ └─BatchNorm2d: 3-2 512 │ │ └─ReLU: 3-3 -- │ │ └─Conv2d: 3-4 65,792 │ │ └─BatchNorm2d: 3-5 512 │ │ └─Conv2d: 3-6 2,560 │ │ └─BatchNorm2d: 3-7 512 │ │ └─ReLU: 3-8 -- │ │ └─MaxPool2d: 3-9 --
DiceLoss function
- Dice Loss is implemented in this library and can be used as follows:
>>> from TNet_Segmentation import DiceLoss >>> loss = DiceLoss()
Project details
Release history Release notifications | RSS feed
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
File details
Details for the file tnet_segmentation-1.0.2.tar.gz
.
File metadata
- Download URL: tnet_segmentation-1.0.2.tar.gz
- Upload date:
- Size: 3.5 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/1.7.1 CPython/3.8.18 Windows/10
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | b8dffa1407b599aa3db1138ebdbab452a944edf84317227440fe067c5bcbdd0e |
|
MD5 | 4e7001eb565d78757fd8046c12ebd737 |
|
BLAKE2b-256 | 11cbdc407f4e6af6d95f9980e80d999ef7ae455c6c4cdac53034a47b6da6a029 |
File details
Details for the file tnet_segmentation-1.0.2-py3-none-any.whl
.
File metadata
- Download URL: tnet_segmentation-1.0.2-py3-none-any.whl
- Upload date:
- Size: 4.3 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/1.7.1 CPython/3.8.18 Windows/10
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 99541d48bf92c15d67e098270c578a93fc178e82d2cb34a211d69607deb1fdf7 |
|
MD5 | 95dab761edfd4c240791f7f14f08ae6c |
|
BLAKE2b-256 | 6c57dcb24645a233b7db0130ad06def3e773f55e560ac1058306e5b83caced42 |