为什么此代码无法读取文件夹中的图像列表。我想读取测试文件夹中的.jpg图像。通过命令行
将测试文件夹路径作为参数传递时 # Dataset and Loader
dataset_test = TestDataset(
cfg.list_test,
cfg.DATASET)
loader_test = torch.utils.data.DataLoader(
dataset_test,
batch_size=cfg.TEST.batch_size,
shuffle=False,
collate_fn=user_scattered_collate,
num_workers=2,
drop_last=True)
# generate testing image list
if os.path.isdir(args.imgs[0]):
imgs = find_recursive(args.imgs[0])
else:
imgs = [args.imgs]
assert len(imgs), "imgs should be a path to image (.jpg) or directory."
cfg.list_test = [{'fpath_img': x} for x in imgs]
给出以下错误
IsADirectoryError: [Errno 21] Is a directory: