← Open Source
luca-medeiros

lightning-sam

Fine-tune Segment-Anything Model with Lightning Fabric.

Model DevelopmentFine-tuningPython
Open on GitHub
Momentum
+0stars in 24 hours0.0%
572
Stars
53
Forks
+0
This week
3
Contributors
Created 2023-04-21 · Updated 2026-09-05 · #16794 today
Top developers
luca-medeirosGarfield-hrwiekern

luca-medeiros/lightning-sam is ranked 16,794 with 572 stars.

Same-category comparison

luca-medeiros/lightning-sam is ranked 16,794 among these 8 peers; open-nudge/torchlayers is ranked 16,795.

Same-category comparison
NameRankMetrics
aqibsaeed/Multilabel-timeseries-classification-with-LSTM16,781
Language:
Jupyter Notebook
Stars:
572
Forks:
183
Description:
Tensorflow implementation of paper: Learning to Diagnose with LSTM Recurrent Neural Networks.
google-research-datasets/paws16,788
Language:
Python
Stars:
572
Forks:
54
Description:
This dataset contains 108,463 human-labeled and 656k noisily labeled pairs that feature the importance of modeling structure, context, and word order information for the problem of paraphrase identification.
hkust-nlp/CodeIO16,790
Language:
Python
Stars:
572
Forks:
35
Description:
[ICML 2025 Oral] CodeI/O: Condensing Reasoning Patterns via Code Input-Output Prediction.
leftthomas/SimCLR16,791
Language:
Python
Stars:
572
Forks:
114
Description:
A PyTorch implementation of SimCLR based on ICML 2020 paper "A Simple Framework for Contrastive Learning of Visual Representations".
open-nudge/torchlayers16,795
Language:
Python
Stars:
572
Forks:
45
Description:
Shape and dimension inference (Keras-like) for PyTorch layers and neural networks.
salesforce/PyRCA16,797
Language:
Python
Stars:
572
Forks:
70
Description:
PyRCA: A Python Machine Learning Library for Root Cause Analysis.
torrvision/siamfc-tf16,798
Language:
Python
Stars:
572
Forks:
184
Description:
SiamFC tracking in TensorFlow.
KaihuaTang/Long-Tailed-Recognition.pytorch16,804
Language:
Jupyter Notebook
Stars:
571
Forks:
70
Description:
[NeurIPS 2020] This project provides a strong single-stage baseline for Long-Tailed Classification, Detection, and Instance Segmentation (LVIS). It is also a PyTorch implementation of the NeurIPS 2020 paper 'Long-Tailed Classification by Keeping the Good and Removing the Bad Momentum Causal Effect'.
Key parameters and specifications
Key parameters and specifications
ParameterValue
LanguagePython
CategoryModel Development
SubcategoryFine-tuning
KeywordsComputer vision, Datasets
Stars572
Forks53
Contributors3
Created date2023-04-21
Updated date2026-09-05
Stars in 1 day0
Stars in 7 days0
Rank16,794
Previous rank16,587
Rank change-207
7-day stars rank15,729
Previous 7-day stars rank15,741
7-day stars rank change12
Total stars rank17,438
Previous total stars rank17,409
Total stars rank change-29
CountrySouth Korea
README summary

Lightning Segment-Anything Model This library allows you to fine-tune the powerful Segment-Anything model from MetaAI for your custom COCO-format datasets. The library is built on top of Lightning AI's Fabric framework, providing an efficient and easy-to-use implementation for achieving state-of-the-art instance segmentation results. This repo is an experiment; A PoC to see if fine-tuning SAM using bounding boxes as prompts would increase the IoU or improve the quality of the

masks in general. One can use a COCO format dataset to fine-tune SAM for a specific task where SAM does not perform well (e. , segmenting text on documents) and then use that model with interactive prompts just like SAM. For generating bboxes from text and prompt them to SAM you may check: lang-segment-anything Features Supports custom COCO-format datasets Built on Lightning AI's Fabric framework Efficient fine-tuning of Segment-Anything model from MetaAI Includes training and

validation loops Results Using bbox prompt, the table below shows the mask quality of the original and fine-tuned models. 9298 | 19 | Comparison images TrashCan 1. 0 GT | 6 Epochs Fine-tuned SAM | Original SAM Installation Quick Start 1. Prepare your custom COCO-format dataset. The dataset should include a JSON file with annotations and an images folder with corresponding images. Notes Uses the original implementation of SAM. Loss calculated as stated on the paper (20 * focal loss + dice loss

+ mse loss). Only supports bounding box input prompts. Resources Segment Anything Lightning AI License This project is licensed same as SAM model.

Frequently asked questions

How many stars and forks are recorded?

luca-medeiros/lightning-sam has 572 stars and 53 forks.

What is the repository rank?

luca-medeiros/lightning-sam is ranked 16,794.

What language and category are recorded?

luca-medeiros/lightning-sam has 572 stars, uses Python and belongs to Model Development.

Which repository is closest in rank?

luca-medeiros/lightning-sam is compared with open-nudge/torchlayers, ranked 16,795 with 572 stars.

README

Lightning Segment-Anything Model

This library allows you to fine-tune the powerful Segment-Anything model from MetaAI for your custom COCO-format datasets. The library is built on top of Lightning AI's Fabric framework, providing an efficient and easy-to-use implementation for achieving state-of-the-art instance segmentation results.

This repo is an experiment; A PoC to see if fine-tuning SAM using bounding boxes as prompts would increase the IoU or improve the quality of the masks in general. One can use a COCO format dataset to fine-tune SAM for a specific task where SAM does not perform well (e.g., segmenting text on documents) and then use that model with interactive prompts just like SAM.

For generating bboxes from text and prompt them to SAM you may check: lang-segment-anything

Features

  • Supports custom COCO-format datasets
  • Built on Lightning AI's Fabric framework
  • Efficient fine-tuning of Segment-Anything model from MetaAI
  • Includes training and validation loops

Results

Using bbox prompt, the table below shows the mask quality of the original and fine-tuned models.

Dataset Type Mean IoU Mean F1 Epoch
COCO2017 Original SAM 0.7978 0.8749
COCO2017 Fine-tuned 0.8070 0.8816 2
TrashCan 1.0 Original SAM 0.6643 0.7808
TrashCan 1.0 Fine-tuned 0.7888 0.8738 5
TrashCan 1.0 Fine-tuned 0.8000 0.8795 14
WGISD Original SAM 0.8536 0.9178
WGISD Fine-tuned 0.8732 0.9298 19

Comparison images

TrashCan 1.0 GT | 6 Epochs Fine-tuned SAM | Original SAM

Installation

git clone https://github.com/luca-medeiros/lightning-sam.git
cd lightning-sam
pip install .

Quick Start

  1. Prepare your custom COCO-format dataset. The dataset should include a JSON file with annotations and an images folder with corresponding images.

  2. Edit src/config.py with your dataset paths.

  3. Run src/train.py.

Notes

  • Uses the original implementation of SAM.
  • Loss calculated as stated on the paper (20 * focal loss + dice loss + mse loss).
  • Only supports bounding box input prompts.

Resources

License

This project is licensed same as SAM model.

Nearby in the ranking
Similar items