我正在尝试复制一个我能够遵循并运行教程的模型,但这次使用的是我自己的数据。
我能够将自己的 MRI 图像转换为 numpy 数组,其维度与教程数据的数组相同。
我尝试用我自己的数组替换教程中的 numpy 数组,并为正常或异常(大小写,不是大小写)编写我自己的虚构 csv 文件。
但是,当我运行它时,我得到:
(Pytorch) C:\Users\GlaDOS\PythonProjects\dicomnpy>python train.py -t acl -p sagittal --epochs=10 --prefix_name hue
Traceback (most recent call last):
File "train.py", line 277, in <module>
run(args)
File "train.py", line 214, in run
mrnet, train_loader, epoch, num_epochs, optimizer, writer, current_lr, log_every)
File "train.py", line 34, in train_model
for i, (image, label, weight) in enumerate(train_loader):
File "C:\Users\GlaDOS\anaconda3\envs\Pytorch\lib\site-packages\torch\utils\data\dataloader.py", line 345, in __next__
data = self._next_data()
File "C:\Users\GlaDOS\anaconda3\envs\Pytorch\lib\site-packages\torch\utils\data\dataloader.py", line 385, in _next_data
data = self._dataset_fetcher.fetch(index) # may raise StopIteration
File "C:\Users\GlaDOS\anaconda3\envs\Pytorch\lib\site-packages\torch\utils\data\_utils\fetch.py", line 44, in fetch
data = [self.dataset[idx] for idx in possibly_batched_index]
File "C:\Users\GlaDOS\anaconda3\envs\Pytorch\lib\site-packages\torch\utils\data\_utils\fetch.py", line 44, in <listcomp>
data = [self.dataset[idx] for idx in possibly_batched_index]
File "C:\Users\GlaDOS\PythonProjects\dicomnpy\dataloader.py", line 56, in __getitem__
array = self.transform(array)
File "c:\users\glados\src\torchsample\torchsample\transforms\tensor_transforms.py", line 32, in __call__
inputs = transform(*inputs)
File "C:\Users\GlaDOS\anaconda3\envs\Pytorch\lib\site-packages\torchvision\transforms\transforms.py", line 313, in __call__
return self.lambd(img)
File "train.py", line 167, in <lambda>
transforms.Lambda(lambda x: torch.Tensor(x)),
现在我想知道这个错误是否意味着我没有以某种方式将我的 MRI 转换为“正确的”numpy 数组类型?如果是这样,我该如何将它们更改为正确的类型?
红颜莎娜
相关分类