On tensorflow2 MNIST GitHub


Paste my environment first. Environment is very important

1 enter the newly created computing environment: openAnaconda Prompt
2 view all computing environments

cona env list

On tensorflow2 MNIST GitHub

3 enter the new tensorflow2 environment

conda activate tensorflow2

4 view version numbers of all packages

pip list

On tensorflow2 MNIST GitHub

Download MNIST code

mnnistThe relevant code is inmodels-master\official\vision\image_classificationFile, enter the path of the code

On tensorflow2 MNIST GitHub

First run code, add--downloadParameters, downloading datasets

python mnist_main.py --model_dir=E:\AI\mnist\models --data_dir=E:\AI\mnist\data --download --train_epochs=10

parameter--model_dirBe sure to set it up, or you won’t be able to run.--data_dirIf the parameter is not set, the data will be saved in the root directorytmpFolder

On tensorflow2 MNIST GitHub

You can see in training.

Be aware thatmnist_main.pyAdd to code

import sys

Otherwise, it will not be foundofficialmodular

staytensorboardView visualization in

tensorboard --logdir E:\AI\mnist\models

On tensorflow2 MNIST GitHub

--logdirThe value of is filled in the directory where the above model is stored, which can be seen in the code

  callbacks = [
          ckpt_full_path, save_weights_only=True),

Enter in browserhttp://localhost:6006/, view interface

On tensorflow2 MNIST GitHub