coralnet-toolbox 0.0.75__py2.py3-none-any.whl → 0.0.76__py2.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.
- coralnet_toolbox/Annotations/QtPolygonAnnotation.py +57 -12
- coralnet_toolbox/Annotations/QtRectangleAnnotation.py +44 -14
- coralnet_toolbox/Explorer/transformer_models.py +13 -2
- coralnet_toolbox/IO/QtExportMaskAnnotations.py +538 -403
- coralnet_toolbox/Icons/system_monitor.png +0 -0
- coralnet_toolbox/QtEventFilter.py +4 -4
- coralnet_toolbox/QtMainWindow.py +104 -64
- coralnet_toolbox/QtProgressBar.py +1 -0
- coralnet_toolbox/QtSystemMonitor.py +370 -0
- coralnet_toolbox/Results/ConvertResults.py +14 -8
- coralnet_toolbox/Results/ResultsProcessor.py +3 -2
- coralnet_toolbox/SAM/QtDeployGenerator.py +1 -1
- coralnet_toolbox/SAM/QtDeployPredictor.py +10 -0
- coralnet_toolbox/SeeAnything/QtDeployGenerator.py +15 -10
- coralnet_toolbox/SeeAnything/QtDeployPredictor.py +10 -6
- coralnet_toolbox/Tile/QtTileBatchInference.py +4 -4
- coralnet_toolbox/Tools/QtSAMTool.py +140 -91
- coralnet_toolbox/Transformers/Models/GroundingDINO.py +72 -0
- coralnet_toolbox/Transformers/Models/OWLViT.py +72 -0
- coralnet_toolbox/Transformers/Models/OmDetTurbo.py +68 -0
- coralnet_toolbox/Transformers/Models/QtBase.py +120 -0
- coralnet_toolbox/{AutoDistill → Transformers}/Models/__init__.py +1 -1
- coralnet_toolbox/{AutoDistill → Transformers}/QtBatchInference.py +15 -15
- coralnet_toolbox/{AutoDistill → Transformers}/QtDeployModel.py +18 -16
- coralnet_toolbox/{AutoDistill → Transformers}/__init__.py +1 -1
- coralnet_toolbox/__init__.py +1 -1
- coralnet_toolbox/utilities.py +0 -15
- {coralnet_toolbox-0.0.75.dist-info → coralnet_toolbox-0.0.76.dist-info}/METADATA +9 -9
- {coralnet_toolbox-0.0.75.dist-info → coralnet_toolbox-0.0.76.dist-info}/RECORD +33 -31
- coralnet_toolbox/AutoDistill/Models/GroundingDINO.py +0 -81
- coralnet_toolbox/AutoDistill/Models/OWLViT.py +0 -76
- coralnet_toolbox/AutoDistill/Models/OmDetTurbo.py +0 -75
- coralnet_toolbox/AutoDistill/Models/QtBase.py +0 -112
- {coralnet_toolbox-0.0.75.dist-info → coralnet_toolbox-0.0.76.dist-info}/WHEEL +0 -0
- {coralnet_toolbox-0.0.75.dist-info → coralnet_toolbox-0.0.76.dist-info}/entry_points.txt +0 -0
- {coralnet_toolbox-0.0.75.dist-info → coralnet_toolbox-0.0.76.dist-info}/licenses/LICENSE.txt +0 -0
- {coralnet_toolbox-0.0.75.dist-info → coralnet_toolbox-0.0.76.dist-info}/top_level.txt +0 -0
Binary file
|
@@ -24,7 +24,7 @@ class GlobalEventFilter(QObject):
|
|
24
24
|
self.segment_deploy_model_dialog = main_window.segment_deploy_model_dialog
|
25
25
|
self.sam_deploy_generator_dialog = main_window.sam_deploy_generator_dialog
|
26
26
|
self.see_anything_deploy_generator_dialog = main_window.see_anything_deploy_generator_dialog
|
27
|
-
self.
|
27
|
+
self.transformers_deploy_model_dialog = main_window.transformers_deploy_model_dialog
|
28
28
|
|
29
29
|
def eventFilter(self, obj, event):
|
30
30
|
# Check for explorer window first - this applies to all event types
|
@@ -75,10 +75,10 @@ class GlobalEventFilter(QObject):
|
|
75
75
|
if event.key() == Qt.Key_5:
|
76
76
|
self.see_anything_deploy_generator_dialog.predict()
|
77
77
|
return True
|
78
|
-
|
79
|
-
# Handle hotkey for
|
78
|
+
|
79
|
+
# Handle hotkey for transformers prediction
|
80
80
|
if event.key() == Qt.Key_6:
|
81
|
-
self.
|
81
|
+
self.transformers_deploy_model_dialog.predict()
|
82
82
|
return True
|
83
83
|
|
84
84
|
# Handle annotation cycling hotkeys
|
coralnet_toolbox/QtMainWindow.py
CHANGED
@@ -9,6 +9,9 @@ import requests
|
|
9
9
|
|
10
10
|
from packaging import version
|
11
11
|
|
12
|
+
import torch
|
13
|
+
|
14
|
+
from PyQt5 import sip
|
12
15
|
from PyQt5.QtGui import QIcon, QMouseEvent
|
13
16
|
from PyQt5.QtCore import Qt, pyqtSignal, QEvent, QSize, QPoint
|
14
17
|
from PyQt5.QtWidgets import (QListWidget, QCheckBox, QFrame, QComboBox)
|
@@ -18,6 +21,7 @@ from PyQt5.QtWidgets import (QMainWindow, QApplication, QToolBar, QAction, QSize
|
|
18
21
|
QGroupBox)
|
19
22
|
|
20
23
|
from coralnet_toolbox.QtEventFilter import GlobalEventFilter
|
24
|
+
|
21
25
|
from coralnet_toolbox.QtAnnotationWindow import AnnotationWindow
|
22
26
|
from coralnet_toolbox.QtConfidenceWindow import ConfidenceWindow
|
23
27
|
from coralnet_toolbox.QtImageWindow import ImageWindow
|
@@ -99,9 +103,9 @@ from coralnet_toolbox.SeeAnything import (
|
|
99
103
|
BatchInferenceDialog as SeeAnythingBatchInferenceDialog
|
100
104
|
)
|
101
105
|
|
102
|
-
from coralnet_toolbox.
|
103
|
-
DeployModelDialog as
|
104
|
-
BatchInferenceDialog as
|
106
|
+
from coralnet_toolbox.Transformers import (
|
107
|
+
DeployModelDialog as TransformersDeployModelDialog,
|
108
|
+
BatchInferenceDialog as TransformersBatchInferenceDialog
|
105
109
|
)
|
106
110
|
|
107
111
|
from coralnet_toolbox.CoralNet import (
|
@@ -114,9 +118,9 @@ from coralnet_toolbox.BreakTime import (
|
|
114
118
|
BreakoutGame
|
115
119
|
)
|
116
120
|
|
117
|
-
from coralnet_toolbox.
|
121
|
+
from coralnet_toolbox.QtSystemMonitor import SystemMonitor
|
118
122
|
|
119
|
-
from coralnet_toolbox.
|
123
|
+
from coralnet_toolbox.Icons import get_icon
|
120
124
|
|
121
125
|
|
122
126
|
# ----------------------------------------------------------------------------------------------------------------------
|
@@ -155,6 +159,7 @@ class MainWindow(QMainWindow):
|
|
155
159
|
self.opaque_icon = get_icon("opaque.png")
|
156
160
|
self.all_icon = get_icon("all.png")
|
157
161
|
self.parameters_icon = get_icon("parameters.png")
|
162
|
+
self.system_monitor_icon = get_icon("system_monitor.png")
|
158
163
|
self.add_icon = get_icon("add.png")
|
159
164
|
self.remove_icon = get_icon("remove.png")
|
160
165
|
self.edit_icon = get_icon("edit.png")
|
@@ -193,6 +198,8 @@ class MainWindow(QMainWindow):
|
|
193
198
|
self.label_window = LabelWindow(self)
|
194
199
|
self.confidence_window = ConfidenceWindow(self)
|
195
200
|
|
201
|
+
self.system_monitor = None
|
202
|
+
|
196
203
|
self.explorer_window = None # Initialized in open_explorer_window
|
197
204
|
|
198
205
|
# TODO update IO classes to have dialogs
|
@@ -262,9 +269,9 @@ class MainWindow(QMainWindow):
|
|
262
269
|
self.see_anything_deploy_generator_dialog = SeeAnythingDeployGeneratorDialog(self)
|
263
270
|
self.see_anything_batch_inference_dialog = SeeAnythingBatchInferenceDialog(self)
|
264
271
|
|
265
|
-
# Create dialogs (
|
266
|
-
self.
|
267
|
-
self.
|
272
|
+
# Create dialogs (Transformers)
|
273
|
+
self.transformers_deploy_model_dialog = TransformersDeployModelDialog(self)
|
274
|
+
self.transformers_batch_inference_dialog = TransformersBatchInferenceDialog(self)
|
268
275
|
|
269
276
|
# Create dialogs (Tile)
|
270
277
|
self.classify_tile_dataset_dialog = ClassifyTileDatasetDialog(self)
|
@@ -601,6 +608,17 @@ class MainWindow(QMainWindow):
|
|
601
608
|
self.ml_segment_video_inference_action = QAction("Segment", self)
|
602
609
|
self.ml_segment_video_inference_action.triggered.connect(self.open_segment_video_inference_dialog)
|
603
610
|
self.ml_video_inference_menu.addAction(self.ml_segment_video_inference_action)
|
611
|
+
|
612
|
+
# Transformers menu
|
613
|
+
self.transformers_menu = self.menu_bar.addMenu("Transformers")
|
614
|
+
# Deploy Model
|
615
|
+
self.transformers_deploy_model_action = QAction("Deploy Model", self)
|
616
|
+
self.transformers_deploy_model_action.triggered.connect(self.open_transformers_deploy_model_dialog)
|
617
|
+
self.transformers_menu.addAction(self.transformers_deploy_model_action)
|
618
|
+
# Batch Inference
|
619
|
+
self.transformers_batch_inference_action = QAction("Batch Inference", self)
|
620
|
+
self.transformers_batch_inference_action.triggered.connect(self.open_transformers_batch_inference_dialog)
|
621
|
+
self.transformers_menu.addAction(self.transformers_batch_inference_action)
|
604
622
|
|
605
623
|
# SAM menu
|
606
624
|
self.sam_menu = self.menu_bar.addMenu("SAM")
|
@@ -640,17 +658,6 @@ class MainWindow(QMainWindow):
|
|
640
658
|
self.see_anything_batch_inference_action.triggered.connect(self.open_see_anything_batch_inference_dialog)
|
641
659
|
self.see_anything_menu.addAction(self.see_anything_batch_inference_action)
|
642
660
|
|
643
|
-
# Auto Distill menu
|
644
|
-
self.auto_distill_menu = self.menu_bar.addMenu("AutoDistill")
|
645
|
-
# Deploy Model
|
646
|
-
self.auto_distill_deploy_model_action = QAction("Deploy Model", self)
|
647
|
-
self.auto_distill_deploy_model_action.triggered.connect(self.open_auto_distill_deploy_model_dialog)
|
648
|
-
self.auto_distill_menu.addAction(self.auto_distill_deploy_model_action)
|
649
|
-
# Batch Inference
|
650
|
-
self.auto_distill_batch_inference_action = QAction("Batch Inference", self)
|
651
|
-
self.auto_distill_batch_inference_action.triggered.connect(self.open_auto_distill_batch_inference_dialog)
|
652
|
-
self.auto_distill_menu.addAction(self.auto_distill_batch_inference_action)
|
653
|
-
|
654
661
|
# Help menu
|
655
662
|
self.help_menu = self.menu_bar.addMenu("Help")
|
656
663
|
|
@@ -659,9 +666,13 @@ class MainWindow(QMainWindow):
|
|
659
666
|
self.check_for_updates_action.triggered.connect(self.open_check_for_updates_dialog)
|
660
667
|
self.help_menu.addAction(self.check_for_updates_action)
|
661
668
|
# Usage
|
662
|
-
self.usage_action = QAction("Usage", self)
|
669
|
+
self.usage_action = QAction("Usage / Hotkeys", self)
|
663
670
|
self.usage_action.triggered.connect(self.open_usage_dialog)
|
664
671
|
self.help_menu.addAction(self.usage_action)
|
672
|
+
# System Monitor
|
673
|
+
self.system_monitor_action = QAction("System Monitor", self)
|
674
|
+
self.system_monitor_action.triggered.connect(self.open_system_monitor_dialog)
|
675
|
+
self.help_menu.addAction(self.system_monitor_action)
|
665
676
|
# Issues / Feature Requests
|
666
677
|
self.create_issue_action = QAction("Issues / Feature Requests", self)
|
667
678
|
self.create_issue_action.triggered.connect(self.open_create_new_issue_dialog)
|
@@ -828,15 +839,15 @@ class MainWindow(QMainWindow):
|
|
828
839
|
self.toolbar.addWidget(spacer)
|
829
840
|
|
830
841
|
# Add the device label widget as an action in the toolbar
|
831
|
-
self.devices =
|
832
|
-
|
833
|
-
self.device = self.devices[
|
842
|
+
self.devices = self.get_available_devices()
|
843
|
+
# Get the 'best' device available
|
844
|
+
self.device = self.devices[-1]
|
834
845
|
|
835
846
|
if self.device.startswith('cuda'):
|
836
|
-
if len(self.devices)
|
837
|
-
device_icon = self.rabbit_icon
|
838
|
-
else:
|
847
|
+
if len([d for d in self.devices if d.endswith('cuda')]) > 1:
|
839
848
|
device_icon = self.rocket_icon
|
849
|
+
else:
|
850
|
+
device_icon = self.rabbit_icon
|
840
851
|
device_tooltip = self.device
|
841
852
|
elif self.device == 'mps':
|
842
853
|
device_icon = self.apple_icon
|
@@ -1028,9 +1039,9 @@ class MainWindow(QMainWindow):
|
|
1028
1039
|
self.left_layout.addWidget(self.annotation_window, 85)
|
1029
1040
|
self.left_layout.addWidget(self.label_window, 15)
|
1030
1041
|
|
1031
|
-
#
|
1032
|
-
self.right_layout.addWidget(self.image_window, 54)
|
1033
|
-
self.right_layout.addWidget(self.confidence_window, 46)
|
1042
|
+
# Adjust the right layout with new proportions
|
1043
|
+
self.right_layout.addWidget(self.image_window, 54) # 54% for image window
|
1044
|
+
self.right_layout.addWidget(self.confidence_window, 46) # 46% for confidence window
|
1034
1045
|
|
1035
1046
|
# Add left and right layouts to main layout
|
1036
1047
|
self.main_layout.addLayout(self.left_layout, 85)
|
@@ -1054,12 +1065,17 @@ class MainWindow(QMainWindow):
|
|
1054
1065
|
self.showMaximized()
|
1055
1066
|
|
1056
1067
|
def closeEvent(self, event):
|
1057
|
-
"""Ensure the explorer window
|
1068
|
+
"""Ensure the explorer window and system monitor are closed when the main window closes."""
|
1058
1069
|
if self.explorer_window:
|
1059
1070
|
# Setting parent to None prevents it from being deleted with main window
|
1060
1071
|
# before it can be properly handled.
|
1061
1072
|
self.explorer_window.setParent(None)
|
1062
1073
|
self.explorer_window.close()
|
1074
|
+
|
1075
|
+
# Close the system monitor if it exists
|
1076
|
+
if self.system_monitor:
|
1077
|
+
self.system_monitor.close()
|
1078
|
+
|
1063
1079
|
super().closeEvent(event)
|
1064
1080
|
|
1065
1081
|
def changeEvent(self, event):
|
@@ -1374,6 +1390,20 @@ class MainWindow(QMainWindow):
|
|
1374
1390
|
self.sam_tool_action.setChecked(False)
|
1375
1391
|
self.see_anything_tool_action.setChecked(False)
|
1376
1392
|
self.work_area_tool_action.setChecked(False)
|
1393
|
+
|
1394
|
+
def get_available_devices(self):
|
1395
|
+
"""
|
1396
|
+
Get available devices
|
1397
|
+
|
1398
|
+
:return:
|
1399
|
+
"""
|
1400
|
+
devices = ['cpu',]
|
1401
|
+
if torch.backends.mps.is_available():
|
1402
|
+
devices.append('mps')
|
1403
|
+
if torch.cuda.is_available():
|
1404
|
+
for i in range(torch.cuda.device_count()):
|
1405
|
+
devices.append(f'cuda:{i}')
|
1406
|
+
return devices
|
1377
1407
|
|
1378
1408
|
def toggle_device(self):
|
1379
1409
|
dialog = DeviceSelectionDialog(self.devices, self)
|
@@ -2211,6 +2241,40 @@ class MainWindow(QMainWindow):
|
|
2211
2241
|
self.segment_video_inference_dialog.exec_()
|
2212
2242
|
except Exception as e:
|
2213
2243
|
QMessageBox.critical(self, "Critical Error", f"{e}")
|
2244
|
+
|
2245
|
+
def open_transformers_deploy_model_dialog(self):
|
2246
|
+
"""Open the Transformers Deploy Model dialog to deploy an Transformers model."""
|
2247
|
+
if not self.image_window.raster_manager.image_paths:
|
2248
|
+
QMessageBox.warning(self,
|
2249
|
+
"Transformers Deploy Model",
|
2250
|
+
"No images are present in the project.")
|
2251
|
+
return
|
2252
|
+
|
2253
|
+
try:
|
2254
|
+
self.untoggle_all_tools()
|
2255
|
+
self.transformers_deploy_model_dialog.exec_()
|
2256
|
+
except Exception as e:
|
2257
|
+
QMessageBox.critical(self, "Critical Error", f"{e}")
|
2258
|
+
|
2259
|
+
def open_transformers_batch_inference_dialog(self):
|
2260
|
+
"""Open the Transformers Batch Inference dialog to run batch inference with Transformers."""
|
2261
|
+
if not self.image_window.raster_manager.image_paths:
|
2262
|
+
QMessageBox.warning(self,
|
2263
|
+
"Transformers Batch Inference",
|
2264
|
+
"No images are present in the project.")
|
2265
|
+
return
|
2266
|
+
|
2267
|
+
if not self.transformers_deploy_model_dialog.loaded_model:
|
2268
|
+
QMessageBox.warning(self,
|
2269
|
+
"Transformers Batch Inference",
|
2270
|
+
"Please deploy a model before running batch inference.")
|
2271
|
+
return
|
2272
|
+
|
2273
|
+
try:
|
2274
|
+
self.untoggle_all_tools()
|
2275
|
+
self.transformers_batch_inference_dialog.exec_()
|
2276
|
+
except Exception as e:
|
2277
|
+
QMessageBox.critical(self, "Critical Error", f"{e}")
|
2214
2278
|
|
2215
2279
|
def open_sam_deploy_predictor_dialog(self):
|
2216
2280
|
"""Open the SAM Deploy Predictor dialog to deploy a SAM predictor."""
|
@@ -2328,40 +2392,16 @@ class MainWindow(QMainWindow):
|
|
2328
2392
|
self.see_anything_batch_inference_dialog.exec_()
|
2329
2393
|
except Exception as e:
|
2330
2394
|
QMessageBox.critical(self, "Critical Error", f"{e}")
|
2331
|
-
|
2332
|
-
def
|
2333
|
-
"""Open the
|
2334
|
-
if
|
2335
|
-
|
2336
|
-
|
2337
|
-
|
2338
|
-
|
2339
|
-
|
2340
|
-
|
2341
|
-
self.untoggle_all_tools()
|
2342
|
-
self.auto_distill_deploy_model_dialog.exec_()
|
2343
|
-
except Exception as e:
|
2344
|
-
QMessageBox.critical(self, "Critical Error", f"{e}")
|
2345
|
-
|
2346
|
-
def open_auto_distill_batch_inference_dialog(self):
|
2347
|
-
"""Open the AutoDistill Batch Inference dialog to run batch inference with AutoDistill."""
|
2348
|
-
if not self.image_window.raster_manager.image_paths:
|
2349
|
-
QMessageBox.warning(self,
|
2350
|
-
"AutoDistill Batch Inference",
|
2351
|
-
"No images are present in the project.")
|
2352
|
-
return
|
2353
|
-
|
2354
|
-
if not self.auto_distill_deploy_model_dialog.loaded_model:
|
2355
|
-
QMessageBox.warning(self,
|
2356
|
-
"AutoDistill Batch Inference",
|
2357
|
-
"Please deploy a model before running batch inference.")
|
2358
|
-
return
|
2359
|
-
|
2360
|
-
try:
|
2361
|
-
self.untoggle_all_tools()
|
2362
|
-
self.auto_distill_batch_inference_dialog.exec_()
|
2363
|
-
except Exception as e:
|
2364
|
-
QMessageBox.critical(self, "Critical Error", f"{e}")
|
2395
|
+
|
2396
|
+
def open_system_monitor_dialog(self):
|
2397
|
+
"""Open the system system monitor window."""
|
2398
|
+
if self.system_monitor is None or sip.isdeleted(self.system_monitor):
|
2399
|
+
self.system_monitor = SystemMonitor()
|
2400
|
+
|
2401
|
+
# Show the monitor window
|
2402
|
+
self.system_monitor.show()
|
2403
|
+
self.system_monitor.activateWindow()
|
2404
|
+
self.system_monitor.raise_()
|
2365
2405
|
|
2366
2406
|
def open_usage_dialog(self):
|
2367
2407
|
"""Display QMessageBox with link to create new issue on GitHub."""
|