Help us understand the problem. What is going on with this article?

Windows10でTensorFlow2.0,Keras,MNISTメモ

動作環境

Windows10 Home
RTX2080

Anacondaのインストール

https://www.anaconda.com/

CUDA

https://developer.nvidia.com/cuda-toolkit-archive

cuDNN

https://developer.nvidia.com/rdp/cudnn-download

Anacondapromptを起動

conda create -n [仮想環境名] python=3.7 jupyter
activate [仮想環境名]

tensorflowをインストール

pip install tensorflow-gpu

バージョン確認
import tensorflow as tf
tf.__version__
'2.0.0'

kerasをインストール

pip install keras

バージョン確認
import keras
Using TensorFlow backend.
keras.__version__
'2.3.1'

MNISTで動作確認

mnist.py
import tensorflow as tf

#MNIST データセットをロードして準備します。サンプルを整数から浮動小数点数に変換します。
mnist = tf.keras.datasets.mnist
(x_train, y_train), (x_test, y_test) = mnist.load_data()
x_train, x_test = x_train / 255.0, x_test / 255.0

#層を積み重ねてtf.keras.Sequentialモデルを構築します。訓練のためにオプティマイザと損失関数を選びます。
model = tf.keras.models.Sequential([
  tf.keras.layers.Flatten(input_shape=(28, 28)),
  tf.keras.layers.Dense(128, activation='relu'),
  tf.keras.layers.Dropout(0.2),
  tf.keras.layers.Dense(10, activation='softmax')
])
model.compile(optimizer='adam',
              loss='sparse_categorical_crossentropy',
              metrics=['accuracy'])

#モデルを訓練してから評価します。
model.fit(x_train, y_train, epochs=5)
model.evaluate(x_test,  y_test, verbose=2)

その他必要なものをインストール

pip install Protobuf Pillow lxml
pip install Jupyter
pip install Matplotlib

Why not register and get more from Qiita?
  1. We will deliver articles that match you
    By following users and tags, you can catch up information on technical fields that you are interested in as a whole
  2. you can read useful information later efficiently
    By "stocking" the articles you like, you can search right away
Comments
No comments
Sign up for free and join this conversation.
If you already have a Qiita account
Why do not you register as a user and use Qiita more conveniently?
You need to log in to use this function. Qiita can be used more conveniently after logging in.
You seem to be reading articles frequently this month. Qiita can be used more conveniently after logging in.
  1. We will deliver articles that match you
    By following users and tags, you can catch up information on technical fields that you are interested in as a whole
  2. you can read useful information later efficiently
    By "stocking" the articles you like, you can search right away
ユーザーは見つかりませんでした