人工智能学习07--pytorch08--小汇总(newProject、(pytorch)、tensorboard、opencv-python、scipy、matplotlib、tqdm)

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')

在这里插入图片描述

猜你喜欢

转载自blog.csdn.net/AMWICD/article/details/129219701