小编Zhu*_*huo的帖子

“ IsADirectoryError:[Errno 21]是目录:”它是一个文件

我已经将数据分为测试和培训集,并放入了不同的文件夹。现在,我需要加载患者数据。每个病人有8张图像。

def load_dataset(root_dir, split):
"""
load the data set numpy arrays saved by the preprocessing script
:param root_dir: path to input data
:param split: defines whether to load the training or test set
:return: data: dictionary containing one dictionary ({'data', 'seg', 'pid'}) per patient
"""
in_dir = os.path.join(root_dir, split)
data_paths = [os.path.join(in_dir, f) for f in os.listdir(in_dir)]
data_and_seg_arr = [np.load(ii, mmap_mode='r') for ii in data_paths]
pids = [ii.split('/')[-1].split('.')[0] for ii in data_paths]
data = OrderedDict()
for ix, pid in enumerate(pids): …
Run Code Online (Sandbox Code Playgroud)

python load numpy

5
推荐指数
2
解决办法
3万
查看次数

标签 统计

load ×1

numpy ×1

python ×1