前言
首先,我失败了,我并没有跑通这个代码。一下是一些过程以及猜想。有那位大佬成功了,希望能教教我😂
下面是我自己整理的requirement.txt
numpy
pillow
tensorboardX
torchvision
h5py
pytorch-metric-learning
medpy
一. python freq_space_interpolation_demo.py
会用demo_samples的第四张图像为基准,和前三张图像重构(辅以不同值的$\lambda$),形成新样本。
二. 下载该文章的数据集
Baidu Research Open-Access Dataset - Download
图象是jpg的,label是bmp的,需要做转换,具体的看我的另一篇:(这里的转换是不是
prepare_dataset.py,我也不确定,因为这个代码有问题,参数对不上。)
bmp图像,jpg图像转npy_博弈望天的博客-CSDN博客
三.修改代码:train
3.1直接运行的话,如果报了这个错
ValueError: num_samples should be a positive integer value, but got num_samples=0
可以在第173行(也就是对应的位置),把shuffle的值由true改为false
解释:因为已经有batch_size了,就不需要shuffle来进行随机了,将shuffle设置为FALSE即可
3.2RuntimeError: CUDA error: no kernel image is available for execution on the device CUDA kernel errors might be asynchronously reported at some other API call,so the stacktrace below might be incorrect.
我的问题是torch没下载全,一些依赖包没有,可以重新下