Skip to content

Empty packet sent before correct packet on output streams for some frames, causing 1-frame offset. #552

@megawattfs

Description

@megawattfs

Plugin Version or Commit ID

v0.5.0

Unity Version

2020.3.23f1

Your Host OS

Windows 10

Target Platform

Windows Standalone

Description

I am using MediaPipe Pose on a series of images. I pass input into the "input_video" stream, then wait for an output packet in the "pose_landmarks" stream before providing the next input packet. Therefore, there should be no race conditions between input packets. I have also verified that no input packets are being assigned identical timestamps.

I had the observeTimestampBounds option set to "true" on all four output streams (pose_detection, pose_landmarks, pose_world_landmarks, and roi_from_landmarks) so that an empty packet would be sent in case detection failed. In our data, there are no input images where pose detection fails completely. However, occasionally an empty packet appears in the "pose_landmarks" output stream after an image is input. Whenever this happens, the correct packet for that image does appear in the "pose_landmarks" output stream, but not until an additional input (i.e. the next image frame) has been input. Consequently, every frame input thereafter will be incorrectly associated with the landmarks from the previous frame: There is an offset of 1 frame for each time an empty packet appears in "pose_landmarks."

Here is a simplified example of what happens when this situation occurs:

  1. Frame X sent to "input_video"
  2. Retrieve empty packet from "pose_landmarks"
  3. Frame X+1 sent to "input_video"
  4. Retrieve packet containing Frame X's landmarks from "pose_landmarks"
  5. Frame X+2 sent to "input_video"
  6. Retrieve packet containing Frame X+1's landmarks from "pose_landmarks"
    ...etc. each frame will be offset by one, and there is no way to distinguish an empty packet sent due to failed pose detection from an empty packet sent between two consecutive valid frame landmark packets as shown above.

If I set the observeTimestampBounds option to "false," the problem is eliminated; however, this is problematic because an empty packet is never sent to indicate that pose detection has actually failed on a frame, which may be required for other datasets. Changing the timeout value for the GraphRunner (PoseTrackingGraph) up to 5 seconds did not resolve the issue.

Additional Context

I already verified that no two input packets have the same timestamp. I also tried increasing the timeout time on the GraphRunner. As described above, setting observeTimestampBounds to false for the output stream fixes the problem but will cause the program to hang if I try to pass in data for which pose detection fails. The issue occurs regardless of whether landmark smoothing is enabled.

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions