Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

example/traffic_analysis #354

Merged
merged 9 commits into from
Sep 4, 2023
Merged

example/traffic_analysis #354

merged 9 commits into from
Sep 4, 2023

Conversation

SkalskiP
Copy link
Collaborator

@SkalskiP SkalskiP commented Sep 4, 2023

Description

Traffic flow analysis using YOLOv8 and ByteTrack. It uses the Supervision package for multiple tasks such as tracking, annotations, etc.

SkalskiP and others added 7 commits September 1, 2023 18:06
Introduced a python script for video processing using YOLO and ByteTrack. The script processes videos frame by frame and allows annotation based on model's detections. Additionally, the requirements.txt file was added along with .gitignore to exclude the data/ directory. The requirements file lists the necessary packages for the script to run.
Added two new classes to enhance traffic analysis over video frames. Trace class stores the positional information of different objects detected in each video frame for a specified length. TraceAnnotator class uses the information stored in Trace instance to annotate the motion path of detected objects on the video frames. Also, corrected the incorrect numpy import statement in the dependence code.
The change modifies the polygon zone verification method in `polygon_zone.py` to ensure `self.current_count` always returns an integer, preventing possible type errors in downstream processing. Two classes, `Trace` and `TraceAnnotator`, were added to `annotate.py`, providing functionality for trace annotation during detection. In `script.py`, optimized the trace annotation process by replacing the previous class implementations with the new ones from `annotate.py`, and also cleaned up and simplified polygon zone initiation and frame processing. This provides more efficient and robust video processing and zone-based detection features."
Restructuring the video stream and traffics analysis codes resulted in two new key classes, VideoProcessor, and DetectionsManager. The main aim behind this was to improve code readability and reusability. VideoProcessor class handles video processing as an object, while DetectionsManager is responsible for managing detections and trackings. This change has also led to the removal of the process_frame function, as its functionality is now encapsulated within VideoProcessor class methods. Moreover, the code now identifies zones in and out separately, thereby handling detections more distinctly and efficiently. Lastly, Polygon Zones are no longer differentiated by color.
…ntation

Introduced TraceAnnotator in the supervision package, refactored traffic analysis script for improved readability, and added quality documentation.
@SkalskiP SkalskiP self-assigned this Sep 4, 2023
@SkalskiP SkalskiP added api:examples Supervision Example Related version: 0.15.0 Feature to be added in `0.15.0` release labels Sep 4, 2023
@SkalskiP SkalskiP added this to the version: 0.15.0 milestone Sep 4, 2023
@SkalskiP SkalskiP merged commit 7c97e87 into develop Sep 4, 2023
4 checks passed
@SkalskiP SkalskiP deleted the example/traffic_analysis branch January 2, 2024 18:51
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
api:examples Supervision Example Related version: 0.15.0 Feature to be added in `0.15.0` release
Projects
Status: Current Release: Done
Development

Successfully merging this pull request may close these issues.

1 participant