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

Method read_img_list

sat/data_share.py:180–195  ·  view source on GitHub ↗
(self, img_path_list)

Source from the content-addressed store, hash-verified

178 random.shuffle(self.fut_traj_list)
179
180 def read_img_list(self, img_path_list):
181 video_size, fps, max_num_frames, skip_frms_num = \
182 self.video_size, self.fps, self.max_num_frames, self.skip_frms_num
183
184 img_path_list = img_path_list[skip_frms_num:] # skip some frames
185
186 tensor_frms = load_image_list_to_tensors(img_path_list)
187 tensor_frms = torch.stack(tensor_frms, dim=0) # T, H, W, C
188
189 tensor_frms = pad_last_frame(
190 tensor_frms, max_num_frames
191 ) # the len of indices may be less than num_frames, due to round error\
192 tensor_frms = tensor_frms.permute(0, 3, 1, 2) # [T, H, W, C] -> [T, C, H, W]
193 tensor_frms = resize_for_rectangle_crop(tensor_frms, video_size, reshape_mode=self.reshape_mode)
194 tensor_frms = (tensor_frms - 127.5) / 127.5
195 return max_num_frames, tensor_frms
196
197 def __getitem__(self, index):
198 while True:

Callers 2

__getitem__Method · 0.95
__getitem__Method · 0.80

Calls 3

pad_last_frameFunction · 0.85

Tested by

no test coverage detected