Skip to content

Use converted frame filenames in COCO JSON output#15

Merged
niksirbi merged 1 commit intomainfrom
fix-img-links-in-json
Jan 23, 2026
Merged

Use converted frame filenames in COCO JSON output#15
niksirbi merged 1 commit intomainfrom
fix-img-links-in-json

Conversation

@niksirbi
Copy link
Copy Markdown
Member

@niksirbi niksirbi commented Jan 14, 2026

Description

What is this PR

  • Bug fix
  • Addition of a new feature
  • Other

Why is this PR needed?

The frame file names in the output .json files are the same as in the source DLC project. We need them to conform to the "pose-benchmarks" naming schema.

What does this PR do?

Generate custom filenames matching the renamed frames (e.g., sub-{subject}_ses-{session}_view-{view}_frame-{number}.png) and pass them to annotations_to_coco, so the output JSON references the converted frame files instead of the original source paths.

Handles sleap-io returning video.filename as a list by using frame_idx to get the correct image path for each labeled frame.

References

Follows up on #14

How has this PR been tested?

I tested it locally on Linux and MacOS, and I got the following .json file.

sub-M708149_ses-20200317_view-topdown_framelabels.json

Is this a breaking change?

N/A

Does this PR require an update to the documentation?

N/A

Checklist:

  • The code has been tested locally
  • Tests have been added to cover all new functionality
  • The documentation has been updated to reflect any changes
  • The code has been formatted with pre-commit

Generate custom filenames matching the renamed frames
(e.g., sub-{subject}_ses-{session}_view-{view}_frame-{number}.png)
and pass them to annotations_to_coco, so the output JSON references
the converted frame files instead of the original source paths.

Handles sleap-io returning video.filename as a list by using
frame_idx to get the correct image path for each labeled frame.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
@niksirbi niksirbi marked this pull request as ready for review January 23, 2026 14:06
@niksirbi niksirbi merged commit 8ea3168 into main Jan 23, 2026
21 checks passed
@niksirbi niksirbi deleted the fix-img-links-in-json branch January 23, 2026 14:06
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.

1 participant