Enhances construction site safety using YOLO for object detection, identifying hazards like workers without helmets or safety vests, and proximity to machinery or vehicles. HDBSCAN clusters safety cone coordinates to create monitored zones. Post-processing algorithms improve detection accuracy.
This PR refactors the augment_image function in the data_augmentation.py file to improve its readability and maintainability. The function has been broken down into smaller, more focused functions to adhere to the Single Responsibility Principle.
Summary of Changes
Extracted the code block from lines 55 to 85 in the augment_image function into a new function called process_image.
Moved the process_image function to a new file called image_processing.py.
Updated the imports in the data_augmentation.py file to import the process_image function from the image_processing.py file.
Updated the augment_image function to call the process_image function with the required arguments.
Updated the class docstring for DataAugmentation to reflect the changes made to the augment_image function.
Please review and merge this PR to improve the maintainability of the codebase.
PR Feedback (click)
I created this PR to address this rule:
"Refactor large functions to be more modular."
Description
This PR refactors the
augment_image
function in thedata_augmentation.py
file to improve its readability and maintainability. The function has been broken down into smaller, more focused functions to adhere to the Single Responsibility Principle.Summary of Changes
augment_image
function into a new function calledprocess_image
.process_image
function to a new file calledimage_processing.py
.data_augmentation.py
file to import theprocess_image
function from theimage_processing.py
file.augment_image
function to call theprocess_image
function with the required arguments.DataAugmentation
to reflect the changes made to theaugment_image
function.Please review and merge this PR to improve the maintainability of the codebase.