feat(annotate_subtasks): only downsample frames larger than target_size#261
Merged
Conversation
Frames whose shorter side is already <= target_size now pass through at their native resolution instead of being upscaled and center-cropped. Upsampling small frames just inflates image-token cost without adding information. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Contributor
|
[claude-review] summary for commit 4948551 No blocking issues found. Verified:
|
akshay18iitg
approved these changes
May 4, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What this does
_resize_and_center_cropinsrc/opentau/scripts/annotate_subtasks.pypreviously upsampled small frames (e.g. 224×224) up totarget_size × target_size(default 448×448) and center-cropped. Upsampling adds no information — it just inflates image-token cost on the Anthropic / Gemini API and slows the request.This PR changes the behavior so the function:
target_size(unchanged path for typical 30–50 fps recordings shot at >= VGA).<= target_sizeuntouched at their native resolution (no upsample, no crop).Module docstring, function docstrings, and the
--target-sizeCLI help are updated to match. (🗃️ Feature)How it was tested
tests/scripts/test_annotate_subtasks.py::TestResizeAndCenterCrop:test_smaller_than_target_is_upscaled→test_smaller_than_target_passes_throughand inverted its assertion (224×224 in → 224×224 out).test_non_square_smaller_than_target_passes_through(300×400 in → 300×400 out).test_short_side_at_target_passes_through_without_cropping(448×600 in → 448×600 out).pre-commit run --files src/opentau/scripts/annotate_subtasks.py tests/scripts/test_annotate_subtasks.py→ all hooks pass.pytest tests/scripts/test_annotate_subtasks.py -m "not gpu" -x→ 48 passed.How to checkout & try? (for the reviewer)
Checklist
🤖 Generated with Claude Code