MCPcopy Create free account
hub / github.com/OpenDriveLab/ReSim / load_image_to_tensor

Function load_image_to_tensor

sat/data_utils.py:99–107  ·  view source on GitHub ↗
(image_path)

Source from the content-addressed store, hash-verified

97 return tensor[:num_frames]
98
99def load_image_to_tensor(image_path):
100 if not os.path.exists(image_path):
101 print("Image not found: {}".format(image_path))
102 image = Image.open(image_path)
103 if not image.mode == "RGB":
104 image = image.convert("RGB")
105 image = np.array(image) # H, W, C
106 image = torch.from_numpy(image)
107 return image
108
109def load_image_list_to_tensors(img_path_list):
110 images = [load_image_to_tensor(img_path) for img_path in img_path_list]

Callers 1

Calls 2

existsMethod · 0.80
printFunction · 0.50

Tested by

no test coverage detected