Add docstrings and improve comments (#11229)
Signed-off-by: Glenn Jocher <glenn.jocher@ultralytics.com>
This commit is contained in:
parent
ccfc1cf925
commit
d5458f27cd
16 changed files with 34 additions and 17 deletions
|
|
@ -917,7 +917,6 @@ class Albumentations:
|
|||
return labels
|
||||
|
||||
|
||||
# TODO: technically this is not an augmentation, maybe we should put this to another files
|
||||
class Format:
|
||||
"""
|
||||
Formats image annotations for object detection, instance segmentation, and pose estimation tasks. The class
|
||||
|
|
|
|||
|
|
@ -14,7 +14,7 @@ import tkinter as tk
|
|||
|
||||
class ParkingPtsSelection:
|
||||
def __init__(self, master):
|
||||
# Initialize window and widgets.
|
||||
"""Initializes the UI for selecting parking zone points in a tkinter window."""
|
||||
self.master = master
|
||||
master.title("Ultralytics Parking Zones Points Selector")
|
||||
self.initialize_ui()
|
||||
|
|
@ -109,6 +109,7 @@ class ParkingPtsSelection:
|
|||
messagebox.showwarning("Warning", "No bounding boxes to remove.")
|
||||
|
||||
def save_to_json(self):
|
||||
"""Saves rescaled bounding boxes to 'bounding_boxes.json' based on image-to-canvas size ratio."""
|
||||
canvas_width, canvas_height = self.canvas.winfo_width(), self.canvas.winfo_height()
|
||||
width_scaling_factor = self.img_width / canvas_width
|
||||
height_scaling_factor = self.img_height / canvas_height
|
||||
|
|
|
|||
|
|
@ -268,6 +268,7 @@ from ultralytics import YOLO
|
|||
|
||||
|
||||
def run_tracker_in_thread(filename, model):
|
||||
"""Starts multi-thread tracking on video from `filename` using `model` and displays results frame by frame."""
|
||||
video = cv2.VideoCapture(filename)
|
||||
frames = int(video.get(cv2.CAP_PROP_FRAME_COUNT))
|
||||
for _ in range(frames):
|
||||
|
|
|
|||
|
|
@ -343,11 +343,7 @@ class Instances:
|
|||
self.keypoints[..., 1] = self.keypoints[..., 1].clip(0, h)
|
||||
|
||||
def remove_zero_area_boxes(self):
|
||||
"""
|
||||
Remove zero-area boxes, i.e. after clipping some boxes may have zero width or height.
|
||||
|
||||
This removes them.
|
||||
"""
|
||||
"""Remove zero-area boxes, i.e. after clipping some boxes may have zero width or height."""
|
||||
good = self.bbox_areas > 0
|
||||
if not all(good):
|
||||
self._bboxes = self._bboxes[good]
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue