Views
No views yet

@misc{che2025lemonlargeendoscopicmonocular,
title={LEMON: A Large Endoscopic MONocular Dataset and Foundation Model for Perception in Surgical Settings},
author={Chengan Che and Chao Wang and Tom Vercauteren and Sophia Tsoka and Luis C. Garcia-Peraza-Herrera},
year={2025},
eprint={2503.19740},
archivePrefix={arXiv},
primaryClass={cs.CV},
url={https://arxiv.org/abs/2503.19740},
}
1import torch
2import torchvision
3from PIL import Image
4from model_loader import build_model
5
6# Load the model
7net = build_model(mode='classify')
8model_path = 'Video storyboard classification models'
9
10# Enable multi-GPU support
11net = torch.nn.DataParallel(net)
12torch.backends.cudnn.benchmark = True
13state = torch.load(model_path, map_location=torch.device('cpu'))
14net.load_state_dict(state['net'])
15net.eval()
16
17# Load the video storyboard and convert it to a PyTorch tensor
18img_path = 'path/to/your/image.jpg'
19img = Image.open(img_path)
20img = img.resize((224, 224))
21transform = torchvision.transforms.Compose([
22 torchvision.transforms.ToTensor(),
23 torchvision.transforms.Normalize(
24 (0.4299694, 0.29676908, 0.27707579),
25 (0.24373249, 0.20208984, 0.19319402)
26 )
27])
28img_tensor = transform(img).unsqueeze(0).to('cuda')
29
30# Extract features from the image
31outputs = net(img_tensor)1import torch
2import torchvision
3from PIL import Image
4from model_loader import build_model
5
6# Load the model
7net = build_model(mode='classify')
8model_path = 'Frame classification models'
9
10# Enable multi-GPU support
11net = torch.nn.DataParallel(net)
12torch.backends.cudnn.benchmark = True
13state = torch.load(model_path, map_location=torch.device('cpu'))
14net.load_state_dict(state['net'])
15net.eval()
16
17img_path = 'path/to/your/image.jpg'
18img = Image.open(img_path)
19img = img.resize((224, 224))
20transform = torchvision.transforms.Compose([
21 torchvision.transforms.ToTensor(),
22 torchvision.transforms.Normalize(
23 (0.4299694, 0.29676908, 0.27707579),
24 (0.24373249, 0.20208984, 0.19319402)
25 )
26])
27img_tensor = transform(img).unsqueeze(0).to('cuda')
28
29# Extract features from the image
30outputs = net(img_tensor)1import torch
2import torchvision
3from PIL import Image
4from model_loader import build_model
5
6# Load the model
7net = build_model(mode='mask')
8model_path = 'Frame classification models'
9
10# Enable multi-GPU support
11net = torch.nn.DataParallel(net)
12torch.backends.cudnn.benchmark = True
13state = torch.load(model_path, map_location=torch.device('cpu'))
14net.load_state_dict(state['net'])
15net.eval()
16
17img_path = 'path/to/your/image.jpg'
18img = Image.open(img_path)
19img = img.resize((224, 224))
20transform = torchvision.transforms.Compose([
21 torchvision.transforms.ToTensor(),
22 torchvision.transforms.Normalize(
23 (0.4299694, 0.29676908, 0.27707579),
24 (0.24373249, 0.20208984, 0.19319402)
25 )
26])
27img_tensor = transform(img).unsqueeze(0).to('cuda')
28
29# Extract features from the image
30outputs = net(img_tensor)