Convert list of HxWx3 uint8 numpy arrays to [S, 3, H, W] tensor in [0, 1].
(self, rgb_list)
| 139 | self.model = self.model.to(self.device).eval() |
| 140 | |
| 141 | def _prepare_images(self, rgb_list): |
| 142 | """Convert list of HxWx3 uint8 numpy arrays to [S, 3, H, W] tensor in [0, 1].""" |
| 143 | from torchvision import transforms as TF |
| 144 | |
| 145 | to_tensor = TF.ToTensor() |
| 146 | images = torch.stack([to_tensor(rgb) for rgb in rgb_list]) |
| 147 | return images.to(self.device) |
| 148 | |
| 149 | def _run_inference(self, images): |
| 150 | """Run LingbotMap inference and return raw predictions dict.""" |