Skip to main content

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


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

tnet_segmentation-1.0.0.tar.gz (3.5 kB view details)

Uploaded Source

Built Distribution

tnet_segmentation-1.0.0-py3-none-any.whl (4.3 kB view details)

Uploaded Python 3

File details

Details for the file tnet_segmentation-1.0.0.tar.gz.

File metadata

  • Download URL: tnet_segmentation-1.0.0.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

Hashes for tnet_segmentation-1.0.0.tar.gz
Algorithm Hash digest
SHA256 02fb66f9951a47fb2d7e657876e502c78087e1253c72d2d5ee54ff5512ea7b94
MD5 b0bc92844ed72a66abb8389f802fe3fc
BLAKE2b-256 3ddfb401114a069fb28184b866de114ff1c1d908a93553e0d2aef21eb24daf50

See more details on using hashes here.

File details

Details for the file tnet_segmentation-1.0.0-py3-none-any.whl.

File metadata

File hashes

Hashes for tnet_segmentation-1.0.0-py3-none-any.whl
Algorithm Hash digest
SHA256 641b203207fb29555c3b783609faa23fd90c14faa99f4c992f02191cc389b6dc
MD5 19a8dec07554cbf8476d74e38e259662
BLAKE2b-256 64ad5a6c6948282410724e38df63609f1c3a0183f9dc5fc6c444dced7af5d57b

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