修改下面代码使其忽略标签并依次选择索引,读取对应的图像序列路径(imgs_path),函数通过调用 self.loader() 函数来加载图像并一起返回 def getitem(self, index): current_index = np.random.choice(range(0, self.num_samples)) imgs_path = self.imgseqs[current_index].split() current_imgs = [] current_imgs_path = imgs_path[:len(imgs_path) - 1] current_label_path = imgs_path[len(imgs_path) - 1] current_label = self.loader(current_label_path)
时间: 2023-06-08 22:07:21 浏览: 92
imgs.zip_imgs.com_imgs图片_web 图片展示_展示_左右滑动模
def getitem(self, index):
current_index = index % self.num_samples
imgs_path = self.imgseqs[current_index].split()
current_imgs = []
current_imgs_path = [path for path in imgs_path[:-1] if not path.startswith("<")]
for img_path in current_imgs_path:
current_img = self.loader(img_path)
current_imgs.append(current_img)
current_label_path = [path for path in imgs_path if path.startswith("<")][0][1:-1]
current_label = self.loader(current_label_path)
return current_imgs, current_label
阅读全文