chengan-jaime commited on
Commit
26417cb
·
1 Parent(s): 0327325

code update

Browse files
.ipynb_checkpoints/README-checkpoint.md DELETED
@@ -1,63 +0,0 @@
1
- ---
2
- license: apache-2.0
3
- ---
4
- <p align="center">
5
- <img src="https://github.com/user-attachments/assets/04f6e2eb-1380-448e-a3f6-eed3e9dbf177">
6
- </p>
7
-
8
- [📚 Paper](TODO) - [🤖 Code](src) - [🤗 Model](TODO)
9
-
10
- Star ⭐ us if you like it!
11
-
12
- <div align="center">
13
- <img src="https://github.com/user-attachments/assets/6250cd6a-1404-4786-9c15-fe396265940d" width="70%" > </img>
14
- </div>
15
-
16
-
17
- This is the official huggingface repository for the paper [Surg-3M: A Dataset and Foundation Model for Perception in Surgical Settings](TODO).
18
-
19
- This repository provides open access to the *Surg-FM* foundation model.
20
-
21
- *Surg-FM* is an image foundation model for surgery, it receives an image as input and produces a feature vector of 1536 features as output.
22
-
23
- <!--The website of our dataset is: [http://surg-3m.org](https://surg-3m.org)-->
24
-
25
- If you use our model in your research, please cite our paper:
26
-
27
- ```
28
- @inproceedings{Che2025,
29
- author = {Chengan Che and Chao Wang and Tom Vercauteren and Sophia Tsoka and Luis C. Garcia-Peraza-Herrera},
30
- booktitle = {TODO: use the correct arXiv citation here},
31
- month = {3},
32
- publisher = {arXiv},
33
- title = {Surg-3M: A Dataset and Foundation Model for Perception in Surgical Settings},
34
- year = {2025}
35
- }
36
- ```
37
-
38
- Abstract
39
- --------
40
- Advancements in computer-assisted surgical procedures heavily rely on accurate visual data interpretation from camera systems used during surgeries. Traditional open-access datasets focusing on surgical procedures are often limited by their small size, typically consisting of fewer than 100 videos with less than 100K images. To address these constraints, a new dataset called Surg-3M has been compiled using a novel aggregation pipeline that collects high-resolution videos from online sources. Featuring an extensive collection of over 4K surgical videos and more than 3 million high-quality images from multiple procedure types, Surg-3M offers a comprehensive resource surpassing existing alternatives in size and scope, including two novel tasks. To demonstrate the effectiveness of this dataset, we present SurgFM, a self-supervised foundation model pretrained on Surg-3M that achieves impressive results in downstream tasks such as surgical phase recognition, action recognition, and tool presence detection. Combining key components from ConvNeXt, DINO, and an innovative augmented distillation method, SurgFM exhibits exceptional performance compared to specialist architectures across various benchmarks. Our experimental results show that SurgFM outperforms state-of-the-art models in multiple downstream tasks, including significant gains in surgical phase recognition (+8.9pp, +4.7pp, and +3.9pp of Jaccard in AutoLaparo, M2CAI16, and Cholec80), action recognition (+3.1pp of mAP in CholecT50) and tool presence detection (+4.6pp of mAP in Cholec80). Moreover, even when using only half of the data, SurgFM outperforms state-of-the-art models in AutoLaparo and achieves state-of-the-art performance in Cholec80. Both Surg-3M and SurgFM have significant potential to accelerate progress towards developing autonomous robotic surgery systems.
41
-
42
-
43
- How to run our SurgFM foundation model to extract features from your video frames
44
- ----------------------------------------------------------------------------------
45
-
46
- ```python
47
- import torch
48
- from PIL import Image
49
- from model_loader import build_SurgFM
50
-
51
- # Load the pre-trained SurgFM model
52
- surgfm = build_SurgFM(pretrained_weights = 'your path to the SurgFM')
53
- surgfm.eval()
54
-
55
- # Load the image and convert it to a PyTorch tensor
56
- img_path = 'path/to/your/image.jpg'
57
- img = Image.open(img_path)
58
- img = img.resize((224, 224))
59
- img_tensor = torch.tensor(np.array(img)).unsqueeze(0).to('cuda')
60
-
61
- # Extract features from the image using the ResNet50 model
62
- outputs = surgfm(img_tensor)
63
- ```