Fix PYRE_MISSING_ANNOTATIONS issues in fbcode/deeplearning/projects/sam3_release/sam3/model/io_utils.py

Differential Revision: D103516284

fbshipit-source-id: 8fd9ffd8abd1dd59a4ccad9c1be39f8d7e1d01cd
This commit is contained in:
generatedunixname1401739305002972
2026-05-06 02:08:24 -07:00
committed by meta-codesync[bot]
parent cb1ff794d3
commit ea46ebca5e
+12 -10
View File
@@ -361,7 +361,9 @@ def load_dummy_video(image_size, offload_video_to_cpu, num_frames=60, do_zeros=F
return images, video_height, video_width return images, video_height, video_width
def _load_img_as_tensor(img_path, image_size): def _load_img_as_tensor(
img_path: str, image_size: int
) -> tuple[torch.Tensor, int, int]:
"""Load and resize an image and convert it into a PyTorch tensor.""" """Load and resize an image and convert it into a PyTorch tensor."""
img = Image.open(img_path).convert("RGB") img = Image.open(img_path).convert("RGB")
orig_width, orig_height = img.width, img.height orig_width, orig_height = img.width, img.height
@@ -532,15 +534,15 @@ class AsyncVideoFileLoaderWithTorchCodec:
def __init__( def __init__(
self, self,
video_path, video_path: str,
image_size, image_size: int,
offload_video_to_cpu, offload_video_to_cpu: bool,
img_mean, img_mean: Union[tuple[float, float, float], torch.Tensor],
img_std, img_std: Union[tuple[float, float, float], torch.Tensor],
gpu_acceleration=True, gpu_acceleration: bool = True,
gpu_device=None, gpu_device: Optional[torch.device] = None,
use_rand_seek_in_loading=False, use_rand_seek_in_loading: bool = False,
): ) -> None:
# Check and possibly infer the output device (and also get its GPU id when applicable) # Check and possibly infer the output device (and also get its GPU id when applicable)
assert gpu_device is None or gpu_device.type == "cuda" assert gpu_device is None or gpu_device.type == "cuda"
gpu_id = ( gpu_id = (