Home

Awesome

<div align="center"> <a href="http://camma.u-strasbg.fr/"> <img src="files/CammaLogo.png" width="18%"> </a> </div> <br/>

PyTorch TensorFlow

Rendezvous: Attention Mechanisms for the Recognition of Surgical Action Triplets in Endoscopic Videos

<i>C.I. Nwoye, T. Yu, C. Gonzalez, B. Seeliger, P. Mascagni, D. Mutter, J. Marescaux, and N. Padoy</i>

<img src="files/examples-1.png" width="100%">

This repository contains the implementation code, inference demo, and evaluation scripts. <br /> Read on ArXiv Journal Publication PWC

Abstract

Out of all existing frameworks for surgical workflow analysis in endoscopic videos, action triplet recognition stands out as the only one aiming to provide truly fine-grained and comprehensive information on surgical activities. This information, presented as <instrument, verb, target> combinations, is highly challenging to be accurately identified. Triplet components can be difficult to recognize individually; in this task, it requires not only performing recognition simultaneously for all three triplet components, but also correctly establishing the data association between them.

To achieve this task, we introduce our new model, the <i> Rendezvous</i> (RDV), which recognizes triplets directly from surgical videos by leveraging attention at two different levels. We first introduce a new form of spatial attention to capture individual action triplet components in a scene; called <i> Class Activation Guided Attention Mechanism</i> (CAGAM). This technique focuses on the recognition of verbs and targets using activations resulting from instruments. To solve the association problem, our RDV model adds a new form of semantic attention inspired by Transformer networks; <i> Multi-Head of Mixed Attention</i> (MHMA). This technique uses several cross and self attentions to effectively capture relationships between instruments, verbs, and targets.

We also introduce <i> CholecT50</i> - a dataset of 50 endoscopic videos in which <i>every</i> frame has been annotated with labels from 100 triplet classes. Our proposed RDV model significantly improves the triplet prediction mAP by over 9% compared to the state-of-the-art methods on this dataset.

<br />

News and Updates

<br />

Model Overview

<img src="files/rdv.png" width="38%" align="right" >

The RDV model is composed of:

We hope this repo will help researches/engineers in the development of surgical action recognition systems. For algorithm development, we provide training data, baseline models and evaluation methods to make a level playground. For application usage, we also provide a small video demo that takes raw videos as input without any bells and whistles.

<br />

Performance

Results Table

Components APAssociation AP
AP<sub>I</sub>AP<sub>V</sub>AP<sub>T</sub>AP<sub>IV</sub>AP<sub>IT</sub>AP<sub>IVT</sub>
92.060.738.339.436.929.9
<br />

Video Demo

<a href="https://www.youtube.com/watch?v=d_yHdJtCa98&t=61s"><img src="files/vid.png" width="20.2%" ></a>

Available on Youtube.

<br />

Installation

Requirements

The model depends on the following libraries:

  1. sklearn
  2. PIL
  3. Python >= 3.5
  4. ivtmetrics
  5. Developer's framework:
    1. For Tensorflow version 1:
      • TF >= 1.10
    2. For Tensorflow version 2:
      • TF >= 2.1
    3. For PyTorch version:
      • Pyorch >= 1.10.1
      • TorchVision >= 0.11
<br />

System Requirements:

The code has been test on Linux operating system. It runs on both CPU and GPU. Equivalence of basic OS commands such as unzip, cd, wget, etc. will be needed to run in Windows or Mac OS.

<br />

Quick Start

<br />

Docker Example

coming soon . . .

<br />

Dataset Zoo

<br />

Data Preparation

<br />

Evaluation Metrics

The ivtmetrics computes AP for triplet recognition. It also support the evaluation of the recognition of the triplet components.

pip install ivtmetrics

or

conda install -c nwoye ivtmetrics

Usage guide is found on pypi.org.

<br />

Running the Model

The code can be run in a trianing mode (-t) or testing mode (-e) or both (-t -e) if you want to evaluate at the end of training :

<br />

Training on CholecT45/CholecT50 Dataset

Simple training on CholecT50 dataset:

python run.py -t  --data_dir="/path/to/dataset" --dataset_variant=cholect50 --version=1

You can include more details such as epoch, batch size, cross-validation and evaluation fold, weight initialization, learning rates for all subtasks, etc.:

python3 run.py -t -e  --data_dir="/path/to/dataset" --dataset_variant=cholect45-crossval --kfold=1 --epochs=180 --batch=64 --version=2 -l 1e-2 1e-3 1e-4 --pretrain_dir='path/to/imagenet/weights'

All the flags can been seen in the run.py file. The experimental setup of the published model is contained in the paper.

<br />

Testing

python3 run.py -e --data_dir="/path/to/dataset" --dataset_variant=cholect45-crossval --kfold 3 --batch 32 --version=1 --test_ckpt="/path/to/model-k3/weights"
<br />

Training on Custom Dataset

Adding custom datasets is quite simple, what you need to do are:

<br />

Model Zoo

PyTorch

NetworkBaseResolutionDatasetData splitModel Weights
RendezvousResNet-18LowCholecT50RDVDownload<!--(https://s3.unistra.fr/camma_public/github/rendezvous/rendezvous_l8_cholect50_batchnorm_lowres.pth)-->
RendezvousResNet-18HighCholecT50RDV[Download]
RendezvousResNet-18LowCholecT50ChallengeDownload
RendezvousResNet-18LowCholecT50crossval k1Download
RendezvousResNet-18LowCholecT50crossval k2Download
RendezvousResNet-18LowCholecT50crossval k3Download
RendezvousResNet-18LowCholecT50crossval k4Download
RendezvousResNet-18LowCholecT50crossval k5Download
RendezvousResNet-18LowCholecT45crossval k1Download
RendezvousResNet-18LowCholecT45crossval k2Download
RendezvousResNet-18LowCholecT45crossval k3Download
RendezvousResNet-18LowCholecT45crossval k4Download
RendezvousResNet-18LowCholecT45crossval k5Download
<br />

TensorFlow v1

NetworkBaseResolutionDatasetData splitLink
RendezvousResNet-18HighCholecT50RDV[Download]
RendezvousResNet-18HighCholecT50Challenge[Download]
RendezvousResNet-18HighCholecT50Challenge[Download]
<br />

TensorFlow v2

NetworkBaseResolutionDatasetData splitLink
RendezvousResNet-18HighCholecT50RDV[Download]
RendezvousResNet-18LowCholecT50RDV[Download]
<br />

Baseline Models

TensorFlow v1

ModelLayer SizeAblation ComponentAP<sub>IVT</sub>Link
Rendezvous1Proposed24.6[Download]
Rendezvous2Proposed27.0[Download]
Rendezvous4Proposed27.3[Download]
Rendezvous8Proposed29.9[Download]
Rendezvous8Patch sequence24.1[Download]
Rendezvous8Temporal sequence--.--[Download]
Rendezvous8Single Self Attention Head18.8[Download]
Rendezvous8Multiple Self Attention Head26.1[Download]
Rendezvous8CholecTriplet2021 Challenge Model32.7[Download]

Model weights are released periodically because some training are in progress.

<br /><br />


License

This code, models, and datasets are available for non-commercial scientific research purposes provided by CC BY-NC-SA 4.0 LICENSE attached as LICENSE file. By downloading and using this code you agree to the terms in the LICENSE. Third-party codes are subject to their respective licenses.

<br />

Acknowledgment

This work was supported by French state funds managed within the Investissements d'Avenir program by BPI France in the scope of ANR project CONDOR, ANR Labex CAMI, ANR DeepSurg, ANR IHU Strasbourg and ANR National AI Chair AI4ORSafety. We thank the research teams of IHU and IRCAD for their help in the initial annotation of the dataset during the CONDOR project.

<br />

<img src="files/ihu.png" width="6%" align="right" > <img src="files/davenir.png" width="8%" align="right"> <img src="files/bpi.png.svg" width="14%" align="right"> <img src="files/ircad.png" width="10%" align="right"> <img src="files/hopital.png" width="7%" align="right">
<img src="files/condor.png" width="10%" align="right">

<br /> <br />

Related Resources

<b> </b> <br />

Citation

If you find this repo useful in your project or research, please consider citing the relevant publications:

@article{nwoye2021rendezvous,
  title={Rendezvous: Attention Mechanisms for the Recognition of Surgical Action Triplets in Endoscopic Videos},
  author={Nwoye, Chinedu Innocent and Yu, Tong and Gonzalez, Cristians and Seeliger, Barbara and Mascagni, Pietro and Mutter, Didier and Marescaux, Jacques and Padoy, Nicolas},
  journal={Medical Image Analysis},
  volume={78},
  pages={102433},
  year={2022}
}
@article{nwoye2022data,
  title={Data Splits and Metrics for Benchmarking Methods on Surgical Action Triplet Datasets},
  author={Nwoye, Chinedu Innocent and Padoy, Nicolas},
  journal={arXiv preprint arXiv:2204.05235},
  year={2022}
}
@article{nwoye2021rendezvous,
  title={Rendezvous: Attention Mechanisms for the Recognition of Surgical Action Triplets in Endoscopic Videos},
  author={Nwoye, Chinedu Innocent and Yu, Tong and Gonzalez, Cristians and Seeliger, Barbara and Mascagni, Pietro and Mutter, Didier and Marescaux, Jacques and Padoy, Nicolas},
  journal={Medical Image Analysis},
  volume={78},
  pages={102433},
  year={2022}
}
@inproceedings{nwoye2020recognition,
   title={Recognition of instrument-tissue interactions in endoscopic videos via action triplets},
   author={Nwoye, Chinedu Innocent and Gonzalez, Cristians and Yu, Tong and Mascagni, Pietro and Mutter, Didier and Marescaux, Jacques and Padoy, Nicolas},
   booktitle={International Conference on Medical Image Computing and Computer-Assisted Intervention (MICCAI)},
   pages={364--374},
   year={2020},
   organization={Springer}
}
@article{nwoye2022cholectriplet2021,
  title={CholecTriplet2021: a benchmark challenge for surgical action triplet recognition},
  author={Nwoye, Chinedu Innocent and Alapatt, Deepak and Vardazaryan, Armine ... Gonzalez, Cristians and Padoy, Nicolas},
  journal={arXiv preprint arXiv:2204.04746},
  year={2022}
}

This repo is maintained by CAMMA. Comments and suggestions on models are welcomed. Check this page for updates.