Skip to content
New issue

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

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

Already on GitHub? Sign in to your account

Create object_tracking_report.py #54

Closed
wants to merge 1 commit into from
Closed

Conversation

sv410
Copy link

@sv410 sv410 commented Oct 9, 2024

#53
To include the functionality for generating a video analysis report that summarizes the tracking results—including time spent by objects in certain areas, frequency of appearances, and other statistics—you can enhance the existing object_tracking_report.py script. Below is an updated version of the script with comments explaining the changes.
Time Spent by Objects: The script counts the number of frames that each object spends in a predefined area (e.g., coordinates from 100 to 300 for both x and y).

Frequency of Appearances: It counts how many times each object appears in the video.

Path Visualization: It tracks and stores the coordinates of each object's path throughout the video.

Report Generation: After the tracking session ends, a report is generated as a CSV file named video_analysis_report.csv, which summarizes the tracked data.

Instructions for Use:
Ensure you have the necessary libraries installed, as specified in the requirements.txt.
Adjust the configuration file path and model weights as needed.
Run the script to begin tracking and generating the report.
This will provide a comprehensive analysis of the tracked objects in the video, useful for various applications such as security assessments or sports analytics.
Once the tracking is complete (the user can quit the application by pressing 'q'), a CSV report file named video_analysis_report.csv will be generated. The report will include statistics such as:

Object ID: The identifier for each detected object.
Frequency of Appearance: The number of times each object was detected in the video.
Time Spent in Area: The number of frames the object spent in a predefined area of interest.
Path Coordinates: A list of coordinates indicating the path taken by the object throughout the video.

Here is a sample format of what the CSV file might look like:

Object ID | Frequency of Appearance | Time Spent in Area | Path Coordinates -- | -- | -- | -- 0 | 120 | 35 | [(150, 200), (160, 210), (170, 220)] 1 | 95 | 20 | [(300, 400), (310, 410), (320, 420)] 2 | 110 | 50 | [(400, 500), (410, 510), (420, 520)] The console will also print a message indicating that the report has been generated successfully: Report generated: video_analysis_report.csv conclusion: This output provides a comprehensive overview of the tracked objects in the video, useful for tasks such as security monitoring, sports analytics, or behavior analysis. The real-time tracking offers immediate visual feedback, while the CSV report allows for deeper analysis after the video processing is complete.

@MAVERICK-VF142
Copy link
Owner

hey @sv410, I appreciate your contribution but this is not what I was expecting. I want your code to run in integration with the original code present in the app.py file. please consider making the above changes as I want it to run only one file, for which you can make a separate file in the dependencies folder and call the modules to the app .py as in the future we are planning to make an entire UI dor the app.py

Copy link
Owner

@MAVERICK-VF142 MAVERICK-VF142 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

is not fully integrated with the previous versions of the app.py script

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants