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

Velocity block (w/ Byte Tracker) #754

Merged
merged 12 commits into from
Jan 24, 2025
Merged

Velocity block (w/ Byte Tracker) #754

merged 12 commits into from
Jan 24, 2025

Conversation

reedajohns
Copy link
Collaborator

Description

Implemented VelocityBlockV1:

  • Developed a new analytics block to calculate and embed velocities and speeds of Byte Tracked objects across video frames.
  • Supports smoothing of velocity measurements using an exponential moving average with configurable smoothing_alpha.
  • Incorporated unit conversion from pixels to meters via the pixels_per_meter parameter (e.g., pixels_per_meter=1000 for 1000 pixels = 1 meter).

Key Features:

  • Velocity Calculation: Computes raw and smoothed velocities based on object movements between frames.
  • Speed Calculation: Determines the magnitude of velocity vectors to obtain speed.

List any dependencies that are required for this change.

Screenshot 2024-10-18 at 1 52 53 PM

This requires the input of Byte Track detections and appends the velocity / speed to the detections metadata for use downstream:

Example:
'velocity': {4: [-9.669, 14.509]}, 'speed': {4: 17.432}, 'smoothed_velocity': {4: [-6.033, 9.555]}, 'smoothed_speed': {4: 11.300}}

Type of change

Please delete options that are not relevant.

  • New feature (non-breaking change which adds functionality)

How has this change been tested, please provide a testcase or example of how you tested the change?

Unit Tests:

  • Test Scenarios:
    • Basic Calculations: Verified accurate velocity and speed computations across consecutive frames.
    • New Tracker Handling: Ensured the block correctly initializes velocities for newly appearing objects.
    • Error Conditions: Confirmed that invalid inputs (e.g., missing tracker_id, invalid smoothing_alpha, non-positive pixels_per_meter) raise appropriate ValueError exceptions.
    • Edge Cases: Tested scenarios such as zero time difference between frames and large object movements to validate robustness.

@hansent
Copy link
Contributor

hansent commented Jan 16, 2025

@reedajohns are we still working on this or should I close as stale?

@grzegorz-roboflow grzegorz-roboflow merged commit de69fbd into main Jan 24, 2025
35 checks passed
@grzegorz-roboflow grzegorz-roboflow deleted the velocity_block branch January 24, 2025 12:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants