Skip to content

Implementation code of the paper "B2Q-Net: Bidirectional Branch Query Network for Online Surgical Phase Recognition"

License

Notifications You must be signed in to change notification settings

vsislab/B2Q-Net

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

24 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

B2Q-Net

This repository contains the code for B2Q-Net: Bidirectional Branch Query Network for Online Surgical Phase Recognition.

Overview

Overview

Installation

The project was modified from BNpitfalls, thanks for their wonderful work!

  • Recommended Environment: python 3.9, Cuda11.6, PyTorch 1.12.0
  • Install dependencies: pip install -r requirements.txt

Data Preparation

Step 1:

Download Cholec80, M2CAI16 and AutoLaparo datasets
  • Access can be requested Cholec80, M2CAI16, AutoLaparo.
  • Download the videos for each datasets and extract frames at 1fps. E.g. for video01.mp4 with ffmpeg, run:
mkdir /<PATH_TO_THIS_FOLDER>/data/frames_1fps/01/
ffmpeg -hide_banner -i /<PATH_TO_VIDEOS>/video01.mp4 -r 1 -start_number 0 /<PATH_TO_THIS_FOLDER>/data/frames_1fps/01/%08d.jpg
  • The final dataset structure should look like this:
Cholec80/
	data/
		frames_1fps/
			01/
				00000001.jpg
				00000002.jpg
				00000003.jpg
				00000004.jpg
				...
			02/
				...
			...
			80/
				...
		phase_annotations/
			video01-phase.txt
			video02-phase.txt
			...
			video80-phase.txt
		tool_annotations/
			video01-tool.txt
			video02-tool.txt
			...
			video80-tool.txt
	output/
	train_scripts/
	predict.sh
	train.sh

Step 2:

Download pretrained models (ConvNeXt-T and ConvNeXt V2-T)
  • download ConvNeXt-T weights and place here: train_scripts/convnext/convnext_tiny_1k_224_ema.pth
  • download ConvNeXt V2-T weights and place here: train_scripts/convnext/convnextv2_tiny_1k_224_ema.pt

Training and Testing

  • We have provided a script list that allows you to replicate our results with just a single click. Further details can be found in ./run.sh

About

Implementation code of the paper "B2Q-Net: Bidirectional Branch Query Network for Online Surgical Phase Recognition"

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published