File size: 2,040 Bytes
bb8ad5a
 
 
8e6e706
 
 
48c6466
8e6e706
 
 
48c6466
8e6e706
 
 
48c6466
8e6e706
 
 
48c6466
8e6e706
 
 
 
 
 
 
 
 
 
 
 
48c6466
8e6e706
 
 
48c6466
 
 
8e6e706
 
 
 
 
 
 
 
48c6466
 
 
 
8e6e706
48c6466
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
---
license: apache-2.0
---

# InsectSAM: Insect Segmentation and Monitoring

![rb-ibdm-banner](https://github.com/martintmv-git/RB-IBDM/assets/101264514/a22f2069-e3c8-4a4f-a314-59cb01b39b66)

## Overview

InsectSAM is a fine-tuned version of Meta AI's `segment-anything` model, optimized for insect segmentation and monitoring in the Netherlands. Designed for use with the [DIOPSIS](https://diopsis.eu) camera systems, algorithms and datasets, it enhances the accuracy of insect biodiversity segmentation from complex backgrounds.

## Purpose

Trained to segment insects against diverse backgrounds, InsectSAM adapts to changing environments, ensuring its long-term utility for the DIOPSIS datasets.

## Model Architecture

Built on the `segment-anything` architecture, InsectSAM is fine-tuned on an insect-specific dataset and integrated with GroundingDINO for improved detail recognition.

## Quick Start

### Prerequisites

- Python
- Hugging Face Transformers
- PyTorch

### Usage

#### Install 
```bash
!pip install --upgrade -q git+https://github.com/huggingface/transformers
!pip install torch
```

#### Load model via 🤗 Transformers
```python
from transformers import AutoProcessor, AutoModelForMaskGeneration

processor = AutoProcessor.from_pretrained("martintmv/InsectSAM")
model = AutoModelForMaskGeneration.from_pretrained("martintmv/InsectSAM")
```

### Notebooks

Explore InsectSAM's capabilities and integration with GroundingDINO through three Jupyter notebooks available on the RB-IBDM GitHub page:
- [**InsectSAM.ipynb**](https://github.com/martintmv-git/RB-IBDM/blob/main/InsectSAM/InsectSAM.ipynb): Training process
- [**InsectSAM_GroundingDINO.ipynb**](https://github.com/martintmv-git/RB-IBDM/blob/main/InsectSAM/InsectSAM_GroundingDINO.ipynb): Enhanced segmentation performance with GroundingDINO
- [**InsectSAM_script.ipynb**](https://github.com/martintmv-git/RB-IBDM/tree/main/Image%20Processing%20Scripts/InsectSAM): Image processing script

GitHub: https://github.com/martintmv-git/RB-IBDM/tree/main/InsectSAM