Skip to content

Fix FPS truncated to integer in multiple locations#203

Merged
bricksdont merged 1 commit intomasterfrom
fix/fps-float-precision
Feb 24, 2026
Merged

Fix FPS truncated to integer in multiple locations#203
bricksdont merged 1 commit intomasterfrom
fix/fps-float-precision

Conversation

@AmitMY
Copy link
Collaborator

@AmitMY AmitMY commented Feb 21, 2026

Summary

Fixes #201PoseBody.fps is typed as float (since v0.2), but several locations cast it to int, silently losing precision for non-integer framerates like 29.97 fps (NTSC standard).

Changes:

  • utils/openpose.py: Remove int(fps) cast in load_openpose() — pass fps through as-is
  • utils/generic.py: Fix fake_pose() signature from fps: int=25 to fps: float=25.0, remove int(fps) cast
  • tensorflow/pose_body.py: Change TFRecord field from tf.int64 to tf.float32, serialize as FloatList instead of Int64List, remove unnecessary tf.cast on deserialization
  • utils/holistic.py: Fix load_mediapipe_directory() type annotation from fps: int to fps: float
  • numpy/pose_body.py: Fix interpolate() type annotation from new_fps: int to new_fps: float

Test plan

  • Existing tests pass (72/72, excluding pre-existing TF import failures)
  • Verified fake_pose(10, fps=29.97) now preserves 29.97 instead of truncating to 29

Note

Breaking change for TFRecord: Existing TFRecords serialized with int64 fps will not be compatible with the updated float32 schema. This is intentional — the old format was lossy.

🤖 Generated with Claude Code

Remove int() casts and fix type annotations that truncated non-integer
framerates (e.g. 29.97, 23.976 fps) to integers, causing audio/video
sync drift.

Fixes #201

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Copy link
Collaborator

@bricksdont bricksdont left a comment

Choose a reason for hiding this comment

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

looks good to me!

@bricksdont
Copy link
Collaborator

just one question:

Breaking change for TFRecord: Existing TFRecords serialized with int64 fps will not be compatible with the updated float32 schema. This is intentional — the old format was lossy.

does this have any impact on existing pose data from https://github.com/sign-language-processing/datasets?

@AmitMY
Copy link
Collaborator Author

AmitMY commented Feb 24, 2026

does this have any impact on existing pose data from sign-language-processing/datasets?

No! this format was actually for when I worked for Google and needed to load the data with tensorflow.
datasets separately needs a fix https://github.com/sign-language-processing/datasets/blob/master/sign_language_datasets/utils/features/pose_feature.py#L127

@bricksdont bricksdont merged commit 8e9471e into master Feb 24, 2026
8 checks passed
@AmitMY AmitMY deleted the fix/fps-float-precision branch February 24, 2026 08:10
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.

FPS truncated to integer in multiple locations, losing precision for non-integer framerates

2 participants