dgenerate-ultralytics-headless 8.3.194__py3-none-any.whl → 8.3.196__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 (107) hide show
  1. {dgenerate_ultralytics_headless-8.3.194.dist-info → dgenerate_ultralytics_headless-8.3.196.dist-info}/METADATA +1 -2
  2. {dgenerate_ultralytics_headless-8.3.194.dist-info → dgenerate_ultralytics_headless-8.3.196.dist-info}/RECORD +107 -106
  3. tests/test_python.py +1 -1
  4. ultralytics/__init__.py +1 -1
  5. ultralytics/cfg/__init__.py +9 -8
  6. ultralytics/cfg/default.yaml +1 -0
  7. ultralytics/data/annotator.py +1 -1
  8. ultralytics/data/augment.py +76 -76
  9. ultralytics/data/base.py +12 -12
  10. ultralytics/data/build.py +5 -1
  11. ultralytics/data/converter.py +4 -4
  12. ultralytics/data/dataset.py +7 -7
  13. ultralytics/data/loaders.py +15 -15
  14. ultralytics/data/split_dota.py +10 -10
  15. ultralytics/data/utils.py +12 -12
  16. ultralytics/engine/exporter.py +19 -31
  17. ultralytics/engine/model.py +13 -13
  18. ultralytics/engine/predictor.py +16 -14
  19. ultralytics/engine/results.py +21 -21
  20. ultralytics/engine/trainer.py +15 -4
  21. ultralytics/engine/validator.py +6 -2
  22. ultralytics/hub/google/__init__.py +2 -2
  23. ultralytics/hub/session.py +7 -7
  24. ultralytics/models/fastsam/model.py +5 -5
  25. ultralytics/models/fastsam/predict.py +11 -11
  26. ultralytics/models/nas/model.py +1 -1
  27. ultralytics/models/rtdetr/predict.py +2 -2
  28. ultralytics/models/rtdetr/val.py +4 -4
  29. ultralytics/models/sam/amg.py +6 -6
  30. ultralytics/models/sam/build.py +9 -9
  31. ultralytics/models/sam/model.py +7 -7
  32. ultralytics/models/sam/modules/blocks.py +6 -6
  33. ultralytics/models/sam/modules/decoders.py +1 -1
  34. ultralytics/models/sam/modules/encoders.py +27 -27
  35. ultralytics/models/sam/modules/sam.py +4 -4
  36. ultralytics/models/sam/modules/tiny_encoder.py +18 -18
  37. ultralytics/models/sam/modules/utils.py +8 -8
  38. ultralytics/models/sam/predict.py +63 -63
  39. ultralytics/models/utils/loss.py +22 -22
  40. ultralytics/models/utils/ops.py +8 -8
  41. ultralytics/models/yolo/classify/predict.py +2 -2
  42. ultralytics/models/yolo/classify/train.py +9 -19
  43. ultralytics/models/yolo/classify/val.py +4 -4
  44. ultralytics/models/yolo/detect/predict.py +3 -3
  45. ultralytics/models/yolo/detect/train.py +38 -12
  46. ultralytics/models/yolo/detect/val.py +38 -37
  47. ultralytics/models/yolo/model.py +6 -6
  48. ultralytics/models/yolo/obb/train.py +1 -10
  49. ultralytics/models/yolo/obb/val.py +13 -13
  50. ultralytics/models/yolo/pose/train.py +1 -9
  51. ultralytics/models/yolo/pose/val.py +12 -12
  52. ultralytics/models/yolo/segment/predict.py +4 -4
  53. ultralytics/models/yolo/segment/train.py +2 -10
  54. ultralytics/models/yolo/segment/val.py +15 -15
  55. ultralytics/models/yolo/world/train.py +13 -13
  56. ultralytics/models/yolo/world/train_world.py +3 -3
  57. ultralytics/models/yolo/yoloe/predict.py +4 -4
  58. ultralytics/models/yolo/yoloe/train.py +7 -16
  59. ultralytics/models/yolo/yoloe/val.py +0 -7
  60. ultralytics/nn/autobackend.py +2 -2
  61. ultralytics/nn/modules/block.py +6 -6
  62. ultralytics/nn/modules/conv.py +2 -2
  63. ultralytics/nn/modules/head.py +6 -5
  64. ultralytics/nn/tasks.py +17 -15
  65. ultralytics/nn/text_model.py +3 -3
  66. ultralytics/solutions/ai_gym.py +2 -2
  67. ultralytics/solutions/analytics.py +3 -3
  68. ultralytics/solutions/config.py +5 -5
  69. ultralytics/solutions/distance_calculation.py +2 -2
  70. ultralytics/solutions/heatmap.py +1 -1
  71. ultralytics/solutions/instance_segmentation.py +4 -4
  72. ultralytics/solutions/object_counter.py +4 -4
  73. ultralytics/solutions/parking_management.py +7 -7
  74. ultralytics/solutions/queue_management.py +3 -3
  75. ultralytics/solutions/region_counter.py +4 -4
  76. ultralytics/solutions/similarity_search.py +2 -2
  77. ultralytics/solutions/solutions.py +48 -48
  78. ultralytics/solutions/streamlit_inference.py +1 -1
  79. ultralytics/solutions/trackzone.py +4 -4
  80. ultralytics/solutions/vision_eye.py +1 -1
  81. ultralytics/trackers/byte_tracker.py +11 -11
  82. ultralytics/trackers/utils/gmc.py +3 -3
  83. ultralytics/trackers/utils/matching.py +5 -5
  84. ultralytics/utils/__init__.py +30 -19
  85. ultralytics/utils/autodevice.py +2 -2
  86. ultralytics/utils/benchmarks.py +10 -10
  87. ultralytics/utils/callbacks/clearml.py +1 -1
  88. ultralytics/utils/callbacks/comet.py +5 -5
  89. ultralytics/utils/callbacks/tensorboard.py +2 -2
  90. ultralytics/utils/checks.py +7 -5
  91. ultralytics/utils/cpu.py +90 -0
  92. ultralytics/utils/dist.py +1 -1
  93. ultralytics/utils/downloads.py +2 -2
  94. ultralytics/utils/export.py +5 -5
  95. ultralytics/utils/instance.py +2 -2
  96. ultralytics/utils/loss.py +14 -8
  97. ultralytics/utils/metrics.py +35 -35
  98. ultralytics/utils/nms.py +4 -4
  99. ultralytics/utils/ops.py +1 -1
  100. ultralytics/utils/patches.py +2 -2
  101. ultralytics/utils/plotting.py +10 -9
  102. ultralytics/utils/torch_utils.py +113 -15
  103. ultralytics/utils/triton.py +5 -5
  104. {dgenerate_ultralytics_headless-8.3.194.dist-info → dgenerate_ultralytics_headless-8.3.196.dist-info}/WHEEL +0 -0
  105. {dgenerate_ultralytics_headless-8.3.194.dist-info → dgenerate_ultralytics_headless-8.3.196.dist-info}/entry_points.txt +0 -0
  106. {dgenerate_ultralytics_headless-8.3.194.dist-info → dgenerate_ultralytics_headless-8.3.196.dist-info}/licenses/LICENSE +0 -0
  107. {dgenerate_ultralytics_headless-8.3.194.dist-info → dgenerate_ultralytics_headless-8.3.196.dist-info}/top_level.txt +0 -0
@@ -29,12 +29,12 @@ class Analytics(BaseSolution):
29
29
  fontsize (int): Font size for text display.
30
30
  color_cycle (cycle): Cyclic iterator for chart colors.
31
31
  total_counts (int): Total count of detected objects (used for line charts).
32
- clswise_count (Dict[str, int]): Dictionary for class-wise object counts.
32
+ clswise_count (dict[str, int]): Dictionary for class-wise object counts.
33
33
  fig (Figure): Matplotlib figure object for the chart.
34
34
  ax (Axes): Matplotlib axes object for the chart.
35
35
  canvas (FigureCanvasAgg): Canvas for rendering the chart.
36
36
  lines (dict): Dictionary to store line objects for area charts.
37
- color_mapping (Dict[str, str]): Dictionary mapping class labels to colors for consistent visualization.
37
+ color_mapping (dict[str, str]): Dictionary mapping class labels to colors for consistent visualization.
38
38
 
39
39
  Methods:
40
40
  process: Process image data and update the chart.
@@ -144,7 +144,7 @@ class Analytics(BaseSolution):
144
144
 
145
145
  Args:
146
146
  frame_number (int): The current frame number.
147
- count_dict (Dict[str, int], optional): Dictionary with class names as keys and counts as values for
147
+ count_dict (dict[str, int], optional): Dictionary with class names as keys and counts as values for
148
148
  multiple classes. If None, updates a single line graph.
149
149
  plot (str): Type of the plot. Options are 'line', 'bar', 'pie', or 'area'.
150
150
 
@@ -20,20 +20,20 @@ class SolutionConfig:
20
20
  Attributes:
21
21
  source (str, optional): Path to the input source (video, RTSP, etc.). Only usable with Solutions CLI.
22
22
  model (str, optional): Path to the Ultralytics YOLO model to be used for inference.
23
- classes (List[int], optional): List of class indices to filter detections.
23
+ classes (list[int], optional): List of class indices to filter detections.
24
24
  show_conf (bool): Whether to show confidence scores on the visual output.
25
25
  show_labels (bool): Whether to display class labels on visual output.
26
- region (List[Tuple[int, int]], optional): Polygonal region or line for object counting.
26
+ region (list[tuple[int, int]], optional): Polygonal region or line for object counting.
27
27
  colormap (int, optional): OpenCV colormap constant for visual overlays (e.g., cv2.COLORMAP_JET).
28
28
  show_in (bool): Whether to display count number for objects entering the region.
29
29
  show_out (bool): Whether to display count number for objects leaving the region.
30
30
  up_angle (float): Upper angle threshold used in pose-based workouts monitoring.
31
31
  down_angle (int): Lower angle threshold used in pose-based workouts monitoring.
32
- kpts (List[int]): Keypoint indices to monitor, e.g., for pose analytics.
32
+ kpts (list[int]): Keypoint indices to monitor, e.g., for pose analytics.
33
33
  analytics_type (str): Type of analytics to perform ("line", "area", "bar", "pie", etc.).
34
- figsize (Tuple[int, int], optional): Size of the matplotlib figure used for analytical plots (width, height).
34
+ figsize (tuple[int, int], optional): Size of the matplotlib figure used for analytical plots (width, height).
35
35
  blur_ratio (float): Ratio used to blur objects in the video frames (0.0 to 1.0).
36
- vision_point (Tuple[int, int]): Reference point for directional tracking or perspective drawing.
36
+ vision_point (tuple[int, int]): Reference point for directional tracking or perspective drawing.
37
37
  crop_dir (str): Directory path to save cropped detection images.
38
38
  json_file (str): Path to a JSON file containing data for parking areas.
39
39
  line_width (int): Width for visual display i.e. bounding boxes, keypoints, counts.
@@ -18,8 +18,8 @@ class DistanceCalculation(BaseSolution):
18
18
 
19
19
  Attributes:
20
20
  left_mouse_count (int): Counter for left mouse button clicks.
21
- selected_boxes (Dict[int, List[float]]): Dictionary to store selected bounding boxes and their track IDs.
22
- centroids (List[List[int]]): List to store centroids of selected bounding boxes.
21
+ selected_boxes (dict[int, list[float]]): Dictionary to store selected bounding boxes and their track IDs.
22
+ centroids (list[list[int]]): List to store centroids of selected bounding boxes.
23
23
 
24
24
  Methods:
25
25
  mouse_event_for_distance: Handle mouse events for selecting objects in the video stream.
@@ -57,7 +57,7 @@ class Heatmap(ObjectCounter):
57
57
  Efficiently calculate heatmap area and effect location for applying colormap.
58
58
 
59
59
  Args:
60
- box (List[float]): Bounding box coordinates [x0, y0, x1, y1].
60
+ box (list[float]): Bounding box coordinates [x0, y0, x1, y1].
61
61
  """
62
62
  x0, y0, x1, y1 = map(int, box)
63
63
  radius_squared = (min(x1 - x0, y1 - y0) // 2) ** 2
@@ -16,10 +16,10 @@ class InstanceSegmentation(BaseSolution):
16
16
  Attributes:
17
17
  model (str): The segmentation model to use for inference.
18
18
  line_width (int): Width of the bounding box and text lines.
19
- names (Dict[int, str]): Dictionary mapping class indices to class names.
20
- clss (List[int]): List of detected class indices.
21
- track_ids (List[int]): List of track IDs for detected instances.
22
- masks (List[np.ndarray]): List of segmentation masks for detected instances.
19
+ names (dict[int, str]): Dictionary mapping class indices to class names.
20
+ clss (list[int]): List of detected class indices.
21
+ track_ids (list[int]): List of track IDs for detected instances.
22
+ masks (list[np.ndarray]): List of segmentation masks for detected instances.
23
23
  show_conf (bool): Whether to display confidence scores.
24
24
  show_labels (bool): Whether to display class labels.
25
25
  show_boxes (bool): Whether to display bounding boxes.
@@ -19,8 +19,8 @@ class ObjectCounter(BaseSolution):
19
19
  Attributes:
20
20
  in_count (int): Counter for objects moving inward.
21
21
  out_count (int): Counter for objects moving outward.
22
- counted_ids (List[int]): List of IDs of objects that have been counted.
23
- classwise_counts (Dict[str, Dict[str, int]]): Dictionary for counts, categorized by object class.
22
+ counted_ids (list[int]): List of IDs of objects that have been counted.
23
+ classwise_counts (dict[str, dict[str, int]]): Dictionary for counts, categorized by object class.
24
24
  region_initialized (bool): Flag indicating whether the counting region has been initialized.
25
25
  show_in (bool): Flag to control display of inward count.
26
26
  show_out (bool): Flag to control display of outward count.
@@ -63,9 +63,9 @@ class ObjectCounter(BaseSolution):
63
63
  Count objects within a polygonal or linear region based on their tracks.
64
64
 
65
65
  Args:
66
- current_centroid (Tuple[float, float]): Current centroid coordinates (x, y) in the current frame.
66
+ current_centroid (tuple[float, float]): Current centroid coordinates (x, y) in the current frame.
67
67
  track_id (int): Unique identifier for the tracked object.
68
- prev_position (Tuple[float, float], optional): Last frame position coordinates (x, y) of the track.
68
+ prev_position (tuple[float, float], optional): Last frame position coordinates (x, y) of the track.
69
69
  cls (int): Class index for classwise count updates.
70
70
 
71
71
  Examples:
@@ -28,8 +28,8 @@ class ParkingPtsSelection:
28
28
  canvas (tk.Canvas): The canvas widget for displaying the image and drawing bounding boxes.
29
29
  image (PIL.Image.Image): The uploaded image.
30
30
  canvas_image (ImageTk.PhotoImage): The image displayed on the canvas.
31
- rg_data (List[List[Tuple[int, int]]]): List of bounding boxes, each defined by 4 points.
32
- current_box (List[Tuple[int, int]]): Temporary storage for the points of the current bounding box.
31
+ rg_data (list[list[tuple[int, int]]]): List of bounding boxes, each defined by 4 points.
32
+ current_box (list[tuple[int, int]]): Temporary storage for the points of the current bounding box.
33
33
  imgw (int): Original width of the uploaded image.
34
34
  imgh (int): Original height of the uploaded image.
35
35
  canvas_max_width (int): Maximum width of the canvas.
@@ -186,11 +186,11 @@ class ParkingManagement(BaseSolution):
186
186
 
187
187
  Attributes:
188
188
  json_file (str): Path to the JSON file containing parking region details.
189
- json (List[Dict]): Loaded JSON data containing parking region information.
190
- pr_info (Dict[str, int]): Dictionary storing parking information (Occupancy and Available spaces).
191
- arc (Tuple[int, int, int]): RGB color tuple for available region visualization.
192
- occ (Tuple[int, int, int]): RGB color tuple for occupied region visualization.
193
- dc (Tuple[int, int, int]): RGB color tuple for centroid visualization of detected objects.
189
+ json (list[dict]): Loaded JSON data containing parking region information.
190
+ pr_info (dict[str, int]): Dictionary storing parking information (Occupancy and Available spaces).
191
+ arc (tuple[int, int, int]): RGB color tuple for available region visualization.
192
+ occ (tuple[int, int, int]): RGB color tuple for occupied region visualization.
193
+ dc (tuple[int, int, int]): RGB color tuple for centroid visualization of detected objects.
194
194
 
195
195
  Methods:
196
196
  process: Process the input image for parking lot management and visualization.
@@ -15,10 +15,10 @@ class QueueManager(BaseSolution):
15
15
 
16
16
  Attributes:
17
17
  counts (int): The current count of objects in the queue.
18
- rect_color (Tuple[int, int, int]): RGB color tuple for drawing the queue region rectangle.
18
+ rect_color (tuple[int, int, int]): RGB color tuple for drawing the queue region rectangle.
19
19
  region_length (int): The number of points defining the queue region.
20
- track_line (List[Tuple[int, int]]): List of track line coordinates.
21
- track_history (Dict[int, List[Tuple[int, int]]]): Dictionary storing tracking history for each object.
20
+ track_line (list[tuple[int, int]]): List of track line coordinates.
21
+ track_history (dict[int, list[tuple[int, int]]]): Dictionary storing tracking history for each object.
22
22
 
23
23
  Methods:
24
24
  initialize_region: Initialize the queue region.
@@ -64,12 +64,12 @@ class RegionCounter(BaseSolution):
64
64
 
65
65
  Args:
66
66
  name (str): Name assigned to the new region.
67
- polygon_points (List[Tuple]): List of (x, y) coordinates defining the region's polygon.
68
- region_color (Tuple[int, int, int]): BGR color for region visualization.
69
- text_color (Tuple[int, int, int]): BGR color for the text within the region.
67
+ polygon_points (list[tuple]): List of (x, y) coordinates defining the region's polygon.
68
+ region_color (tuple[int, int, int]): BGR color for region visualization.
69
+ text_color (tuple[int, int, int]): BGR color for the text within the region.
70
70
 
71
71
  Returns:
72
- (Dict[str, any]): Returns a dictionary including the region information i.e. name, region_color etc.
72
+ (dict[str, any]): Returns a dictionary including the region information i.e. name, region_color etc.
73
73
  """
74
74
  region = self.region_template.copy()
75
75
  region.update(
@@ -33,7 +33,7 @@ class VisualAISearch:
33
33
  data_dir (Path): Path object for the data directory.
34
34
  model: Loaded CLIP model.
35
35
  index: FAISS index for similarity search.
36
- image_paths (List[str]): List of image file paths.
36
+ image_paths (list[str]): List of image file paths.
37
37
 
38
38
  Methods:
39
39
  extract_image_feature: Extract CLIP embedding from an image.
@@ -138,7 +138,7 @@ class VisualAISearch:
138
138
  similarity_thresh (float, optional): Minimum similarity threshold for filtering results.
139
139
 
140
140
  Returns:
141
- (List[str]): List of image filenames ranked by similarity score.
141
+ (list[str]): List of image filenames ranked by similarity score.
142
142
 
143
143
  Examples:
144
144
  Search for images matching a query
@@ -30,31 +30,31 @@ class BaseSolution:
30
30
  Polygon: Class for creating polygon geometries from shapely.
31
31
  Point: Class for creating point geometries from shapely.
32
32
  prep: Prepared geometry function from shapely for optimized spatial operations.
33
- CFG (Dict[str, Any]): Configuration dictionary loaded from YAML file and updated with kwargs.
33
+ CFG (dict[str, Any]): Configuration dictionary loaded from YAML file and updated with kwargs.
34
34
  LOGGER: Logger instance for solution-specific logging.
35
35
  annotator: Annotator instance for drawing on images.
36
36
  tracks: YOLO tracking results from the latest inference.
37
37
  track_data: Extracted tracking data (boxes or OBB) from tracks.
38
- boxes (List): Bounding box coordinates from tracking results.
39
- clss (List[int]): Class indices from tracking results.
40
- track_ids (List[int]): Track IDs from tracking results.
41
- confs (List[float]): Confidence scores from tracking results.
38
+ boxes (list): Bounding box coordinates from tracking results.
39
+ clss (list[int]): Class indices from tracking results.
40
+ track_ids (list[int]): Track IDs from tracking results.
41
+ confs (list[float]): Confidence scores from tracking results.
42
42
  track_line: Current track line for storing tracking history.
43
43
  masks: Segmentation masks from tracking results.
44
44
  r_s: Region or line geometry object for spatial operations.
45
45
  frame_no (int): Current frame number for logging purposes.
46
- region (List[Tuple[int, int]]): List of coordinate tuples defining region of interest.
46
+ region (list[tuple[int, int]]): List of coordinate tuples defining region of interest.
47
47
  line_width (int): Width of lines used in visualizations.
48
48
  model (YOLO): Loaded YOLO model instance.
49
- names (Dict[int, str]): Dictionary mapping class indices to class names.
50
- classes (List[int]): List of class indices to track.
49
+ names (dict[int, str]): Dictionary mapping class indices to class names.
50
+ classes (list[int]): List of class indices to track.
51
51
  show_conf (bool): Flag to show confidence scores in annotations.
52
52
  show_labels (bool): Flag to show class labels in annotations.
53
53
  device (str): Device for model inference.
54
- track_add_args (Dict[str, Any]): Additional arguments for tracking configuration.
54
+ track_add_args (dict[str, Any]): Additional arguments for tracking configuration.
55
55
  env_check (bool): Flag indicating whether environment supports image display.
56
56
  track_history (defaultdict): Dictionary storing tracking history for each object.
57
- profilers (Tuple): Profiler instances for performance monitoring.
57
+ profilers (tuple): Profiler instances for performance monitoring.
58
58
 
59
59
  Methods:
60
60
  adjust_box_label: Generate formatted label for bounding box.
@@ -193,7 +193,7 @@ class BaseSolution:
193
193
 
194
194
  Args:
195
195
  track_id (int): The unique identifier for the tracked object.
196
- box (List[float]): The bounding box coordinates of the object in the format [x1, y1, x2, y2].
196
+ box (list[float]): The bounding box coordinates of the object in the format [x1, y1, x2, y2].
197
197
 
198
198
  Examples:
199
199
  >>> solution = BaseSolution()
@@ -333,8 +333,8 @@ class SolutionAnnotator(Annotator):
333
333
  Draw a region or line on the image.
334
334
 
335
335
  Args:
336
- reg_pts (List[Tuple[int, int]], optional): Region points (for line 2 points, for region 4+ points).
337
- color (Tuple[int, int, int]): RGB color value for the region.
336
+ reg_pts (list[tuple[int, int]], optional): Region points (for line 2 points, for region 4+ points).
337
+ color (tuple[int, int, int]): RGB color value for the region.
338
338
  thickness (int): Line thickness for drawing the region.
339
339
  """
340
340
  cv2.polylines(self.im, [np.array(reg_pts, dtype=np.int32)], isClosed=True, color=color, thickness=thickness)
@@ -355,9 +355,9 @@ class SolutionAnnotator(Annotator):
355
355
 
356
356
  Args:
357
357
  label (str): Queue counts label.
358
- points (List[Tuple[int, int]], optional): Region points for center point calculation to display text.
359
- region_color (Tuple[int, int, int]): RGB queue region color.
360
- txt_color (Tuple[int, int, int]): RGB text display color.
358
+ points (list[tuple[int, int]], optional): Region points for center point calculation to display text.
359
+ region_color (tuple[int, int, int]): RGB queue region color.
360
+ txt_color (tuple[int, int, int]): RGB text display color.
361
361
  """
362
362
  x_values = [point[0] for point in points]
363
363
  y_values = [point[1] for point in points]
@@ -402,9 +402,9 @@ class SolutionAnnotator(Annotator):
402
402
 
403
403
  Args:
404
404
  im0 (np.ndarray): Inference image.
405
- text (Dict[str, Any]): Labels dictionary.
406
- txt_color (Tuple[int, int, int]): Display color for text foreground.
407
- bg_color (Tuple[int, int, int]): Display color for text background.
405
+ text (dict[str, Any]): Labels dictionary.
406
+ txt_color (tuple[int, int, int]): Display color for text foreground.
407
+ bg_color (tuple[int, int, int]): Display color for text background.
408
408
  margin (int): Gap between text and rectangle for better display.
409
409
  """
410
410
  horizontal_gap = int(im0.shape[1] * 0.02)
@@ -432,9 +432,9 @@ class SolutionAnnotator(Annotator):
432
432
  Calculate the angle between three points for workout monitoring.
433
433
 
434
434
  Args:
435
- a (List[float]): The coordinates of the first point.
436
- b (List[float]): The coordinates of the second point (vertex).
437
- c (List[float]): The coordinates of the third point.
435
+ a (list[float]): The coordinates of the first point.
436
+ b (list[float]): The coordinates of the second point (vertex).
437
+ c (list[float]): The coordinates of the third point.
438
438
 
439
439
  Returns:
440
440
  (float): The angle in degrees between the three points.
@@ -454,8 +454,8 @@ class SolutionAnnotator(Annotator):
454
454
  Draw specific keypoints for gym steps counting.
455
455
 
456
456
  Args:
457
- keypoints (List[List[float]]): Keypoints data to be plotted, each in format [x, y, confidence].
458
- indices (List[int], optional): Keypoint indices to be plotted.
457
+ keypoints (list[list[float]]): Keypoints data to be plotted, each in format [x, y, confidence].
458
+ indices (list[int], optional): Keypoint indices to be plotted.
459
459
  radius (int): Keypoint radius.
460
460
  conf_thresh (float): Confidence threshold for keypoints.
461
461
 
@@ -491,9 +491,9 @@ class SolutionAnnotator(Annotator):
491
491
 
492
492
  Args:
493
493
  display_text (str): The text to be displayed.
494
- position (Tuple[int, int]): Coordinates (x, y) on the image where the text will be placed.
495
- color (Tuple[int, int, int]): Text background color.
496
- txt_color (Tuple[int, int, int]): Text foreground color.
494
+ position (tuple[int, int]): Coordinates (x, y) on the image where the text will be placed.
495
+ color (tuple[int, int, int]): Text background color.
496
+ txt_color (tuple[int, int, int]): Text foreground color.
497
497
 
498
498
  Returns:
499
499
  (int): The height of the text.
@@ -529,9 +529,9 @@ class SolutionAnnotator(Annotator):
529
529
  angle_text (str): Angle value for workout monitoring.
530
530
  count_text (str): Counts value for workout monitoring.
531
531
  stage_text (str): Stage decision for workout monitoring.
532
- center_kpt (List[int]): Centroid pose index for workout monitoring.
533
- color (Tuple[int, int, int]): Text background color.
534
- txt_color (Tuple[int, int, int]): Text foreground color.
532
+ center_kpt (list[int]): Centroid pose index for workout monitoring.
533
+ color (tuple[int, int, int]): Text background color.
534
+ txt_color (tuple[int, int, int]): Text foreground color.
535
535
  """
536
536
  # Format text
537
537
  angle_text, count_text, stage_text = f" {angle_text:.2f}", f"Steps : {count_text}", f" {stage_text}"
@@ -559,9 +559,9 @@ class SolutionAnnotator(Annotator):
559
559
 
560
560
  Args:
561
561
  pixels_distance (float): Pixels distance between two bbox centroids.
562
- centroids (List[Tuple[int, int]]): Bounding box centroids data.
563
- line_color (Tuple[int, int, int]): Distance line color.
564
- centroid_color (Tuple[int, int, int]): Bounding box centroid color.
562
+ centroids (list[tuple[int, int]]): Bounding box centroids data.
563
+ line_color (tuple[int, int, int]): Distance line color.
564
+ centroid_color (tuple[int, int, int]): Bounding box centroid color.
565
565
  """
566
566
  # Get the text size
567
567
  text = f"Pixels Distance: {pixels_distance:.2f}"
@@ -603,8 +603,8 @@ class SolutionAnnotator(Annotator):
603
603
  Args:
604
604
  im0 (np.ndarray): Inference image.
605
605
  text (str): Object/class name.
606
- txt_color (Tuple[int, int, int]): Display color for text foreground.
607
- bg_color (Tuple[int, int, int]): Display color for text background.
606
+ txt_color (tuple[int, int, int]): Display color for text foreground.
607
+ bg_color (tuple[int, int, int]): Display color for text background.
608
608
  x_center (float): The x position center point for bounding box.
609
609
  y_center (float): The y position center point for bounding box.
610
610
  margin (int): The gap between text and rectangle for better display.
@@ -651,8 +651,8 @@ class SolutionAnnotator(Annotator):
651
651
  line_x (int): The x-coordinate of the sweep line.
652
652
  line_y (int): The y-coordinate limit of the sweep line.
653
653
  label (str, optional): Text label to be drawn in center of sweep line. If None, no label is drawn.
654
- color (Tuple[int, int, int]): RGB color for the line and label background.
655
- txt_color (Tuple[int, int, int]): RGB color for the label text.
654
+ color (tuple[int, int, int]): RGB color for the line and label background.
655
+ txt_color (tuple[int, int, int]): RGB color for the label text.
656
656
  """
657
657
  # Draw the sweep line
658
658
  cv2.line(self.im, (line_x, 0), (line_x, line_y), color, self.tf * 2)
@@ -688,10 +688,10 @@ class SolutionAnnotator(Annotator):
688
688
  Perform pinpoint human-vision eye mapping and plotting.
689
689
 
690
690
  Args:
691
- box (List[float]): Bounding box coordinates in format [x1, y1, x2, y2].
692
- center_point (Tuple[int, int]): Center point for vision eye view.
693
- color (Tuple[int, int, int]): Object centroid and line color.
694
- pin_color (Tuple[int, int, int]): Visioneye point color.
691
+ box (list[float]): Bounding box coordinates in format [x1, y1, x2, y2].
692
+ center_point (tuple[int, int]): Center point for vision eye view.
693
+ color (tuple[int, int, int]): Object centroid and line color.
694
+ pin_color (tuple[int, int, int]): Visioneye point color.
695
695
  """
696
696
  center_bbox = int((box[0] + box[2]) / 2), int((box[1] + box[3]) / 2)
697
697
  cv2.circle(self.im, center_point, self.tf * 2, pin_color, -1)
@@ -711,10 +711,10 @@ class SolutionAnnotator(Annotator):
711
711
  Draw a label with a background rectangle or circle centered within a given bounding box.
712
712
 
713
713
  Args:
714
- box (Tuple[float, float, float, float]): The bounding box coordinates (x1, y1, x2, y2).
714
+ box (tuple[float, float, float, float]): The bounding box coordinates (x1, y1, x2, y2).
715
715
  label (str): The text label to be displayed.
716
- color (Tuple[int, int, int]): The background color of the rectangle (B, G, R).
717
- txt_color (Tuple[int, int, int]): The color of the text (R, G, B).
716
+ color (tuple[int, int, int]): The background color of the rectangle (B, G, R).
717
+ txt_color (tuple[int, int, int]): The color of the text (R, G, B).
718
718
  shape (str): The shape of the label i.e "circle" or "rect"
719
719
  margin (int): The margin between the text and the rectangle border.
720
720
  """
@@ -768,7 +768,7 @@ class SolutionResults:
768
768
  plot_im (np.ndarray): Processed image with counts, blurred, or other effects from solutions.
769
769
  in_count (int): The total number of "in" counts in a video stream.
770
770
  out_count (int): The total number of "out" counts in a video stream.
771
- classwise_count (Dict[str, int]): A dictionary containing counts of objects categorized by class.
771
+ classwise_count (dict[str, int]): A dictionary containing counts of objects categorized by class.
772
772
  queue_count (int): The count of objects in a queue or waiting area.
773
773
  workout_count (int): The count of workout repetitions.
774
774
  workout_angle (float): The angle calculated during a workout exercise.
@@ -778,10 +778,10 @@ class SolutionResults:
778
778
  filled_slots (int): The number of filled slots in a monitored area.
779
779
  email_sent (bool): A flag indicating whether an email notification was sent.
780
780
  total_tracks (int): The total number of tracked objects.
781
- region_counts (Dict[str, int]): The count of objects within a specific region.
782
- speed_dict (Dict[str, float]): A dictionary containing speed information for tracked objects.
781
+ region_counts (dict[str, int]): The count of objects within a specific region.
782
+ speed_dict (dict[str, float]): A dictionary containing speed information for tracked objects.
783
783
  total_crop_objects (int): Total number of cropped objects using ObjectCropper class.
784
- speed (Dict[str, float]): Performance timing information for tracking and solution processing.
784
+ speed (dict[str, float]): Performance timing information for tracking and solution processing.
785
785
  """
786
786
 
787
787
  def __init__(self, **kwargs):
@@ -34,7 +34,7 @@ class Inference:
34
34
  org_frame (Any): Container for the original frame to be displayed.
35
35
  ann_frame (Any): Container for the annotated frame to be displayed.
36
36
  vid_file_name (str | int): Name of the uploaded video file or webcam index.
37
- selected_ind (List[int]): List of selected class indices for detection.
37
+ selected_ind (list[int]): List of selected class indices for detection.
38
38
 
39
39
  Methods:
40
40
  web_ui: Set up the Streamlit web interface with custom HTML elements.
@@ -19,10 +19,10 @@ class TrackZone(BaseSolution):
19
19
  Attributes:
20
20
  region (np.ndarray): The polygonal region for tracking, represented as a convex hull of points.
21
21
  line_width (int): Width of the lines used for drawing bounding boxes and region boundaries.
22
- names (List[str]): List of class names that the model can detect.
23
- boxes (List[np.ndarray]): Bounding boxes of tracked objects.
24
- track_ids (List[int]): Unique identifiers for each tracked object.
25
- clss (List[int]): Class indices of tracked objects.
22
+ names (list[str]): List of class names that the model can detect.
23
+ boxes (list[np.ndarray]): Bounding boxes of tracked objects.
24
+ track_ids (list[int]): Unique identifiers for each tracked object.
25
+ clss (list[int]): Class indices of tracked objects.
26
26
 
27
27
  Methods:
28
28
  process: Process each frame of the video, applying region-based tracking.
@@ -14,7 +14,7 @@ class VisionEye(BaseSolution):
14
14
  mapping vision points, and annotating results with bounding boxes and labels.
15
15
 
16
16
  Attributes:
17
- vision_point (Tuple[int, int]): Coordinates (x, y) where vision will view objects and draw tracks.
17
+ vision_point (tuple[int, int]): Coordinates (x, y) where vision will view objects and draw tracks.
18
18
 
19
19
  Methods:
20
20
  process: Process the input image to detect objects, annotate them, and apply vision mapping.
@@ -58,7 +58,7 @@ class STrack(BaseTrack):
58
58
  Initialize a new STrack instance.
59
59
 
60
60
  Args:
61
- xywh (List[float]): Bounding box coordinates and dimensions in the format (x, y, w, h, [a], idx), where
61
+ xywh (list[float]): Bounding box coordinates and dimensions in the format (x, y, w, h, [a], idx), where
62
62
  (x, y) is the center, (w, h) are width and height, [a] is optional aspect ratio, and idx is the id.
63
63
  score (float): Confidence score of the detection.
64
64
  cls (Any): Class label for the detected object.
@@ -246,9 +246,9 @@ class BYTETracker:
246
246
  predicting the new object locations, and performs data association.
247
247
 
248
248
  Attributes:
249
- tracked_stracks (List[STrack]): List of successfully activated tracks.
250
- lost_stracks (List[STrack]): List of lost tracks.
251
- removed_stracks (List[STrack]): List of removed tracks.
249
+ tracked_stracks (list[STrack]): List of successfully activated tracks.
250
+ lost_stracks (list[STrack]): List of lost tracks.
251
+ removed_stracks (list[STrack]): List of removed tracks.
252
252
  frame_id (int): The current frame ID.
253
253
  args (Namespace): Command-line arguments.
254
254
  max_time_lost (int): The maximum frames for a track to be considered as 'lost'.
@@ -286,9 +286,9 @@ class BYTETracker:
286
286
  >>> args = Namespace(track_buffer=30)
287
287
  >>> tracker = BYTETracker(args, frame_rate=30)
288
288
  """
289
- self.tracked_stracks = [] # type: List[STrack]
290
- self.lost_stracks = [] # type: List[STrack]
291
- self.removed_stracks = [] # type: List[STrack]
289
+ self.tracked_stracks = [] # type: list[STrack]
290
+ self.lost_stracks = [] # type: list[STrack]
291
+ self.removed_stracks = [] # type: list[STrack]
292
292
 
293
293
  self.frame_id = 0
294
294
  self.args = args
@@ -320,7 +320,7 @@ class BYTETracker:
320
320
  detections = self.init_track(results, feats_keep)
321
321
  # Add newly detected tracklets to tracked_stracks
322
322
  unconfirmed = []
323
- tracked_stracks = [] # type: List[STrack]
323
+ tracked_stracks = [] # type: list[STrack]
324
324
  for track in self.tracked_stracks:
325
325
  if not track.is_activated:
326
326
  unconfirmed.append(track)
@@ -439,9 +439,9 @@ class BYTETracker:
439
439
 
440
440
  def reset(self):
441
441
  """Reset the tracker by clearing all tracked, lost, and removed tracks and reinitializing the Kalman filter."""
442
- self.tracked_stracks = [] # type: List[STrack]
443
- self.lost_stracks = [] # type: List[STrack]
444
- self.removed_stracks = [] # type: List[STrack]
442
+ self.tracked_stracks = [] # type: list[STrack]
443
+ self.lost_stracks = [] # type: list[STrack]
444
+ self.removed_stracks = [] # type: list[STrack]
445
445
  self.frame_id = 0
446
446
  self.kalman_filter = self.get_kalmanfilter()
447
447
  self.reset_id()
@@ -21,7 +21,7 @@ class GMC:
21
21
  method (str): The tracking method to use. Options include 'orb', 'sift', 'ecc', 'sparseOptFlow', 'none'.
22
22
  downscale (int): Factor by which to downscale the frames for processing.
23
23
  prevFrame (np.ndarray): Previous frame for tracking.
24
- prevKeyPoints (List): Keypoints from the previous frame.
24
+ prevKeyPoints (list): Keypoints from the previous frame.
25
25
  prevDescriptors (np.ndarray): Descriptors from the previous frame.
26
26
  initializedFirstFrame (bool): Flag indicating if the first frame has been processed.
27
27
 
@@ -96,7 +96,7 @@ class GMC:
96
96
 
97
97
  Args:
98
98
  raw_frame (np.ndarray): The raw frame to be processed, with shape (H, W, C).
99
- detections (List, optional): List of detections to be used in the processing.
99
+ detections (list, optional): List of detections to be used in the processing.
100
100
 
101
101
  Returns:
102
102
  (np.ndarray): Transformation matrix with shape (2, 3).
@@ -163,7 +163,7 @@ class GMC:
163
163
 
164
164
  Args:
165
165
  raw_frame (np.ndarray): The raw frame to be processed, with shape (H, W, C).
166
- detections (List, optional): List of detections to be used in the processing.
166
+ detections (list, optional): List of detections to be used in the processing.
167
167
 
168
168
  Returns:
169
169
  (np.ndarray): Transformation matrix with shape (2, 3).
@@ -66,8 +66,8 @@ def iou_distance(atracks: list, btracks: list) -> np.ndarray:
66
66
  Compute cost based on Intersection over Union (IoU) between tracks.
67
67
 
68
68
  Args:
69
- atracks (List[STrack] | List[np.ndarray]): List of tracks 'a' or bounding boxes.
70
- btracks (List[STrack] | List[np.ndarray]): List of tracks 'b' or bounding boxes.
69
+ atracks (list[STrack] | list[np.ndarray]): List of tracks 'a' or bounding boxes.
70
+ btracks (list[STrack] | list[np.ndarray]): List of tracks 'b' or bounding boxes.
71
71
 
72
72
  Returns:
73
73
  (np.ndarray): Cost matrix computed based on IoU with shape (len(atracks), len(btracks)).
@@ -106,8 +106,8 @@ def embedding_distance(tracks: list, detections: list, metric: str = "cosine") -
106
106
  Compute distance between tracks and detections based on embeddings.
107
107
 
108
108
  Args:
109
- tracks (List[STrack]): List of tracks, where each track contains embedding features.
110
- detections (List[BaseTrack]): List of detections, where each detection contains embedding features.
109
+ tracks (list[STrack]): List of tracks, where each track contains embedding features.
110
+ detections (list[BaseTrack]): List of detections, where each detection contains embedding features.
111
111
  metric (str): Metric for distance computation. Supported metrics include 'cosine', 'euclidean', etc.
112
112
 
113
113
  Returns:
@@ -137,7 +137,7 @@ def fuse_score(cost_matrix: np.ndarray, detections: list) -> np.ndarray:
137
137
 
138
138
  Args:
139
139
  cost_matrix (np.ndarray): The matrix containing cost values for assignments, with shape (N, M).
140
- detections (List[BaseTrack]): List of detections, each containing a score attribute.
140
+ detections (list[BaseTrack]): List of detections, each containing a score attribute.
141
141
 
142
142
  Returns:
143
143
  (np.ndarray): Fused similarity matrix with shape (N, M).