GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — GitHub - andreped/t-loss-tf: Robust T-Loss for Medical Image Segmentation with TensorFlow backend

BranchesTags
Open more actions menu

Latest commit

 

History

24 Commits
24 Commits

Folders and files

NameName
Last commit message
Last commit date
.github/workflows
.github/workflows
 
 
assets
assets
 
 
shell
shell
 
 
t_loss
t_loss
 
 
tests
tests
 
 
.gitignore
.gitignore
 
 
LICENSE
LICENSE
 
 
README.md
README.md
 
 
setup.cfg
setup.cfg
 
 
setup.py
setup.py
 
 

Repository files navigation

t-loss-tf

Robust T-Loss for Medical Image Segmentation with TensorFlow backend

GitHub Downloads License CI Code style: black

This T-loss implementation is an adaption of the original PyTorch code Digital-Dermatology/t-loss-loss.

More information about T-loss and the original paper can be found here.

Installation

pip install git+https://github.com/andreped/t-loss-tf.git

Usage

As the t-loss contains a trainable parameter, in keras the loss needed to be implemented as a custom layer. Hence, instead of setting the loss as normally through model.compile(loss=[...]), just add it to the model at an appropriate place (e.g., at the end of the network).

An example can be seen below:

import tensorflow as tf
from t_loss import TLoss

# create dummy inputs and GTs
input_shape = (16, 16, 1)
x = tf.ones((32,) + input_shape, dtype="float32")
y = tf.ones((32,) + input_shape, dtype="float32")

# define network
input_x = tf.keras.Input(shape=input_shape)
input_y = tf.keras.Input(shape=input_shape)
z = tf.keras.layers.Conv2D(filters=4, kernel_size=(1, 1), activation="relu")(input_x)
z = tf.keras.layers.MaxPooling2D(pool_size=(2, 2))(z)
z = tf.keras.layers.UpSampling2D(size=(2, 2))(z)
z = tf.keras.layers.Conv2D(filters=1, kernel_size=(1, 1), activation="sigmoid")(z)
z = TLoss(tensor_shape=input_shape, image_size=input_shape[0])(z, input_y)
model = tf.keras.Model(inputs=[input_x, input_y], outputs=[z])

# train model
model.compile(optimizer="adam")
model.fit(x=[x, y], y=y, batch_size=2, epochs=1, verbose="auto")

License

The code in this repository is released under MIT License.

Citation

The implementation is based on the original torch implementation hosted here.

Hence, if this code is used, please cite the original research article:

@inproceedings{gonzalezjimenezRobustTLoss2023,
  title     = {Robust T-Loss for Medical Image Segmentation},
  author    = {Gonzalez-Jimenez, Alvaro and Lionetti, Simone and Gottfrois, Philippe and Gröger, Fabian and Pouly, Marc and Navarini, Alexander},
  journal   = {Medical {{Image Computing}} and {{Computer Assisted Intervention}} – {{MICCAI}} 2023},
  publisher = {{Springer International Publishing}},
  year      = {2023},
}

About

Robust T-Loss for Medical Image Segmentation with TensorFlow backend

Topics

image-analysiskerasmedicalpythonsemantic-segmentationt-losstensorflowtftloss

Resources

Readme
MIT license
Activity

Stars

4 stars

Watchers

1 watching

Forks

0 forks
Report repository

Releases

Packages

Contributors

Languages

You are visitor 01402792 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.