coralnet-toolbox 0.0.74__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.
Files changed (49) hide show
  1. coralnet_toolbox/Annotations/QtPolygonAnnotation.py +57 -12
  2. coralnet_toolbox/Annotations/QtRectangleAnnotation.py +44 -14
  3. coralnet_toolbox/Explorer/QtDataItem.py +52 -22
  4. coralnet_toolbox/Explorer/QtExplorer.py +277 -1600
  5. coralnet_toolbox/Explorer/QtSettingsWidgets.py +101 -15
  6. coralnet_toolbox/Explorer/QtViewers.py +1568 -0
  7. coralnet_toolbox/Explorer/transformer_models.py +70 -0
  8. coralnet_toolbox/Explorer/yolo_models.py +112 -0
  9. coralnet_toolbox/IO/QtExportMaskAnnotations.py +538 -403
  10. coralnet_toolbox/Icons/system_monitor.png +0 -0
  11. coralnet_toolbox/MachineLearning/ImportDataset/QtBase.py +239 -147
  12. coralnet_toolbox/MachineLearning/VideoInference/YOLO3D/run.py +102 -16
  13. coralnet_toolbox/QtAnnotationWindow.py +16 -10
  14. coralnet_toolbox/QtEventFilter.py +4 -4
  15. coralnet_toolbox/QtImageWindow.py +3 -7
  16. coralnet_toolbox/QtMainWindow.py +104 -64
  17. coralnet_toolbox/QtProgressBar.py +1 -0
  18. coralnet_toolbox/QtSystemMonitor.py +370 -0
  19. coralnet_toolbox/Rasters/RasterTableModel.py +20 -0
  20. coralnet_toolbox/Results/ConvertResults.py +14 -8
  21. coralnet_toolbox/Results/ResultsProcessor.py +3 -2
  22. coralnet_toolbox/SAM/QtDeployGenerator.py +2 -5
  23. coralnet_toolbox/SAM/QtDeployPredictor.py +11 -3
  24. coralnet_toolbox/SeeAnything/QtDeployGenerator.py +146 -116
  25. coralnet_toolbox/SeeAnything/QtDeployPredictor.py +55 -9
  26. coralnet_toolbox/Tile/QtTileBatchInference.py +4 -4
  27. coralnet_toolbox/Tools/QtPolygonTool.py +42 -3
  28. coralnet_toolbox/Tools/QtRectangleTool.py +30 -0
  29. coralnet_toolbox/Tools/QtSAMTool.py +140 -91
  30. coralnet_toolbox/Transformers/Models/GroundingDINO.py +72 -0
  31. coralnet_toolbox/Transformers/Models/OWLViT.py +72 -0
  32. coralnet_toolbox/Transformers/Models/OmDetTurbo.py +68 -0
  33. coralnet_toolbox/Transformers/Models/QtBase.py +120 -0
  34. coralnet_toolbox/{AutoDistill → Transformers}/Models/__init__.py +1 -1
  35. coralnet_toolbox/{AutoDistill → Transformers}/QtBatchInference.py +15 -15
  36. coralnet_toolbox/{AutoDistill → Transformers}/QtDeployModel.py +18 -16
  37. coralnet_toolbox/{AutoDistill → Transformers}/__init__.py +1 -1
  38. coralnet_toolbox/__init__.py +1 -1
  39. coralnet_toolbox/utilities.py +21 -15
  40. {coralnet_toolbox-0.0.74.dist-info → coralnet_toolbox-0.0.76.dist-info}/METADATA +13 -10
  41. {coralnet_toolbox-0.0.74.dist-info → coralnet_toolbox-0.0.76.dist-info}/RECORD +45 -40
  42. coralnet_toolbox/AutoDistill/Models/GroundingDINO.py +0 -81
  43. coralnet_toolbox/AutoDistill/Models/OWLViT.py +0 -76
  44. coralnet_toolbox/AutoDistill/Models/OmDetTurbo.py +0 -75
  45. coralnet_toolbox/AutoDistill/Models/QtBase.py +0 -112
  46. {coralnet_toolbox-0.0.74.dist-info → coralnet_toolbox-0.0.76.dist-info}/WHEEL +0 -0
  47. {coralnet_toolbox-0.0.74.dist-info → coralnet_toolbox-0.0.76.dist-info}/entry_points.txt +0 -0
  48. {coralnet_toolbox-0.0.74.dist-info → coralnet_toolbox-0.0.76.dist-info}/licenses/LICENSE.txt +0 -0
  49. {coralnet_toolbox-0.0.74.dist-info → coralnet_toolbox-0.0.76.dist-info}/top_level.txt +0 -0
@@ -0,0 +1,70 @@
1
+ """
2
+ Transformer models configuration for the Explorer tool.
3
+
4
+ This module contains the transformer models dictionary used in the Explorer tool.
5
+ It's extracted into a separate module to allow easy importing in tests without
6
+ Qt dependencies.
7
+ """
8
+
9
+ TRANSFORMER_MODELS = {
10
+ 'ResNet-50': 'microsoft/resnet-50',
11
+ 'ResNet-101': 'microsoft/resnet-101',
12
+ 'DINOv2 (Small)': 'facebook/dinov2-small',
13
+ 'DINOv2 (Base)': 'facebook/dinov2-base',
14
+ 'DINOv2 (Large)': 'facebook/dinov2-large',
15
+ 'DINOv2 (Giant)': 'facebook/dinov2-giant',
16
+ 'DINOv2 (Giant ImageNet1k)': 'facebook/dinov2-giant-imagenet1k-1-layer',
17
+ 'DINOv3 ConvNext (Tiny)': 'facebook/dinov3-convnext-tiny-pretrain-lvd1689m',
18
+ 'DINOv3 ConvNext (Small)': 'facebook/dinov3-convnext-small-pretrain-lvd1689m',
19
+ 'DINOv3 ConvNext (Base)': 'facebook/dinov3-convnext-base-pretrain-lvd1689m',
20
+ 'DINOv3 ConvNext (Large)': 'facebook/dinov3-convnext-large-pretrain-lvd1689m',
21
+ 'DINOv3 ViT (Small/16)': 'facebook/dinov3-vits16-pretrain-lvd1689m',
22
+ 'DINOv3 ViT (Small/16+)': 'facebook/dinov3-vits16plus-pretrain-lvd1689m',
23
+ 'DINOv3 ViT (Base/16)': 'facebook/dinov3-vitb16-pretrain-lvd1689m',
24
+ 'DINOv3 ViT (Large/16)': 'facebook/dinov3-vitl16-pretrain-lvd1689m',
25
+ 'DINOv3 ViT (Huge/16+)': 'facebook/dinov3-vith16plus-pretrain-lvd1689m',
26
+ 'DINOv3 ViT (7B/16)': 'facebook/dinov3-vit7b16-pretrain-lvd1689m',
27
+ 'Swin Transformer (Tiny)': 'microsoft/swin-tiny-patch4-window7-224',
28
+ 'Swin Transformer (Base)': 'microsoft/swin-base-patch4-window7-224',
29
+ 'ViT (Base)': 'google/vit-base-patch16-224',
30
+ 'ViT (Large)': 'google/vit-large-patch16-224',
31
+ }
32
+
33
+
34
+ def is_transformer_model(model_name):
35
+ """
36
+ Determine if a model name refers to a transformer model.
37
+
38
+ This function checks if the model name indicates a HuggingFace transformer model
39
+ that should be handled by the transformer feature extraction pipeline.
40
+
41
+ Args:
42
+ model_name (str): The model name to check
43
+
44
+ Returns:
45
+ bool: True if this is a transformer model, False otherwise
46
+ """
47
+ if not model_name or not isinstance(model_name, str):
48
+ return False
49
+
50
+ # Check if it's one of our known transformer model IDs
51
+ if model_name in TRANSFORMER_MODELS.values():
52
+ return True
53
+
54
+ # Check for common HuggingFace model naming patterns
55
+ # Models from HuggingFace typically contain '/' in their names
56
+ if "/" in model_name:
57
+ # Check for known organization prefixes
58
+ known_prefixes = ("facebook/",
59
+ "microsoft/",
60
+ "google/",
61
+ "openai/",
62
+ "imageomics/")
63
+
64
+ if model_name.startswith(known_prefixes):
65
+ return True
66
+
67
+ # Any model with '/' is likely a HuggingFace model
68
+ return True
69
+
70
+ return False
@@ -0,0 +1,112 @@
1
+ """
2
+ YOLO models configuration for the Explorer tool.
3
+
4
+ This module contains the YOLO models dictionary used in the Explorer tool.
5
+ It's extracted into a separate module to allow easy importing in tests without
6
+ Qt dependencies.
7
+ """
8
+
9
+ from coralnet_toolbox.MachineLearning.Community.cfg import get_available_configs
10
+
11
+ # Dictionary mapping display names to model file names (classification models only)
12
+ YOLO_MODELS = {
13
+ # YOLOv8 classification models
14
+ 'YOLOv8 (Nano)': 'yolov8n-cls.pt',
15
+ 'YOLOv8 (Small)': 'yolov8s-cls.pt',
16
+ 'YOLOv8 (Medium)': 'yolov8m-cls.pt',
17
+ 'YOLOv8 (Large)': 'yolov8l-cls.pt',
18
+ 'YOLOv8 (X-Large)': 'yolov8x-cls.pt',
19
+
20
+ # YOLOv11 classification models
21
+ 'YOLOv11 (Nano)': 'yolov11n-cls.pt',
22
+ 'YOLOv11 (Small)': 'yolov11s-cls.pt',
23
+ 'YOLOv11 (Medium)': 'yolov11m-cls.pt',
24
+ 'YOLOv11 (Large)': 'yolov11l-cls.pt',
25
+ 'YOLOv11 (X-Large)': 'yolov11x-cls.pt',
26
+
27
+ # YOLOv12 classification models
28
+ 'YOLOv12 (Nano)': 'yolov12n-cls.pt',
29
+ 'YOLOv12 (Small)': 'yolov12s-cls.pt',
30
+ 'YOLOv12 (Medium)': 'yolov12m-cls.pt',
31
+ 'YOLOv12 (Large)': 'yolov12l-cls.pt',
32
+ 'YOLOv12 (X-Large)': 'yolov12x-cls.pt',
33
+ }
34
+
35
+
36
+ def get_community_models(task='classify'):
37
+ """
38
+ Get available community models for a specific task.
39
+
40
+ Args:
41
+ task (str): The task type, default is 'classify'
42
+
43
+ Returns:
44
+ dict: Dictionary of community models
45
+ """
46
+ return get_available_configs(task=task)
47
+
48
+
49
+ def is_yolo_model(model_name):
50
+ """
51
+ Determine if a model name refers to a YOLO model.
52
+
53
+ This function checks if the model name indicates a YOLO model
54
+ that should be handled by the YOLO feature extraction pipeline.
55
+
56
+ Args:
57
+ model_name (str): The model name to check
58
+
59
+ Returns:
60
+ bool: True if this is a YOLO model, False otherwise
61
+ """
62
+ if not model_name or not isinstance(model_name, str):
63
+ return False
64
+
65
+ # Check if it's one of our known YOLO model IDs
66
+ if model_name in YOLO_MODELS.values():
67
+ return True
68
+
69
+ # Check if it's a community model (check both keys and values)
70
+ community_models = get_community_models()
71
+ if community_models:
72
+ if model_name in community_models or model_name in community_models.values():
73
+ return True
74
+
75
+ # Check for .pt file extension (any PyTorch model file)
76
+ if model_name.lower().endswith('.pt'):
77
+ return True
78
+
79
+ return False
80
+
81
+
82
+ def get_yolo_model_task(model_name):
83
+ """
84
+ Determine the task type of a YOLO model based on its name.
85
+
86
+ Args:
87
+ model_name (str): The model name or path
88
+
89
+ Returns:
90
+ str: One of 'classify', 'detect', 'segment', or 'unknown'
91
+ """
92
+ if not model_name or not isinstance(model_name, str):
93
+ return 'unknown'
94
+
95
+ # Check if it's a community model - all community models are classify
96
+ community_models = get_community_models()
97
+ if community_models:
98
+ if model_name in community_models or model_name in community_models.values():
99
+ return 'classify'
100
+
101
+ # Extract just the filename if a full path is provided
102
+ filename = model_name.split('/')[-1].split('\\')[-1].lower()
103
+
104
+ if '-cls' in filename:
105
+ return 'classify'
106
+ elif '-seg' in filename:
107
+ return 'segment'
108
+ elif filename.endswith('.pt'):
109
+ # Default YOLO models without specific suffixes are detection models
110
+ return 'detect'
111
+
112
+ return 'unknown'