mirror of
https://github.com/luzhisheng/js_reverse.git
synced 2025-04-20 01:34:55 +08:00
03数据加载-模型等API介绍
This commit is contained in:
parent
0125cbfef9
commit
7b182e6f04
21
机器学习/03数据加载-模型等API介绍/MNIST模型初体验.py
Normal file
21
机器学习/03数据加载-模型等API介绍/MNIST模型初体验.py
Normal file
@ -0,0 +1,21 @@
|
||||
from torchvision.datasets import MNIST
|
||||
import matplotlib.pyplot as plt
|
||||
|
||||
mnist_train = MNIST(root="./MNIST_data", train=True, download=True, transform=None)
|
||||
|
||||
# 第一次运行会下载数据集
|
||||
print(mnist_train)
|
||||
|
||||
# 数据集总量
|
||||
print(len(mnist_train))
|
||||
|
||||
# 数据集元祖,(图片,标注)
|
||||
print(mnist_train[5000])
|
||||
image = mnist_train[5000][0]
|
||||
|
||||
# 打印图片
|
||||
plt.imshow(image)
|
||||
plt.show()
|
||||
|
||||
# 获取标注值
|
||||
print(mnist_train[5000][1])
|
0
机器学习/03数据加载-模型等API介绍/__init__.py
Normal file
0
机器学习/03数据加载-模型等API介绍/__init__.py
Normal file
Loading…
x
Reference in New Issue
Block a user