sam3 icon indicating copy to clipboard operation
sam3 copied to clipboard

bug in load_video_frames_from_video_file_using_cv2()?

Open yin-zhang opened this issue 8 months ago • 2 comments

In function load_video_frames_from_video_file_using_cv2, video_tensor has range [0, 255]. But the normalization is done using img_mean = 0.5, img_std = 0.5. Shouldn't we divide video_tensor by 255 first to make its range [0, 1]?

The weird thing is that we I "fix" the bug, the performance seems to become a lot worse. So perhaps the model is trained with this bug throughout and we should keep it a "feature"?

yin-zhang avatar Mar 17 '26 07:03 yin-zhang

Hey! I may be able to help with this bug.

I build custom fixes for Python projects and automation systems.

If you'd like help resolving this issue quickly feel free to reach out.

Happy to take a look 👍

FocusMode-coder avatar Mar 17 '26 07:03 FocusMode-coder

I suspect the bug might be difficult to fix. Perhaps all the data processing during training has this bug in there. As a result, the model essentially works with input image in range [0, 511]. To fix it, the whole model needs to be retrained ...

Alternatively we will have to live with it, and get rid of any image /= 255.0 code elsewhere.

yin-zhang avatar Mar 17 '26 14:03 yin-zhang

I suspect the bug might be difficult to fix. Perhaps all the data processing during training has this bug in there. As a result, the model essentially works with input image in range [0, 511]. To fix it, the whole model needs to be retrained ...

Alternatively we will have to live with it, and get rid of any image /= 255.0 code elsewhere.

Hi, yin-zhang. Could you solve the issue? https://github.com/facebookresearch/sam3/issues/501

olegkolesnik911 avatar Mar 26 '26 12:03 olegkolesnik911