• Stars
    star
    118
  • Rank 298,177 (Top 6 %)
  • Language
    Python
  • Created over 8 years ago
  • Updated over 5 years ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

Some samples of the MNIST classifier.

mnist

Some samples of the MNIST classifier which are corresponding to the tutorials of the jikexueyuan(https://wiki.jikexueyuan.com/project/tensorflow-zh/).

构建模块:

  • input_data.py: MNIST数据集下载与解压
  • mnist.py: Implements the inference/loss/training pattern for model building

代码测试:

  • mnist_softmax.py: MNIST机器学习入门
  • mnist_deep.py: 深入MNIST
  • fully_connected_feed.py: TensorFlow运作方式入门
  • mnist_with_summaries.py: Tensorboard训练过程可视化

将MNIST数据集,下载后拷贝到文件夹Mnist_data中,如果已经配置好tensorflow环境,主要的四个测试代码文件,都可以直接编译运行:

  • mnist_softmax.py: MNIST机器学习入门
  • mnist_deep.py: 深入MNIST
  • fully_connected_feed.py: TensorFlow运作方式入门
  • mnist_with_summaries.py: Tensorboard训练过程可视化

**mnist_softmax.py**运行结果比较简单,就不列举。

**mnist_deep.py**迭代运行较为耗时,结果已显示在博客: 深入MNIST code测试

**fully_connected_feed.py**的运行结果如下(本人电脑为2 CPU,没有使用GPU):

Extracting Mnist_data/train-images-idx3-ubyte.gz
Extracting Mnist_data/train-labels-idx1-ubyte.gz
Extracting Mnist_data/t10k-images-idx3-ubyte.gz
Extracting Mnist_data/t10k-labels-idx1-ubyte.gz
I tensorflow/core/common_runtime/local_device.cc:25] Local device intra op parallelism threads: 2
I tensorflow/core/common_runtime/local_session.cc:45] Local session inter op parallelism threads: 2
Step 0: loss = 2.33 (0.023 sec)
Step 100: loss = 2.09 (0.007 sec)
Step 200: loss = 1.76 (0.009 sec)
Step 300: loss = 1.36 (0.007 sec)
Step 400: loss = 1.12 (0.007 sec)
Step 500: loss = 0.74 (0.008 sec)
Step 600: loss = 0.78 (0.006 sec)
Step 700: loss = 0.69 (0.007 sec)
Step 800: loss = 0.67 (0.007 sec)
Step 900: loss = 0.52 (0.010 sec)
Training Data Eval:
  Num examples: 55000  Num correct: 47532  Precision @ 1: 0.8642
Validation Data Eval:
  Num examples: 5000  Num correct: 4360  Precision @ 1: 0.8720
Test Data Eval:
  Num examples: 10000  Num correct: 8705  Precision @ 1: 0.8705
Step 1000: loss = 0.56 (0.013 sec)
Step 1100: loss = 0.50 (0.145 sec)
Step 1200: loss = 0.33 (0.007 sec)
Step 1300: loss = 0.44 (0.006 sec)
Step 1400: loss = 0.39 (0.006 sec)
Step 1500: loss = 0.33 (0.009 sec)
Step 1600: loss = 0.56 (0.008 sec)
Step 1700: loss = 0.50 (0.007 sec)
Step 1800: loss = 0.42 (0.006 sec)
Step 1900: loss = 0.41 (0.006 sec)
Training Data Eval:
  Num examples: 55000  Num correct: 49220  Precision @ 1: 0.8949
Validation Data Eval:
  Num examples: 5000  Num correct: 4520  Precision @ 1: 0.9040
Test Data Eval:
  Num examples: 10000  Num correct: 9014  Precision @ 1: 0.9014
[Finished in 22.8s]

**mnist_with_summaries.py**主要提供了一种在Tensorboard可视化方法,首先,编译运行代码:

tensorboard

运行完毕后,打开终端Terminal,输入tensorboard --logdir=/tmp/mnist_logs,就会运行出:Starting TensorBoard on port 6006 (You can navigate to https://localhost:6006)

然后,打开浏览器,输入链接https://localhost:6006

tensorboard2

其中,有一些选项,例如菜单栏里包括EVENTS, IMAGES, GRAPH, HISTOGRAMS,都可以一一点开查看~

另外,此时如果不关闭该终端,是无法在其他终端中重新生成可视化结果的,会出现端口占用的错误,更多详细信息可以查看英文原文:TensorBoard: Visualizing Learning

源自博客: Tensorflow MNIST 数据集测试代码入门

如有纰漏,欢迎指正!

More Repositories

1

DeepSegmentor

A Pytorch implementation of DeepCrack and RoadNet projects.
Python
256
star
2

DeepCrack

DeepCrack: A Deep Hierarchical Feature Learning Architecture for Crack Segmentation, Neurocomputing.
211
star
3

VTs-Drloc

NeurIPS 2021, Official codes for "Efficient Training of Visual Transformers with Small Datasets".
Python
138
star
4

tensorflow.cifar10

The examples of image recognition with the dataset CIFAR10 via tensorflow.
Python
132
star
5

RoadNet

RoadNet: A Multi-task Benchmark Dataset for Road Detection, TGRS.
97
star
6

cifar10Dataset

Create your own dataset with the similar format with CIFAR10 in python version.
Python
87
star
7

GAN-Metrics

A collection of metrics for evaluating GAN models.
Python
54
star
8

imageBinaryDataset

C++
50
star
9

SmoothingLatentSpace

CVPR 2021, Smoothing the Disentangled Latent Style Space for Unsupervised I2I Translation
Python
41
star
10

MJP

An official Pytorch implementation of "Masked Jigsaw Puzzle: A Versatile Position Embedding for Vision Transformers", CVPR 2023.
Python
39
star
11

DWC-GAN

DWC-GAN, ACM MM 2020.
Python
32
star
12

uaggan

A Pytorch implementation of "Unsupervised Attention-Guided Image-to-Image Translation"
Python
29
star
13

TriangleGAN

TriangleGAN, ACM MM 2019.
Python
29
star
14

Domain-Translation-Papers

Collecting papers about domain translations.
21
star
15

frechet-bert-distance

Findings of ACL 2021
Python
21
star
16

stylegan-mmuit

ISF-GAN, TMM 2022.
Python
17
star
17

SuperpixelRegionFill

Superpixels-based region filling
C++
17
star
18

RG-UNIT

RG-UNIT, ACM MM 2020.
Python
11
star
19

ImageDataAugmentation

Image data augmentation via flipping and rotation.
C++
11
star
20

FindFilesWithinFolder

Find and generate a file list of the folder.
C++
7
star
21

Activations

A list of current activation functions in deep learning.
MATLAB
7
star
22

Reweighting

Reweighting Responses, EMNLP 2018 (short, oral)
Python
4
star
23

ImageFormatConversion

A Demo of converting the single channel 16-bit images to 8-bit images.
C
2
star
24

image2binarytest

C++
2
star
25

Create-Subfolder

Create a subfolder included in the input file path.
C++
1
star
26

QImage2Mat

The conversion between Qt QImage and OpenCV Mat.
C++
1
star