samannot 0.6.1__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,61 @@
1
+ import tkinter as tk
2
+ class CircularProgress(tk.Canvas):
3
+ def __init__(self, parent, size=200, thickness=15,bg_color="#f5f5f5", track_color="#d0d4dc",progress_color_low="#6e5bff", progress_color_high="#ff4b7d", text_color="#222222",font=("Segoe UI", 11, "bold"), *args, **kwargs):
4
+ super().__init__(parent, width=size, height=size,bg=bg_color, highlightthickness=0, *args, **kwargs)
5
+ self.colors = self.color_gradient(progress_color_low,progress_color_high, 101)
6
+ pad = thickness // 2 + 4
7
+ self.radius_box = (pad, pad, size - pad, size - pad)
8
+ self.bg_arc_id = self.create_arc(self.radius_box,start=0, extent=359.9,outline=track_color,width=thickness,style=tk.ARC)
9
+ self.arc_id = self.create_arc(self.radius_box,start=90, extent=0,outline=progress_color_low,width=thickness,style=tk.ARC)
10
+ self.text_id = self.create_text(size//2, size//2,text="0%",fill=text_color,font=font)
11
+ def hex_to_rgb(self,hex_color):
12
+ hex_color = hex_color.lstrip("#")
13
+ return tuple(int(hex_color[i:i+2], 16) for i in (0, 2, 4))
14
+ def rgb_to_hex(self,rgb):
15
+ return "#{:02x}{:02x}{:02x}".format(*rgb)
16
+ def color_gradient(self,start_hex, end_hex, steps):
17
+ start_rgb = self.hex_to_rgb(start_hex)
18
+ end_rgb = self.hex_to_rgb(end_hex)
19
+ gradient = []
20
+ for i in range(steps):
21
+ t = i / (steps - 1) if steps > 1 else 1
22
+ rgb = tuple(int(start_rgb[j] + (end_rgb[j] - start_rgb[j]) * t) for j in range(3))
23
+ gradient.append(self.rgb_to_hex(rgb))
24
+ return gradient
25
+ def set_value(self, value: float, text = None):
26
+ value = max(0, min(100, float(value)))
27
+ angle = (value / 100) * 360
28
+ self.itemconfig(self.arc_id, extent=-angle)
29
+ self.itemconfig(self.arc_id, outline=self.colors[int(value)])
30
+ if text is None:
31
+ self.itemconfig(self.text_id, text=str(int(value))+"%")
32
+ else:
33
+ self.itemconfig(self.text_id, text=text)
34
+
35
+ class ToolTip:
36
+ def __init__(self, widget, text):
37
+ self.widget = widget
38
+ self.text = text
39
+ self.tip_window = None
40
+ widget.bind("<Enter>", self.show_tip)
41
+ widget.bind("<Leave>", self.hide_tip)
42
+ def show_tip(self, event=None):
43
+ if self.tip_window or not self.text:
44
+ return
45
+ self.tip_window = tk.Toplevel(self.widget)
46
+ self.tip_window.wm_overrideredirect(True)
47
+ label = tk.Label(self.tip_window,text=self.text,background="#ffffff",relief="solid",borderwidth=1,padx=5,pady=3)
48
+ label.pack()
49
+ self.tip_window.update_idletasks()
50
+ widget_x = self.widget.winfo_rootx()
51
+ widget_y = self.widget.winfo_rooty()
52
+ widget_w = self.widget.winfo_width()
53
+ tip_w = self.tip_window.winfo_width()
54
+ tip_h = self.tip_window.winfo_height()
55
+ x = widget_x + (widget_w // 2) - (tip_w // 2)
56
+ y = widget_y - tip_h - 5
57
+ self.tip_window.wm_geometry(f"{tip_w}x{tip_h}+{x}+{y}")
58
+ def hide_tip(self, event=None):
59
+ if self.tip_window:
60
+ self.tip_window.destroy()
61
+ self.tip_window = None
@@ -0,0 +1,118 @@
1
+ Metadata-Version: 2.4
2
+ Name: samannot
3
+ Version: 0.6.1
4
+ Summary: A memory-efficient, local interactive video instance segmentation annotation tool based on SAM 2
5
+ Author: Gergely Dinya, András Gelencsér, Krisztina Kupán, Clemens Küpper, Kristóf Karacs, Anna Gelencsér-Horváth
6
+ Maintainer: Hungarian Bionic Vision Center AI Lab
7
+ License-Expression: MIT
8
+ Keywords: annotation,automated annotation,image annotation,image labeling,data annotation,computer vision,image segmentation,instance segmentation,object detection,segment anything,SAM,OpenCV,deep learning,machine learning,contour analysis,thresholding,color segmentation,segmentation mask,bounding box annotation,annotation tool,annotation software,dataset creation,industrial annotation,annotation labeling
9
+ Classifier: Intended Audience :: Science/Research
10
+ Classifier: Intended Audience :: Developers
11
+ Classifier: Programming Language :: Python :: 3
12
+ Classifier: Operating System :: OS Independent
13
+ Classifier: Topic :: Scientific/Engineering :: Artificial Intelligence
14
+ Classifier: Topic :: Scientific/Engineering :: Image Processing
15
+ Classifier: Topic :: Scientific/Engineering :: Image Recognition
16
+ Classifier: Topic :: Scientific/Engineering :: Visualization
17
+ Requires-Python: >=3.10
18
+ Description-Content-Type: text/markdown
19
+ License-File: LICENSE
20
+ Requires-Dist: numpy>=1.22.0
21
+ Requires-Dist: pillow>=9.0.0
22
+ Requires-Dist: opencv-python>=4.7.0
23
+ Requires-Dist: matplotlib>=3.5.0
24
+ Requires-Dist: torch>=2.0.0
25
+ Requires-Dist: torchvision>=0.15.0
26
+ Requires-Dist: timm>=0.6.12
27
+ Requires-Dist: omegaconf>=2.3.0
28
+ Requires-Dist: supervision>=0.13.0
29
+ Requires-Dist: pycocotools>=2.0.6
30
+ Requires-Dist: ttkthemes
31
+ Requires-Dist: hydra-core
32
+ Requires-Dist: openpyxl
33
+ Requires-Dist: psutil
34
+ Requires-Dist: nvidia-ml-py
35
+ Requires-Dist: scikit-image
36
+ Requires-Dist: sam2
37
+ Dynamic: license-file
38
+
39
+ <a href="https://arxiv.org/abs/2601.11301"><img src="https://img.shields.io/badge/arXiv-2503.11651-b31b1b" alt="arXiv"></a>
40
+ <a href="https://samannot.github.io/"> <img src="https://img.shields.io/badge/Project_Page-green" alt="Project Page"></a>
41
+ <a href="https://www.youtube.com/watch?v=j5TVcVeuVZM"> <img src="https://img.shields.io/badge/demo_video-youtube-red" alt="Demo video"></a>
42
+ <a href="https://www.youtube.com/watch?v=X8AkZTCYWQo"> <img src="https://img.shields.io/badge/installation_video-youtube-red" alt="Install video"></a>
43
+
44
+ # SAMannot
45
+
46
+ SAMannot is a versatile video annotation tool built on top of Meta's Segment Anything Model (SAM2). It helps you create high-quality segmentation masks across video frames with minimal user interaction.
47
+
48
+
49
+ ## Installation Guide
50
+
51
+ This guide explains how to set up the environment, download required checkpoints, and launch the app
52
+
53
+ ### Prerequisites
54
+
55
+ - **Conda** (Anaconda or Miniconda)
56
+ - **Git** (optional, if you clone this repo)
57
+ - **Python 3.10** (the Conda env will install this)
58
+ - **CUDA-enabled GPU** and the correct drivers for faster inference
59
+ - **nvidia-cuda-toolkit** installed (optional, recommended)
60
+
61
+ ### 1) Clone repository
62
+ ```bash
63
+ git clone https://github.com/gergelydinya/SAMannot.git
64
+ cd SAMannot
65
+ ```
66
+ ### 2) Create and activate the Conda environment
67
+
68
+ ```bash
69
+ # From the project root
70
+ conda create -n samannot python=3.10 -y
71
+ conda activate samannot
72
+ pip install -r requirements.txt
73
+ cd sam2
74
+ pip install -e .
75
+ cd ..
76
+ # Match to your CUDA version 12.8 ~ cu128
77
+ pip install --index-url https://download.pytorch.org/whl/cu128 torch torchvision torchaudio
78
+ ```
79
+
80
+ ### 3) Download checkpoints
81
+ ```bash
82
+ cd checkpoints
83
+ bash download_chckpts.sh
84
+ ```
85
+
86
+ ### 4) Run the software
87
+ ```bash
88
+ conda activate samannot
89
+ python main.py
90
+ ```
91
+
92
+ ## Evaluation
93
+ ```bash
94
+ cd eval
95
+ python eval_fast.py --gt <ground truth folder> --pred <prediction folder>
96
+ ```
97
+
98
+ ## Best practices and practical tips
99
+ The typical workflow the software is designed for is that the user proceeds block by block and moves forward without going back.
100
+ It is also possible to load an earlier block, but in that case you should expect some time overhead, as the software needs to load the frames starting from the beginning of the video.
101
+
102
+ Choose your block size based on your computer’s resources and the complexity of the data.
103
+ As a starting point, for an average video, we recommend a block size of 100--150 frames.
104
+
105
+ ## Citation
106
+
107
+ If you use **SAMannot**, please cite our paper:
108
+
109
+ ```bibtex
110
+ @misc{samannot,
111
+ title={SAMannot: A Memory-Efficient, Local, Open-source Framework for Interactive Video Instance Segmentation based on SAM2},
112
+ author={Gergely Dinya and Andr{\'a}s Gelencs{\'e}r and Krisztina Kup{\'a}n and Clemens K{\"u}pper and Krist{\'o}f Karacs and Anna Gelencs{\'e}r-Horv{\'a}th},
113
+ year={2026},
114
+ eprint={2601.11301},
115
+ archivePrefix={arXiv},
116
+ primaryClass={cs.CV},
117
+ url={https://arxiv.org/abs/2601.11301},
118
+ }
@@ -0,0 +1,30 @@
1
+ samannot/__init__.py,sha256=a4kXzhQQzVLzhXXz5NkOtyw9IqMN6DLNiTfvGHtoHXg,510
2
+ samannot/__main__.py,sha256=c_LoA7GKcrSxw-3t6Av41NMt_thIJRGgtJGISp1sXWo,70
3
+ samannot/annotator.py,sha256=5hg-0ODbl7n1WFi1iVM_CiflFqSuvlSO2wolXAhuTqY,47169
4
+ samannot/functional_widget_utils.py,sha256=E-BkyNgzahWS9a7kA4BIUGmJeM2cZwSJkOf6gGXX3xc,2458
5
+ samannot/keycodes_linux.json,sha256=chqXVIT4gjrVxXf3xUR6cKevLNg6aTXtRWE1AnOahYc,694
6
+ samannot/keycodes_windows.json,sha256=ZZ42fpszYx84JyD1wQ1v8pSpQA_IHpn-P0YnD7b_6bo,683
7
+ samannot/label.py,sha256=DbcTol4fiN2Zoq-aXyd_cockVv1AA2ezU-qnYeAccUg,3287
8
+ samannot/main.py,sha256=QlCwdpj4DQhFUkL1vCiMGBaB8kY4aejri-AMdCMnS8E,201
9
+ samannot/main_window.py,sha256=gw84JXebmpuMsKOIlskq_fTyuk13fbwYTnxPjo7oH70,98962
10
+ samannot/model_downloader.py,sha256=-JjM1WMTdgjJn_WWL4uxebcFhzokGV9f7JkhhMo20Rs,13389
11
+ samannot/sam_annotator.py,sha256=rwAQxV8YQHMp2UBNgN0tMkfR_F5xvCkSc8BE_P-Ff6w,12605
12
+ samannot/system_monitor.py,sha256=ICcL3h-_Hk-a_wlgvN6l2JZ0jTnWi318H4Wscb-4SfQ,3316
13
+ samannot/user_guide.py,sha256=kRi_Zkw9l750a_n8NK35cNm0-HOw-D0jSOktkeAfO0Y,9102
14
+ samannot/visual_widget_utils.py,sha256=taE81iOh-aYhaStsL8uVHoNroZb5gu6dZdlhzdjQXM0,3193
15
+ samannot/sam2_configs/__init__.py,sha256=nywzbVIRHvUbrltJWdiUGWjp4mY4xoHeU4jFjTCAYk0,202
16
+ samannot/sam2_configs/sam2.1_hiera_l.yaml,sha256=NemoeM89TNBYPKpKpDGCtFTbk5Ssz6stDzeQ6tKCjLo,3916
17
+ samannot/sam2_configs/sam2_hiera_b+.yaml,sha256=WK5VOUZuHaS4VjRkJ6KajzZ1oMETLsC4G8ORHuF3XOk,3661
18
+ samannot/sam2_configs/sam2_hiera_b+_old.yaml,sha256=MqvJZEus-UQSF588mqaE0r7hzURxB9QQbI0xiYRf2dg,3661
19
+ samannot/sam2_configs/sam2_hiera_l.yaml,sha256=Mte_B75ONxeYX3YFL3QLkOTPr0VYhiGyht4kliwtL9M,3813
20
+ samannot/sam2_configs/sam2_hiera_l_old.yaml,sha256=4qpCOJtYFfG1zixSgvKrVH0nm7CyhhgJKQy9uJ_6tvA,3813
21
+ samannot/sam2_configs/sam2_hiera_s.yaml,sha256=A9EqSsIfgusenVw8gxmDmGsFgSyGG1iToCvDvdnsrE4,3775
22
+ samannot/sam2_configs/sam2_hiera_s_old.yaml,sha256=AmP5d-8THyOg-MD4nAjnRMijPB7cQt1SgpAVOrSLDyI,3775
23
+ samannot/sam2_configs/sam2_hiera_t.yaml,sha256=gpcGp2jWQfqGROGU0daTIq9dg3sJnocxrxR2In98VpE,3871
24
+ samannot/sam2_configs/sam2_hiera_t_old.yaml,sha256=9JCWQxBTZ8W81Xt3s8wJOkk2VSxR-xlqbP9rOMwdb8c,3871
25
+ samannot-0.6.1.dist-info/licenses/LICENSE,sha256=4rIRx3QvttU0CSxj5eI7bFFmLpQLL_7-9H67l06dUwI,1120
26
+ samannot-0.6.1.dist-info/METADATA,sha256=6JRQcvo5E3PNw2GoddGpGmUM9x_unw2fLMbnCecDOkw,4848
27
+ samannot-0.6.1.dist-info/WHEEL,sha256=mOdXR9C3wMVov7cSY8PY-XCzo3SmmWCHvGQr5csJoao,91
28
+ samannot-0.6.1.dist-info/entry_points.txt,sha256=tws1xlgJE0hMAXYG4Cpo5ielBo8Er9pkYDI93-xw6l0,48
29
+ samannot-0.6.1.dist-info/top_level.txt,sha256=NazS22YiAZ3PH8zzWP1HDv71ex73PBFxindTKuMczJA,9
30
+ samannot-0.6.1.dist-info/RECORD,,
@@ -0,0 +1,5 @@
1
+ Wheel-Version: 1.0
2
+ Generator: setuptools (84.2.1)
3
+ Root-Is-Purelib: true
4
+ Tag: py3-none-any
5
+
@@ -0,0 +1,2 @@
1
+ [console_scripts]
2
+ samannot = samannot.main:main
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2025 Gergely Dinya and Anna Gelencsér-Horváth
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
@@ -0,0 +1 @@
1
+ samannot