百科.dev
全部条目在线工具AI 编程趋势榜开源项目技术资讯提交条目
登录
< 返回工具列表
L

LEMON

> 编程语言
开源

[CVPR 2026] 论文"LEMON: 一个大型内镜单眼数据集和外科环境感知基础模型"的官方仓库。

100 stars0 点赞0 次浏览
访问官网GitHub

工具介绍

[CVPR 2026] 论文"LEMON: 一个大型内镜单眼数据集和外科环境感知基础模型"的官方仓库。

News

Star ⭐ us if you like it!

  • [Feb 2026] LEMON has been accepted to the CVPR 2026 main conference!
  • [Feb 2026] Our latest work, PL-Stitch, has also been accepted to the CVPR 2026 main conference! It introduces a novel self-supervised pretraining method for procedural video understanding, delivering a more powerful and efficient foundation model for perception in surgical settings.
  • [Aug 2025] Our project is now known as LEMON, formerly Surg-3M.
  • [Mar 2025] The arXiv version of the paper is released.

This is the official repository for the paper "LEMON: A Large Endoscopic MONocular Dataset and Foundation Model for Perception in Surgical Settings".

This repository provides open access to the LEMON dataset, LemonFM foundation model, and training code.

LEMON is a dataset of over 4K surgical high-resolution videos totaling 938 hours from 35 diverse surgical procedure types. Each video is annotated for multi-label classification, indicating the surgical procedures carried out in the video, and for binary classification, indicating if it is robotic or non-robotic. The dataset's annotations can be found in labels.json.

LemonFM is a foundation model for surgery, it receives an image as input and produces a feature vector of 1536 features as output.

If you use our dataset, model, or code in your research, please cite our paper:

@InProceedings{Che_2026_CVPR_LEMON,
    author    = {Che, Chengan and Wang, Chao and Vercauteren, Tom and Tsoka, Sophia and Garcia-Peraza-Herrera, Luis C.},
    title     = {LEMON: A Large Endoscopic MONocular Dataset and Foundation Model for Perception in Surgical Settings},
    booktitle = {Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition (CVPR)},
    month     = {June},
    year      = {2026},
    pages     = {42659-42669}
}

Abstract

Traditional open-access datasets focusing on surgical procedures are often limited by their small size, typically consisting of fewer than 100 videos and less than 30 hours of footage, which leads to poor model generalization. To address this constraint, a new dataset called LEMON 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 totaling 938 hours (85 million frames) of high-quality footage across multiple procedure types, LEMON offers a comprehensive resource surpassing existing alternatives in size and scope, including two novel downstream tasks. To demonstrate the effectiveness of this diverse dataset, we introduce LemonFM, a foundation model pretrained on LEMON using a novel self-supervised augmented knowledge distillation approach. LemonFM consistently outperforms existing surgical foundation models across four downstream tasks and six datasets, achieving significant gains in surgical phase recognition (+9.5pp, +9.4pp, and +8.4pp of Jaccard in AutoLaparo, M2CAI16, and Cholec80), surgical action recognition (+4.4pp of mAP in CholecT50), surgical tool presence detection (+5.3pp and +10.2pp of mAP in Cholec80 and GraSP), and surgical semantic segmentation (+8.3pp of mDice in CholecSeg8k). LEMON and LemonFM will serve as foundational resources for the research community and industry, accelerating progress in developing autonomous robotic surgery systems and ultimately contributing to safer and more accessible surgical care worldwide.

Install dependencies to recreate our LEMON dataset

  • Install the following dependencies in your local setup:

    bash
    git clone [email protected]:visurg-ai/LEMON.git
    cd LEMON && pip install -r requirements.txt
  • Models used in data curation. We provide the models used in our data curation pipeline to assist with constructing the LEMON dataset, including video storyboard classification models, frame classification models, and non-surgical object detection models. The models can be downloaded from LEMON curation models.

️ LEMON dataset

Researchers working in academic institutions can request direct access to the full LEMON dataset for non-commercial purposes by filling the request form in our Website and HuggingFace)

You can use our code of the data curation pipeline and provided annotation file ("labels.json") to recreate the whole LEMON dataset.

  1. Get your YouTube cookie:

    You need to provide a "cookies.txt" file if you want to download videos that require Youtube login.

    Use the cookies extension to export your Youtube cookies as "cookies.txt".

  2. Download the annotation file ("labels.json") and use the video downloader to download the original selected Youtube videos.

    bash
    python3 src/video_downloader.py --video-path '../labels.json' --output 'your path to store the downloaded videos' --cookies 'your YouTube cookie file'
  3. Curate the downloaded original videos as LEMON video dataset. In detail, use the video_processor to classify each frame as either 'surgical' or 'non-surgical', then remove the beginning and end segments of non-surgical content from the videos, and mask the non-surgical regions in 'surgical' frames and the entire 'non-surgical' frames.

    bash
    python3 src/video_processor.py --input 'your original downloaded video storage path' --input-json '../labels.json' --output 'your path to store the curated videos and their corresponding frame annotation files' --classify-models 'frame classification model' --segment-models 'non-surgical object detection models'
  4. Process the LEMON video dataset as LEMON image dataset (For foundation model pre-training).

    bash
    python3 src/create_lmdb_LEMON.py --video-folder 'your directory containing the curated videos and their corresponding frame annotation files' --output-json 'your path for the json file to verify the videos and labels alignment' --lmdb-path 'your lmdb storage path'

The video processing pipeline leading to the clean videos in the LEMON dataset is as follows:

LemonFM model

Model Checkpoints:

You can download the LemonFM full checkpoint which contains backbone and projection head weights for both student and teacher networks at LemonFM.

Pretraining Execution:

To launch the pretraining routine, use torch.distributed.run. Ensure the --data_path and --output_dir parameters are mapped to your local environment.

bash
python3 -m torch.distributed.run --nproc_per_node=8 --nnodes=1 lemonfm/lemonfm.py --arch convnext_large --data_path 'LEMON dataset lmdb path' --output_dir 'your path to store the trained foundation model' --batch_size_per_gpu 40 --num_workers 10

Evaluation

  1. Data Preparation

    LMDB is used by default for efficient data loading. Convert raw datasets with the following script:

    bash
    python src/create_lmdb.py \
        --image-folder [RAW_DATA_ROOT]/AutoLaparo/frames \
        --label-json [RAW_DATA_ROOT]/AutoLaparo/AutoLaparo.json \
        --lmdb-path [LMDB_OUTPUT_ROOT]/AutoLaparo \
        --image-size 224 224
  2. Fine-tuning and Evaluation

    The following scripts provide Fine-tuning and evaluation code for LemonFM using a linear head for surgical phase recognition, tool presence detection, and action recognition. For integrating fine-tuned LemonFM with a TCN head, refer to the official TeCNO repository.

    Surgical phase recognition:

    bash
    python3 downstream/train_phase_recognition_autolaparo.py --lr 1e-3 --opt adamW --nepochs 100 --bs 512 --cpdir 'path/to/store/checkpoint' --logdir 'path/to/store/log' --lmdb 'path/to/downstream_task/lmdb' --labels 'path/to/downstream_task/annotation' --seed 30 --pretrained-weights 'path/to/our/LemonFM.pth'
    
    python3 downstream/test_phase_recognition_autolaparo.py --lmdb 'path/to/downstream_task/lmdb' --models 'path/to/your/cpdir' --labels 'path/to/downstream_task/annotation'

    Surgical tool presence detection:

    bash
    python3 downstream/train_tool_detection.py --lr 1e-4 --opt adam --nepochs 50 --bs 256 --cpdir 'path/to/store/checkpoint' --logdir 'path/to/store/log' --cpint 5 --kfold 5 --lmdb 'path/to/downstream_task/lmdb' --labels 'path/to/downstream_task/annotation' --seed 42 --pretrained-weights 'path/to/our/LemonFM.pth'
    
    python3 downstream/test_tool_detection.py --lmdb 'path/to/downstream_task/lmdb' --labels 'path/to/downstream_task/annotation' --models 'path/to/your/cpdir' --bs 256 --kfold 5 --pretrained-weights 'path/to/our/LemonFM.pth'

    Surgical action recognition:

    bash
     python3 downstream/train_cholecT50_action.py --lr 1e-4 --opt adam --nepochs 50 --bs 256 --cpdir 'path/to/store/checkpoint' --logdir 'path/to/store/log' --cpint 5 --kfold 5 --dataset-dir 'path/to/CholecT50/dataset' --pretrained-weights 'path/to/our/LemonFM.pth'
     
     python3 downstream/test_cholecT50_action.py --dataset-dir 'path/to/CholecT50/dataset' --models 'path/to/your/cpdir' --bs 256 --kfold 5 --pretrained-weights 'path/to/our/LemonFM.pth'

How to run our LemonFM foundation model to extract features from your video frames

python
import torch
from PIL import Image
from model_loader import build_LemonFM

# Load the pre-trained LemonFM model
LemonFM = build_LemonFM(pretrained_weights = 'your path to the LemonFM')
LemonFM.eval()

# Load the image and convert it to a PyTorch tensor
img_path = 'path/to/your/image.jpg'
img = Image.open(img_path)
img = img.resize((224, 224))
img_tensor = torch.tensor(np.array(img)).unsqueeze(0).to('cuda')

# Extract features from the image
outputs = LemonFM(img_tensor)

Tasks

Based on the annotation of the LEMON dataset, we propose two novel surgical downstream tasks:

  1. Multi-label (35 classes) video classification of procedure types.
  2. Binary video classification of surgery types.

Leaderboard for the proposed tasks
To establish a baseline for the two tasks proposed in LEMON, we conducted an evaluation of SotA approaches, which serves as a benchmark for future research endeavors.

Method
Procedure type
Surgery type




mAP (%)
F1-score (%)
Accuracy (%)
F1-score (%)




SlowFast
22.0
23.9
88.5
87.5




TimeSformer
42.1
37.5
93.2
92.7




MViTv2
49.5
41.8
95.8
94.6




Video Swin Transformer
51.4
47.9
98.8
98.7




LemonFM-Vid (ours)
57.8
49.3
98.9
98.9

Ethics

  • Sources. Our data collection targeted videos from medical institutions and surgeons, aiming to maximize compliance with professional consent standards.

  • Curation and identifiability. During data curation we spent a total of 106 hours annotating an

Issues· 1 开放

查看全部 Issues在 GitHub 打开

暂无开放 Issues,或尚未同步最近议题。

> 标签

Python

暂无评论,来聊聊你的看法吧

> 工具信息

发布日期2026年8月1日
最后更新2026年9月18日
分类编程语言
定价开源

> 相关工具

T
TypeScript
JavaScript 的超集,为前端与全栈提供静态类型
P
Python
通用编程语言,广泛用于 Web、数据与 AI
G
Go
Google 推出的简洁高效系统语言