A tkinter-based, minimalistic utility for pixel-wise image annotation with support for SAM-based prompting.
The file requirements.txt contains the necessary Python packages for this project. To install, run:
pip install -r requirements.txtNext, download SAM vit_b model checkpoint from their GitHub repository, and place it in the assets directory.
assets/sam_vit_b_01ec64.pth
To start the application, run the main script from the project root:
python3 main.pyAlternatively, self-contained executables built via PyInstaller are available on the Releases page for Windows and macOS. These builds can be directly executed without a local Python environment or external dependencies.
-
Load the dataset
Select the directory containing image files (
.png,.jpg,.jpeg,.tiff,.npy), followed by a.csvfile containing the color map. Ensure that the color map is properly formatted:Label,HexCode. For example,Target,ff0000 Background,ffffff
-
Optionally load masks
Select the directory containing existing masks for updating.
-
Select mode
- Polygon: Draw polygons with
left-click, and fill regions withright-click, or fill the entire image withreturn. - Brush: Paint freehand masks using adjustable brush size.
- Prompt: Place positive (
left-click) and negative (right-click) points to prompt SAM for automatic prompt generation.
- Polygon: Draw polygons with
-
Additional Features
- Use
Left/Rightarrow keys to navigate between images in the directory . - Use
Up/Downarrow keys to zoom in and out. Ctrl+Clickon a pixel to copy its class ID; useful for replacing or updating annotated segments.- Optionally enter textual comments/notes for each image.
- A
.logfile is generated to track annotation progress.
- Use
-
Save annotations
Masks are saved as
.pngfiles in a subdirectory calledsegmented/within the image directory. Textual comments, if any, are stored in.txtfiles corresponding to each image.
If you find this repository useful, please consider giving us a star ⭐
@misc{rajani2025benthicat,
title={BenthiCat: An opti-acoustic dataset for advancing benthic classification and habitat mapping},
author={Hayat Rajani and Valerio Franchi and Borja Martinez-Clavel Valles and Raimon Ramos and Rafael Garcia and Nuno Gracias},
year={2025},
eprint={2510.04876},
archivePrefix={arXiv},
primaryClass={cs.CV}
}