pycharm:
new Project
import torch
import numpy as np
arr=np.ones((3,3))
print("arr的数据类型为:"+str(arr.dtype))
t=torch.tensor(arr)
print(t)
terminal调出(pytorch)
1、file-settings-Tools-terminal-shell path改成cmd那个
2、或者:在local旁边的下箭头选择command prompt 但是这个我没试过
重启pycharm就好了
tensorboard
要在(pytorch)里面下载
pip install tensorboard -i https://pypi.douban.com/simple/
,然后pip list就能看到
opencv-python
pip install opencv-python -i https://pypi.douban.com/simple/
scipy
pip install scipy -i https://pypi.douban.com/simple/
matplotlib
pip install matplotlib -i https://pypi.douban.com/simple/
tqdm
pip install tqdm -i https://pypi.douban.com/simple/
WZ老师代码
1、num_workers
2、.next()
AttributeError:‘_SingleProcessDataLoaderIter’ object has no attribute ‘next’
# test_image, test_label = test_data_iter.next()
test_image, test_label = next(test_data_iter)
test_image, test_label = test_data_iter.__next__()
3、改matplotlib后端
紧接着出现新的错误
import matplotlib
print(matplotlib.get_backend())
matplotlib.use('TkAgg')
4、转RGB模式 predict
img = Image.open(img_path).convert('RGB')