(image_path)
| 97 | return tensor[:num_frames] |
| 98 | |
| 99 | def 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 | |
| 109 | def load_image_list_to_tensors(img_path_list): |
| 110 | images = [load_image_to_tensor(img_path) for img_path in img_path_list] |
no test coverage detected