BasicSR icon indicating copy to clipboard operation
BasicSR copied to clipboard

<BUG>关于数据集加载

Open CuddleSabe opened this issue 2 years ago • 0 comments

retry = 3 while retry > 0: try: img_bytes = self.file_client.get(gt_path, 'gt') except (IOError, OSError) as e: logger = get_root_logger() logger.warn(f'File client error: {e}, remaining retry times: {retry - 1}') # change another file to read index = random.randint(0, self.__len__()) gt_path = self.paths[index] time.sleep(1) # sleep 1s for occasional server congestion else: break finally: retry -= 1 img_gt = imfrombytes(img_bytes, float32=True)

其中random.randint(0, self.len())生成的随机数右侧是闭合的,因此会超出索引范围,修改为random.randint(0, self.len()-1)即可。numpy的randint右侧是不包的

CuddleSabe avatar Oct 26 '23 02:10 CuddleSabe