coralnet-toolbox 0.0.74__py2.py3-none-any.whl → 0.0.75__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 (25) hide show
  1. coralnet_toolbox/Explorer/QtDataItem.py +52 -22
  2. coralnet_toolbox/Explorer/QtExplorer.py +277 -1600
  3. coralnet_toolbox/Explorer/QtSettingsWidgets.py +101 -15
  4. coralnet_toolbox/Explorer/QtViewers.py +1568 -0
  5. coralnet_toolbox/Explorer/transformer_models.py +59 -0
  6. coralnet_toolbox/Explorer/yolo_models.py +112 -0
  7. coralnet_toolbox/MachineLearning/ImportDataset/QtBase.py +239 -147
  8. coralnet_toolbox/MachineLearning/VideoInference/YOLO3D/run.py +102 -16
  9. coralnet_toolbox/QtAnnotationWindow.py +16 -10
  10. coralnet_toolbox/QtImageWindow.py +3 -7
  11. coralnet_toolbox/Rasters/RasterTableModel.py +20 -0
  12. coralnet_toolbox/SAM/QtDeployGenerator.py +1 -4
  13. coralnet_toolbox/SAM/QtDeployPredictor.py +1 -3
  14. coralnet_toolbox/SeeAnything/QtDeployGenerator.py +131 -106
  15. coralnet_toolbox/SeeAnything/QtDeployPredictor.py +45 -3
  16. coralnet_toolbox/Tools/QtPolygonTool.py +42 -3
  17. coralnet_toolbox/Tools/QtRectangleTool.py +30 -0
  18. coralnet_toolbox/__init__.py +1 -1
  19. coralnet_toolbox/utilities.py +21 -0
  20. {coralnet_toolbox-0.0.74.dist-info → coralnet_toolbox-0.0.75.dist-info}/METADATA +6 -3
  21. {coralnet_toolbox-0.0.74.dist-info → coralnet_toolbox-0.0.75.dist-info}/RECORD +25 -22
  22. {coralnet_toolbox-0.0.74.dist-info → coralnet_toolbox-0.0.75.dist-info}/WHEEL +0 -0
  23. {coralnet_toolbox-0.0.74.dist-info → coralnet_toolbox-0.0.75.dist-info}/entry_points.txt +0 -0
  24. {coralnet_toolbox-0.0.74.dist-info → coralnet_toolbox-0.0.75.dist-info}/licenses/LICENSE.txt +0 -0
  25. {coralnet_toolbox-0.0.74.dist-info → coralnet_toolbox-0.0.75.dist-info}/top_level.txt +0 -0
@@ -0,0 +1,59 @@
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
+ 'DINOv2 (Small)': 'facebook/dinov2-small',
11
+ 'DINOv2 (Base)': 'facebook/dinov2-base',
12
+ 'DINOv2 (Large)': 'facebook/dinov2-large',
13
+ 'DINOv3 ConvNext (Tiny)': 'facebook/dinov3-convnext-tiny-pretrain-lvd1689m',
14
+ 'ResNet-50': 'microsoft/resnet-50',
15
+ 'ResNet-101': 'microsoft/resnet-101',
16
+ 'Swin Transformer (Tiny)': 'microsoft/swin-tiny-patch4-window7-224',
17
+ 'Swin Transformer (Base)': 'microsoft/swin-base-patch4-window7-224',
18
+ 'ViT (Base)': 'google/vit-base-patch16-224',
19
+ 'ViT (Large)': 'google/vit-large-patch16-224',
20
+ }
21
+
22
+
23
+ def is_transformer_model(model_name):
24
+ """
25
+ Determine if a model name refers to a transformer model.
26
+
27
+ This function checks if the model name indicates a HuggingFace transformer model
28
+ that should be handled by the transformer feature extraction pipeline.
29
+
30
+ Args:
31
+ model_name (str): The model name to check
32
+
33
+ Returns:
34
+ bool: True if this is a transformer model, False otherwise
35
+ """
36
+ if not model_name or not isinstance(model_name, str):
37
+ return False
38
+
39
+ # Check if it's one of our known transformer model IDs
40
+ if model_name in TRANSFORMER_MODELS.values():
41
+ return True
42
+
43
+ # Check for common HuggingFace model naming patterns
44
+ # Models from HuggingFace typically contain '/' in their names
45
+ if "/" in model_name:
46
+ # Check for known organization prefixes
47
+ known_prefixes = ("facebook/",
48
+ "microsoft/",
49
+ "google/",
50
+ "openai/",
51
+ "imageomics/")
52
+
53
+ if model_name.startswith(known_prefixes):
54
+ return True
55
+
56
+ # Any model with '/' is likely a HuggingFace model
57
+ return True
58
+
59
+ 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'