Skip to content

fix(client): clip float images before convert_to_uint8#994

Open
Bartok9 wants to merge 1 commit into
Physical-Intelligence:mainfrom
Bartok9:fix/convert-uint8-clip
Open

fix(client): clip float images before convert_to_uint8#994
Bartok9 wants to merge 1 commit into
Physical-Intelligence:mainfrom
Bartok9:fix/convert-uint8-clip

Conversation

@Bartok9

@Bartok9 Bartok9 commented Jul 10, 2026

Copy link
Copy Markdown

Summary

convert_to_uint8 scaled float images by 255 then cast to uint8 with no clipping. Values outside [0, 1] wrap (C-style cast), producing garbage pixels on the wire / for model input.

Changes

  • np.clip(img, 0.0, 1.0) before scale
  • Unit tests for clip + uint8 passthrough

Verification

New unit tests in image_tools_test.py.

Duplicate check

No open PR for this clip behavior.

Out-of-range float pixels previously wrapped when cast to uint8
(e.g. 1.5 → 127 after 255*x truncate). Clip to [0, 1] first.
@jimmyt857
jimmyt857 removed their request for review July 11, 2026 19:37
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