DropDetection_YOLO_Sparse
safe_delete(file:str)
Safely deletes a file if it exists.
Parameters:
file
(str): Path to the file to delete.
Returns:
None
: NoneRaises:
Exception
: If any unexpected error occurs while deleting the file.
Labels:
src_PyThon_ContactAngle_DropDetection_DropDetection_YOLO_Sparse_safe_delete
delInRange(_start:int, _end:int, _listadress:list, max_threads:int, optional)
Deletes a range of files from a list using multithreading.
Parameters:
_start
(int): Start index of the file range to delete._end
(int): End index (exclusive) of the file range to delete._listadress
(list): List of file paths.max_threads
(int, optional): Maximum number of threads to use. Defaults to 8.
Returns:
None
: NoneRaises:
Exception
: If any unexpected error occurs during file deletion.
Labels:
src_PyThon_ContactAngle_DropDetection_DropDetection_YOLO_Sparse_delInRange
detect_and_filter_batch(index_range:tuple)
Worker function for a process that detects drops in a batch of frames using YOLO. Deletes all frames in the range if no drops are detected in the first and last frames.
Parameters:
index_range
(tuple): Contains (start_idx, end_idx, frame_list, skip, yolo_conf)
Labels:
src_PyThon_ContactAngle_DropDetection_DropDetection_YOLO_Sparse_detect_and_filter_batch
Walker(image_folder:str, skip:int, optional, yolo_conf:float, optional, num_workers:int, optional)
Walk through all images in a folder in steps of `skip` frames. Uses multiprocessing to detect drops with YOLO and deletes frame ranges without drops.
Parameters:
image_folder
(str): Path to the folder containing image frames.skip
(int, optional): Frame step size. Defaults to 90.yolo_conf
(float, optional): YOLO confidence threshold. Defaults to 0.6.num_workers
(int, optional): Number of parallel processes. Defaults to half of CPU cores.
Returns:
None
: NoneExamples:
>>> Walker("extracted_frames", skip=30, yolo_conf=0.5)
Labels:
src_PyThon_ContactAngle_DropDetection_DropDetection_YOLO_Sparse_Walker