Giter VIP home page Giter VIP logo

pns-net's Introduction

[2021][MICCAI][PNS-Net]Progressively Normalized Self-Attention Network for Video Polyp Segmentation

Authors: Ge-Peng Ji*, Yu-Cheng Chou*, Deng-Ping Fan, Geng Chen, Huazhu Fu, Debesh Jha, & Ling Shao.

This repository provides code for paper "Progressively Normalized Self-Attention Network for Video Polyp Segmentation" published at the MICCAI-2021 conference (arXiv Version & Springer version). If you have any questions about our paper, feel free to contact me. And if you like our PNS-Net or evaluation toolbox for your personal research, please cite this paper (BibTeX).

Features

  • Hyper Real-time Speed: Our method, named Progressively Normalized Self-Attention Network (PNS-Net), can efficiently learn representations from polyp videos with real-time speed (~140fps) on a single NVIDIA RTX 2080 GPU without any post-processing techniques (e.g., Dense-CRF).
  • Plug-and-Play Module: The proposed core module, termed Normalized Self-attention (NS), utilizes channel split,query-dependent, and normalization rules to reduce the computational cost and improve the accuracy, respectively. Note that this module can be flexibly plugged into any framework customed.
  • Cutting-edge Performance: Experiments on three challenging video polyp segmentation (VPS) datasets demonstrate that the proposed PNS-Net achieves state-of-the-art performance.
  • One-key Evaluation Toolbox: We release the first one-key evaluation toolbox in the VPS field.

1.1. 🔥NEWS🔥 :

  • [2022/03/27] 💥 We release a new large-scale dataset on Video Polyp Segmentation (VPS) task, please enjoy it. ProjectLink/ PDF.
  • [2021/12/09] The pretraining & training code is released. Please enjoy it.
  • [2021/07/09] 「MICCAI 2021 | 超实时140FPS !PNS-Net:从视频中分割息肉」 TechBeat中文解读.
  • [2021/06/25]:fire: Our paper have been elected to be honred a MICCAI Student Travel Award.
  • [2021/06/19]:fire: A short introduction of our paper is available on my YouTube channel (2min).
  • [2021/06/18] Release the inference code! The whole project will be available at the time of MICCAI-2021.
  • [2021/06/18] The Chinese translation of our paper is coming, please enjoy it [pdf].
  • [2021/05/27] Uploading the training/testing dataset, snapshot, and benchmarking results.
  • [2021/05/14] Our work is provisionally accepted at MICCAI 2021. Many thanks to my collaborator Yu-Cheng Chou and supervisor Prof. Deng-Ping Fan.
  • [2021/03/10] Create repository.

1.2. Table of Contents

Table of contents generated with markdown-toc

2. Overview

2.1. Introduction

Existing video polyp segmentation (VPS) models typically employ convolutional neural networks (CNNs) to extract features. However, due to their limited receptive fields, CNNs can not fully exploit the global temporal and spatial information in successive video frames, resulting in false-positive segmentation results. In this paper, we propose the novel PNS-Net (Progressively Normalized Self-attention Network), which can efficiently learn representations from polyp videos with real-time speed (~140fps) on a single RTX 2080 GPU and no post-processing.

Our PNS-Net is based solely on a basic normalized self-attention block, dispensing with recurrence and CNNs entirely. Experiments on challenging VPS datasets demonstrate that the proposed PNS-Net achieves state-of-the-art performance. We also conduct extensive experiments to study the effectiveness of the channel split, soft-attention, and progressive learning strategy. We find that our PNS-Net works well under different settings, making it a promising solution to the VPS task.

2.2. Framework Overview


Figure 1: Overview of the proposed PNS-Net, including the normalized self-attention block (see § 2.1) with a stacked (×R) learning strategy. See § 2 in the paper for details.

2.3. Qualitative Results


Figure 2: Qualitative Results.

3. Proposed Baseline

3.1. Training/Testing

The training and testing experiments are conducted using PyTorch with a single GeForce RTX 2080 GPU of 8 GB Memory.

  1. Configuring your environment (Prerequisites):

    Note that PNS-Net is only tested on Ubuntu OS with the following environments. It may work on other operating systems as well but we do not guarantee that it will.

    • Creating a virtual environment in terminal:

    conda create -n PNSNet python=3.6.

    • Installing necessary packages PyTorch 1.1:
    conda create -n PNSNet python=3.6
    conda activate PNSNet
    conda install pytorch=1.1.0 torchvision -c pytorch
    pip install tensorboardX tqdm Pillow==6.2.2
    pip install git+https://github.com/pytorch/tnt.git@master
    • Our core design is built on CUDA OP with torchlib. Please ensure the base CUDA toolkit version is 10.x (not at conda env), and then build the NS Block:
    cd ./lib/PNS
    python setup.py build develop
  2. Downloading necessary data:

  3. Testing Configuration:

    • After you download all the pre-trained model and testing dataset, just run MyTest_finetune.py to generate the final prediction map in ./res.
    • Just enjoy it!
    • The prediction results of all competitors and our PNS-Net can be found at Google Drive (7.7MB).
  4. Training Configuration:

    • With the training dataset downloaded, you can pre-train the model first then fine-tune with the pre-trained weights, just run MyTrain_Pretrain.py firstly and MyTrain_Finetune.py secondly.

    • Remember to configure the pretrain_state_dict in config.py for different training stages.

3.2 Evaluating your trained model:

One-key evaluation is written in MATLAB code (link), please follow the instructions in ./eval/main_VPS.m and just run it to generate the evaluation results in ./eval-Result/.

NOTE: The different strategies of the sequential model may generate a various number of predictions, such as optical flow based method only generates T-1 frames due to forward/backward frame-difference strategy. Thus, we test the T-2 frames by removing the first and end frames for a fair comparison.

4. Citation

Please cite our paper if you find the work useful:

@inproceedings{ji2021progressively,
  title={Progressively normalized self-attention network for video polyp segmentation},
  author={Ji, Ge-Peng and Chou, Yu-Cheng and Fan, Deng-Ping and Chen, Geng and Fu, Huazhu and Jha, Debesh and Shao, Ling},
  booktitle={International Conference on Medical Image Computing and Computer-Assisted Intervention},
  pages={142--152},
  year={2021},
  organization={Springer}
}

@inproceedings{fan2020pranet,
  title={Pranet: Parallel reverse attention network for polyp segmentation},
  author={Fan, Deng-Ping and Ji, Ge-Peng and Zhou, Tao and Chen, Geng and Fu, Huazhu and Shen, Jianbing and Shao, Ling},
  booktitle={International conference on medical image computing and computer-assisted intervention},
  pages={263--273},
  year={2020},
  organization={Springer}
}

5. FAQ


6. Acknowledgements

This code is built on SINetV2 (PyTorch) and PyramidCSA (PyTorch). We thank the authors for sharing the codes.

⬆ back to top

pns-net's People

Contributors

gewelsji avatar johnson111788 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

pns-net's Issues

ModuleNotFoundError: No module named 'self_cuda_backend'

作者,您好,我已经按照您在Readme中的环境配置命令配置相应环境并运行了“python setup.py build develop”命令,运行期间没有报错,但运行完成后似乎没有生成“self_cuda_backend”文件,而且代码还是会报错,下图是我这边运行后的文件结构不知道是不是我这边运行错误,如果运行正常,会在哪里生成“self_cuda_backend”文件,麻烦您解答一下,感谢!
Snipaste_2022-04-29_15-11-50

提示缺少cuda.h如何解决

在生成编译文件时提醒我缺少gcc,并且提示我缺少cuda.h,但是我的cuda是正常安装了10.1版本的,而且也是正常安装gcc的。如下所示,请问该如何解决?
(PNSNet) yao@yao-System-Product-Name:/home/PNS-Net-main/lib/PNS$ python setup.py build develop
running build
running build_ext
building 'self_cuda_backend' extension
gcc -pthread -B /home/yao/anaconda3/envs/PNSNet/compiler_compat -Wl,--sysroot=/ -Wsign-compare -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -fPIC -I/home/yao/anaconda3/envs/PNSNet/lib/python3.6/site-packages/torch/include -I/home/yao/anaconda3/envs/PNSNet/lib/python3.6/site-packages/torch/include/torch/csrc/api/include -I/home/yao/anaconda3/envs/PNSNet/lib/python3.6/site-packages/torch/include/TH -I/home/yao/anaconda3/envs/PNSNet/lib/python3.6/site-packages/torch/include/THC -I:/usr/local/cuda-10.1/include -I/home/yao/anaconda3/envs/PNSNet/include/python3.6m -c PNS_Module/sa_ext.cpp -o build/temp.linux-x86_64-3.6/PNS_Module/sa_ext.o -std=c++11 -DTORCH_API_INCLUDE_EXTENSION_H -DTORCH_EXTENSION_NAME=self_cuda_backend -D_GLIBCXX_USE_CXX11_ABI=1
cc1plus: warning: command line option ‘-Wstrict-prototypes’ is valid for C/ObjC but not for C++
In file included from PNS_Module/sa_ext.cpp:3:0:
PNS_Module/utils.h:6:10: fatal error: cuda.h: 没有那个文件或目录
#include <cuda.h>
^~~~~~~~
compilation terminated.
error: command 'gcc' failed with exit status 1

无法复现论文精度

您好,我阅读了您在VPS任务上的工作,是非常优秀和solid的工作,但是我在使用您的代码复现论文结果的过程当中遇到了一些问题,在您给出的三个数据集上很难达到论文给出的指标性能(尤其是cvc-colon-300上maxIOU和maxDice指标相差将近8、9个点)。
我的训练方式参照预训练100epochs + 微调1个epoch的方式,超参的设置使用了config.py文件中给出的设置,并且在微调时候替换了pretrained的路径。

从头训练没有达到论文中的精度

作者您好,我用您的代码从头训练但是测试结果并没有达到论文中给的精度,尤其在CVC-ColonDB-300数据集上,精度会差将近10个百分点,请问这是怎么回事呢,方便邮箱沟通一下吗

Some questions about the NL module

Hello
I would like to ask why it needs to redefine the backward for NL modules, instead of writing the module and using the backward in pytorch, because of the "processing" operation?
I am not familiar with custom functions and I hope you can answer this for me.

数据集已经失效了

作者,您好!论文中的数据集链接失效了,能提供以下最新的连接吗?

Could you provide the training file?

I encounter a problem when I am trying to implement your work on my own(video shadow segmentation). The Normalized Self-attention block does not work as you do.

关于训练模型的问题

Remember to configure the pretrain_state_dict in config.py for different training stages 这个是什么文件?可以提供一下吗?

Training problem

您好,请问这个是怎么回事
/PNS-Net-main/lib/PNS/self_cuda_backend.cpython-36m-x86_64-linux-gnu.so: undefined symbol: _ZN3c105ErrorC1ENS_14SourceLocationERKS

Thanks for the excellent job!

Thanks for the excellent job!
There is my questions:

  1. I am confused about the file PNS-Finetune.pth that you provide in the "Training/Testing" part. Whether it is the final weights or the pre-trained weights?
  2. Could you please explain the 'max' in the metrics 'maxDice', 'maxSpc' and 'maxIoU'?
  3. I find something wrong in the file utils/dataloader.py, where the variate 'begin' is supposed to be set to 0 not 1 in class VideoDataset. The file MyTest_Finetune.py is the case.
    It would be very grateful if you could answer my questions.

训练技巧提问

尊敬的作者您好,我在尝试复现您的论文PNS-Net网络,在您提供的数据集上进行预训练和微调,测试结果在Dataset:CVC-ColonDB-300数据集上没有达到论文中给的精度,三个训练集的评价指标结果如下。

(Dataset:CVC-ClinicDB-612-Test) meanDic:0.774;meanIoU:0.696;wFm:0.765;Sm:0.864;meanEm:0.857;MAE:0.051;maxEm:0.884;maxDice:0.803;maxIoU:0.729;meanSen:0.757;maxSen:0.992;meanSpe:0.975;maxSpe:0.985.
(Dataset:CVC-ClinicDB-612-Valid) meanDic:0.843;meanIoU:0.756;wFm:0.824;Sm:0.922;meanEm:0.936;MAE:0.013;maxEm:0.966;maxDice:0.883;maxIoU:0.810;meanSen:0.862;maxSen:0.991;meanSpe:0.968;maxSpe:0.978.
(Dataset:CVC-ColonDB-300) meanDic:0.654;meanIoU:0.551;wFm:0.617;Sm:0.838;meanEm:0.797;MAE:0.025;maxEm:0.835;maxDice:0.693;maxIoU:0.590;meanSen:0.764;maxSen:1.000;meanSpe:0.978;maxSpe:0.990.

麻烦请教一下您,训练模型时有什么其他的技巧吗?另外,预训练和微调之后的网络模型测试评价指标差距不是很大,可以增加微调epoch或者有其他方法增强微调网络的性能吗?多有打扰。

Pretrain【epoch100】

(Dataset:CVC-ClinicDB-612-Test) meanDic:0.771;meanIoU:0.693;wFm:0.770;Sm:0.856;meanEm:0.852;MAE:0.050;maxEm:0.888;maxDice:0.811;maxIoU:0.736;meanSen:0.734;maxSen:0.992;meanSpe:0.974;maxSpe:0.983.

Finetune【epoch1】

(Dataset:CVC-ClinicDB-612-Test) meanDic:0.774;meanIoU:0.696;wFm:0.765;Sm:0.864;meanEm:0.857;MAE:0.051;maxEm:0.884;maxDice:0.803;maxIoU:0.729;meanSen:0.757;maxSen:0.992;meanSpe:0.975;maxSpe:0.985.

Training Code?

Where is the MyTrain_Pretrain.py and MyTrain_finetune.py file?

执行setup.py报错问题

14dabba700a479753e145aa0d51d596
dc310c7c18e9b6c18a946343031f30b
您好,打扰一下,想问一下我在执行setup.py时出现如图所示错误可能是什么原因呢,python3.6,cuda12.0,cudatoolkit=10.0

缺少文件

ModuleNotFoundError: No module named 'self_cuda_backend'
工程需要 self_cuda_backend 文件吧,谢谢解惑!

训练技巧和数据集的分配

    您好,我最近有关注你们的工作,十分地出色!但是我遇到了一些问题,首先是我使用了你们的方法,无法达到你们的精度,我想问问您有没有使用一些tricks,还有您们的工作会再更新pytorch版本吗?下一个疑问是,对于您们的数据集的划分还是存在一些困惑,IVPS-TrainSet这个数据集是不是没有用到?验证集和测试集是用相同的吗?还是怎么去处理?
     期待您的回复,谢谢

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.