当前位置:   article > 正文

CNN入门mnist数据集运行环境搭建(安装Python,Pycharm,Anaconda,Tensorflow,CNN代码)_dataset.mnist怎么安装

dataset.mnist怎么安装

安装环境运行大致步骤:

  1. Python安装:选择3.8,安装教程具体可查看:https://blog.csdn.net/liming89/article/details/109632064?ops_request_misc=&request_id=&biz_id=102&utm_term=pycharm%E5%AE%89%E8%A3%85%E6%95%99%E7%A8%8B&utm_medium=distribute.pc_search_result.none-task-blog-2allsobaiduweb~default-7-.pc_search_result_before_js&spm=1018.2226.3001.4187
    下载官网:https://www.python.org/downloads/

在这里插入图片描述

  1. Pycharm 编辑器下载安装:下载官网:
    https://www.jetbrains.com/pycharm/download/#section=windows
    安装教程与Python安装教程在一起

  2. 环境变量配置:配置教程:
    https://www.cnblogs.com/huangbiquan/p/7784533.html

  3. 安装Anaconda:选择Anaconda3,安装教程具体可查看:
    https://blog.csdn.net/u010210864/article/details/94580873
    下载官网:https://www.anaconda.com/products/individual
    在这里插入图片描述

  4. 按步骤4教程安装Tensorflow:

  5. 试运行CNN训练mnist数据集的代码

# -*- coding: utf-8 -*-
# 使用卷积神经网络训练mnist数据集
import gzip

from tensorflow.keras.datasets import mnist
from tensorflow.keras.utils import to_categorical
import tensorflow as tf
from tensorflow.keras.layers import Input, Dense, Conv2D, MaxPooling2D, Flatten, Reshape
import numpy as np
from sklearn.metrics import classification_report
import datetime

'''
# 装载数据集(从网上下载)
(train_images, train_labels), (test_images, test_labels) = mnist.load_data()
'''


# 装载数据集(本地导入)
def load_data():
    path = r"E:\PythonProject\CNN\MNIST_data\mnist.npz"
    f = np.load(path)
    train_images, train_labels = f['x_train'], f['y_train']
    test_images, test_labels = f['x_test'], f['y_test']
    f.close(
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • 11
  • 12
  • 13
  • 14
  • 15
  • 16
  • 17
  • 18
  • 19
  • 20
  • 21
  • 22
  • 23
  • 24
声明:本文内容由网友自发贡献,不代表【wpsshop博客】立场,版权归原作者所有,本站不承担相应法律责任。如您发现有侵权的内容,请联系我们。转载请注明出处:https://www.wpsshop.cn/w/小丑西瓜9/article/detail/691119
推荐阅读
相关标签
  

闽ICP备14008679号