Rethinking the U-Net architecture for multimodal biomedical image segmentation

Overview

MultiResUNet

Rethinking the U-Net architecture for multimodal biomedical image segmentation

This repository contains the original implementation of "MultiResUNet : Rethinking the U-Net architecture for multimodal biomedical image segmentation" in Keras (Tensorflow as backend).

Paper

MultiResUNet has been published in Neural Networks

Ibtehaz, Nabil, and M. Sohel Rahman. "MultiResUNet: Rethinking the U-Net architecture for multimodal biomedical image segmentation." Neural Networks 121 (2020): 74-87.

Overview

In this project we take motivations from the phenomenal U-Net architecture for biomedical image segmentation and take an attempt to improve the already outstanding network.

In order to incorporate multiresolution analysis, taking inspiration from Inception family networks, we propose the following MultiRes block, and replace the pair of convolutional layer pairs in the original U-Net with it. This configuration basically is derived from factorizing 5x5 and 7x7 convolution operations to 3x3 ones, and reusing them to obtain results from 3x3, 5x5 and 7x7 convolution operations simultaneously. Moreover, a residual path is also added.

Consequnetly, to elleviate the likely semantic distance between Encoder and Decoder networks, we introduce Res Paths. We include additional convolutions along the shortcut path, in proportionate to the expected gap between the two corresponding layers.

Therefore, with the fusion of MultiRes blocks and Res paths, we obtain the proposed architecture MultiResUNet.

Codes

The model architecture codes can be found in

Demo

A demo can be found in here

License

License

MIT license

Citation Request

If you use MultiResUNet in your project, please cite the following paper

@article{ibtehaz2020multiresunet,
  title={MultiResUNet: Rethinking the U-Net architecture for multimodal biomedical image segmentation},
  author={Ibtehaz, Nabil and Rahman, M Sohel},
  journal={Neural Networks},
  volume={121},
  pages={74--87},
  year={2020},
  publisher={Elsevier}
}
Comments
  • Is multiclass segmentation possible?

    Is multiclass segmentation possible?

    Hello,

    I want to implement your model in a cell segmentation task. Since I have to segment my images into 4 classes (background, healthy cells, cancer cells and leucocytes) I wanted to ask if your model can be easily modified to support multiclass segmenation. I have little experience in deep learning and python so help would be much appreciated!

    opened by dev-walter 19
  • ResourceExhaustedError MultiResUNet3D

    ResourceExhaustedError MultiResUNet3D

    When I try to train the MultiResUNet3D model with input shape = (128, 128, 128, 1) and batch size = 1, keras raises this exception:

    ResourceExhaustedError: OOM when allocating tensor with shape[1,128,128,128,32] and type float on /job:localhost/replica:0/task:0/device:GPU:0 by allocator GPU_0_bfc
    	 [[{{node training/Adadelta/gradients/zeros_70}}]]
    Hint: If you want to see a list of allocated tensors when OOM happens, add report_tensor_allocations_upon_oom to RunOptions for current allocation info.
    
    	 [[{{node loss/mul}}]]
    Hint: If you want to see a list of allocated tensors when OOM happens, add report_tensor_allocations_upon_oom to RunOptions for current allocation info.
    

    also, I used the following function to calculate the gpu memory that keras needs:

    # function taked from:
    # https://stackoverflow.com/questions/43137288/how-to-determine-needed-memory-of-keras-model
    
    def get_model_memory_usage(batch_size, model):
        shapes_mem_count = 0
        for l in model.layers:
            single_layer_mem = 1
            for s in l.output_shape:
                if s is None:
                    continue
                single_layer_mem *= s
            shapes_mem_count += single_layer_mem
        trainable_count = np.sum([K.count_params(p) for p in set(model.trainable_weights)])
        non_trainable_count = np.sum([K.count_params(p) for p in set(model.non_trainable_weights)])
        number_size = 4.0
        if K.floatx() == 'float16':
             number_size = 2.0
        if K.floatx() == 'float64':
             number_size = 8.0
        total_memory = number_size*(batch_size*shapes_mem_count + trainable_count + non_trainable_count)
        gbytes = np.round(total_memory / (1024.0 ** 3), 3)
        return gbytes
    

    and the output when I execute the next code:

    # where "model3D" is the MultiResUNet3D model.
    get_model_memory_usage(1, model3D) # output 21.628 "GB"
    
    # where "model2D" is the MultiResUNet3D model.
    get_model_memory_usage(1, model2D) # output 0.256 "GB"
    

    it is normal that the model does not run? How much GPU memory do I need?

    my GPU is a gtx 1080ti (11GB)

    opened by emanuelolaya 8
  • First convolution layers in MultiResUBlock and ResPath don't use any activations

    First convolution layers in MultiResUBlock and ResPath don't use any activations

    Hi there,

    I'm about to experiment and use a modified version of your architecture in my master's thesis. I saw in your code that the first convolution layers in MultiResUBlock and ResPath don't use any activation function. What was the reason you decided not to use an activation function here ???

    shortcut = conv2d_bn(shortcut, filters, 1, 1,activation=None, padding='same')

    Cheers, H

    opened by cloudscapes 5
  • About pytorch version

    About pytorch version

    Hi! It is a great honor to see your research paper "MultiResUNet : Rethinking the U-Net Architecture for Multimodal Biomedical Image Segmentation". Now I want to reproduce the corresponding code of the paper. Can you provide the pytorch version of the code?

    opened by PatrickWilliams44 3
  • Train in my own dataset

    Train in my own dataset

    Hi! First of all, thank you very much for sharing your project. It's a great job, congratulations!

    I would like to train your network with my own dataset. I've .nii files, so, what I should to do is to stack all my dataset in a numpy array? For example, if I've 20 .nii files with shape [20,256,256], I create an array of [400,256,256]. That's it?

    Thank you ver much in advance.

    All the best :)

    opened by AmericaBG 3
  • Validation quality metrics

    Validation quality metrics "get stuck"

    With certain splits of training, validation and test data sets, I can always observe a strange behaviour that does not occur with a different distribution of the same overall data set. Namely, the values on the validation data seem to stand still from the beginning during training, on enormously bad numbers, while the values on the training data keep improving. Unfortunately, it is not really possible to reconstruct which combination of images triggers this behaviour, but it probably really depends on a combination and not on individual images. Is such a behaviour known, or even a solution for it?

    Estimated 76.0 GB model memory usage
    Train shape: (1166, 672, 672, 1); Val shape: (292, 672, 672, 1); Test shape: (59, 672, 672, 1)
      0%|| 2/15000 [04:11<523:59:44, 125.78s/epoch, val_loss=12.7, val_jaccard_round=0.171, loss=0.43, jaccard_round=0.748]
    
    opened by saskra 3
  • How to implement 5-fold cross validation

    How to implement 5-fold cross validation

    Hello Nabil,

    I check your demo code, i want to to implement 5-fold cross validation in it, and i never found any help anywhere.

    Please can you share how i can implement 5-fold cross validation on this code?

    Thanks

    opened by ahmedeqbal 3
  • About the ISIC-17 Dataset download link in the demo

    About the ISIC-17 Dataset download link in the demo

    Hi! It is an honor to read your paper "MultiResUNet : Rethinking the U-Net Architecture for Multimodal Biomedical Image Segmentation", and now I want to reproduce the code corresponding to the paper. Unfortunately, the ISIC-17 Dataset download link provided in your demo doesn't seem to work,How should I solve this problem? Words fail me when I wish to express my sincere gratitude to you.Looking forward to your early reply!

    opened by PatrickWilliams44 2
  • Demo for the ISBI 2012 challenge dataset

    Demo for the ISBI 2012 challenge dataset

    In your paper, it appears that you tested this implementation using the ISBI 2012 challenge dataset - Electron Microscopy Image. Do you have a sample demo notebook you could share?

    opened by scalemailted 2
  • MultiResBlock Architechture Explanation

    MultiResBlock Architechture Explanation

    Hi, I wanted to ask about the detail regarding the MultiResBlock architecture. In the Figure 3(a) where you concatenating the generated feature maps. How can you concatenate different size of feature maps. Because as shown in the Figure 3(a), those layers are 3x3, 5x5, and 7x7 which each block have different size of kernel. Can you provide more detail explanation on the Figure 3(a). Thankyou.

    image

    opened by richardgun26 2
  • Use of trans_conv2d_bn

    Use of trans_conv2d_bn

    Hi,

    Thank you very much for your work. I'm trying to implement the MultiResUNet as a generator of a GAN. I would like to know if the definition of trans_conv_2d has any purpose since it is not used. Also, why did you decide not to use dropout?

    Thanks!

    opened by andrealpkth 2
  • Jaccard Index & Dice coefficient remains zero throughout

    Jaccard Index & Dice coefficient remains zero throughout

    Hello, I have tried using the MultiRes U-Net Architecture on a different dataset. My accuracy and loss works well. However, the Jaccard index and DICE coefficient remains always zero. Could you please let me know why this might happen and any possible suggestions for this?

    opened by BashCache 4
  • Validation / training scores mismatch

    Validation / training scores mismatch

    Hi,

    I have run your network based on the notbook in a project of mine. However, I pondered quite a bit over my validation Jaccard scores outperforming the training score by a large margin. I suspect the answer lies in the rounding of yp that you perform in evaluateModel. From what I can tell, this rounding is not done in the function that is used during training. After removing this rounding the scores matched as expected.

    Please let me know if I'm missing the point somewhere, or if you agree with the observation.

    Thanks for a superb piece of work!

    Arild

    opened by arilmad 9
  • Dice and Jaccard score not improving

    Dice and Jaccard score not improving

    Hi @nibtehaz , I've been trying your model for my image segmentation projects (with same settings) but with 365 images which split (0.2) into 292 for training and 73 for testing and manage to get a fairly good results of the dice and Jacard score. But I found out that the jacard score is still at around 0.7 for too many epochs (20-30 epochs) and stop increasing even after 100 epochs. And i found out among those 73 testing images , for some predicted image the jacard score did go up to 0.91 for some only for 0.65 which totally average to around 0.7. I know it should be the dataset problems , I'd like if there is any way to improved the overall jacard score with that same dataset ? Should I just keep training ? Or make some changes to the dataset ?

    opened by reachsak 1
  • How we can predict the model?

    How we can predict the model?

    Dear Author, I did not found any dataloader and prepared code for dataset organization. How we train the model. Moreover, How we can test the performance of the model?

    Help For Beginners 
    opened by Ayanzadeh93 29
Owner
Nabil Ibtehaz
Computerphile
Nabil Ibtehaz
U-Net Implementation: Convolutional Networks for Biomedical Image Segmentation" using the Carvana Image Masking Dataset in PyTorch

U-Net Implementation By Christopher Ley This is my interpretation and implementation of the famous paper "U-Net: Convolutional Networks for Biomedical

Christopher Ley 1 Jan 6, 2022
This repository contains the official implementation code of the paper Improving Multimodal Fusion with Hierarchical Mutual Information Maximization for Multimodal Sentiment Analysis, accepted at EMNLP 2021.

MultiModal-InfoMax This repository contains the official implementation code of the paper Improving Multimodal Fusion with Hierarchical Mutual Informa

Deep Cognition and Language Research (DeCLaRe) Lab 89 Dec 26, 2022
Pre-trained model, code, and materials from the paper "Impact of Adversarial Examples on Deep Learning Models for Biomedical Image Segmentation" (MICCAI 2019).

Adaptive Segmentation Mask Attack This repository contains the implementation of the Adaptive Segmentation Mask Attack (ASMA), a targeted adversarial

Utku Ozbulak 53 Jul 4, 2022
Code for "Multi-Compound Transformer for Accurate Biomedical Image Segmentation"

News The code of MCTrans has been released. if you are interested in contributing to the standardization of the medical image analysis community, plea

null 97 Jan 5, 2023
Flexible-CLmser: Regularized Feedback Connections for Biomedical Image Segmentation

Flexible-CLmser: Regularized Feedback Connections for Biomedical Image Segmentation The skip connections in U-Net pass features from the levels of enc

Boheng Cao 1 Dec 29, 2021
U-2-Net: U Square Net - Modified for paired image training of style transfer

U2-Net: U Square Net Modified for paired image training of style transfer This is an unofficial repo making use of the code which was made available b

Doron Adler 43 Oct 3, 2022
Official implementation of Rethinking Graph Neural Architecture Search from Message-passing (CVPR2021)

Rethinking Graph Neural Architecture Search from Message-passing Intro The GNAS can automatically learn better architecture with the optimal depth of

Shaofei Cai 48 Sep 30, 2022
[ICLR2021oral] Rethinking Architecture Selection in Differentiable NAS

DARTS-PT Code accompanying the paper ICLR'2021: Rethinking Architecture Selection in Differentiable NAS Ruochen Wang, Minhao Cheng, Xiangning Chen, Xi

Ruochen Wang 86 Dec 27, 2022
Deep Multimodal Neural Architecture Search

MMNas: Deep Multimodal Neural Architecture Search This repository corresponds to the PyTorch implementation of the MMnas for visual question answering

Vision and Language Group@ MIL 23 Dec 21, 2022
Alex Pashevich 62 Dec 24, 2022
U^2-Net - Portrait matting This repository explores possibilities of using the original u^2-net model for portrait matting.

U^2-Net - Portrait matting This repository explores possibilities of using the original u^2-net model for portrait matting.

Dennis Bappert 104 Nov 25, 2022
The Medical Detection Toolkit contains 2D + 3D implementations of prevalent object detectors such as Mask R-CNN, Retina Net, Retina U-Net, as well as a training and inference framework focused on dealing with medical images.

The Medical Detection Toolkit contains 2D + 3D implementations of prevalent object detectors such as Mask R-CNN, Retina Net, Retina U-Net, as well as a training and inference framework focused on dealing with medical images.

MIC-DKFZ 1.2k Jan 4, 2023
Neural networks applied in recognizing guitar chords using python, AutoML.NET with C# and .NET Core

Chord Recognition Demo application The demo application is written in C# with .NETCore. As of July 9, 2020, the only version available is for windows

Andres Mauricio Rondon PatiƱo 24 Oct 22, 2022
RGBD-Net - This repository contains a pytorch lightning implementation for the 3DV 2021 RGBD-Net paper.

[3DV 2021] We propose a new cascaded architecture for novel view synthesis, called RGBD-Net, which consists of two core components: a hierarchical depth regression network and a depth-aware generator network.

Phong Nguyen Ha 4 May 26, 2022
Realtime segmentation with ENet, the fast and accurate segmentation net.

Enet This is a realtime segmentation net with almost 22 fps on GTX1080 ti, and the model size is very small with only 28M. This repo contains the infe

JinTian 14 Aug 30, 2022
Arch-Net: Model Distillation for Architecture Agnostic Model Deployment

Arch-Net: Model Distillation for Architecture Agnostic Model Deployment The official implementation of Arch-Net: Model Distillation for Architecture A

MEGVII Research 22 Jan 5, 2023
code for paper "Does Unsupervised Architecture Representation Learning Help Neural Architecture Search?"

Does Unsupervised Architecture Representation Learning Help Neural Architecture Search? Code for paper: Does Unsupervised Architecture Representation

null 39 Dec 17, 2022
Rethinking Semantic Segmentation from a Sequence-to-Sequence Perspective with Transformers

Segmentation Transformer Implementation of Segmentation Transformer in PyTorch, a new model to achieve SOTA in semantic segmentation while using trans

Abhay Gupta 161 Dec 8, 2022
Implementation of SETR model, Original paper: Rethinking Semantic Segmentation from a Sequence-to-Sequence Perspective with Transformers.

SETR - Pytorch Since the original paper (Rethinking Semantic Segmentation from a Sequence-to-Sequence Perspective with Transformers.) has no official

zhaohu xing 112 Dec 16, 2022