All Projects → GeoLibra → mnist_test

GeoLibra / mnist_test

Licence: MIT License
mnist with Tensorflow

Programming Languages

python
139335 projects - #7 most used programming language
javascript
184084 projects - #8 most used programming language
HTML
75241 projects

Projects that are alternatives of or similar to mnist test

SimpNet-Tensorflow
A Tensorflow Implementation of the SimpNet Convolutional Neural Network Architecture
Stars: ✭ 16 (-46.67%)
Mutual labels:  mnist
Open-Set-Recognition
Open Set Recognition
Stars: ✭ 49 (+63.33%)
Mutual labels:  mnist
VAE-Gumbel-Softmax
An implementation of a Variational-Autoencoder using the Gumbel-Softmax reparametrization trick in TensorFlow (tested on r1.5 CPU and GPU) in ICLR 2017.
Stars: ✭ 66 (+120%)
Mutual labels:  mnist
keras gpyopt
Using Bayesian Optimization to optimize hyper parameter in Keras-made neural network model.
Stars: ✭ 56 (+86.67%)
Mutual labels:  mnist
tensorflow-mnist-convnets
Neural nets for MNIST classification, simple single layer NN, 5 layer FC NN and convolutional neural networks with different architectures
Stars: ✭ 22 (-26.67%)
Mutual labels:  mnist
wechat digit recognition
微信公众号数字识别
Stars: ✭ 84 (+180%)
Mutual labels:  mnist
cuda-neural-network
Convolutional Neural Network with CUDA (MNIST 99.23%)
Stars: ✭ 118 (+293.33%)
Mutual labels:  mnist
CNN Own Dataset
CNN example for training your own datasets.
Stars: ✭ 25 (-16.67%)
Mutual labels:  mnist
AdaBound-tensorflow
An optimizer that trains as fast as Adam and as good as SGD in Tensorflow
Stars: ✭ 44 (+46.67%)
Mutual labels:  mnist
MNIST-multitask
6️⃣6️⃣6️⃣ Reproduce ICLR '18 under-reviewed paper "MULTI-TASK LEARNING ON MNIST IMAGE DATASETS"
Stars: ✭ 34 (+13.33%)
Mutual labels:  mnist
deeplearning-mpo
Replace FC2, LeNet-5, VGG, Resnet, Densenet's full-connected layers with MPO
Stars: ✭ 26 (-13.33%)
Mutual labels:  mnist
VNet
Prostate MR Image Segmentation 2012
Stars: ✭ 54 (+80%)
Mutual labels:  tensroflow
rust-simple-nn
Simple neural network implementation in Rust
Stars: ✭ 24 (-20%)
Mutual labels:  mnist
digitrecognition ios
Deep Learning with Tensorflow/Keras: Digit recognition based on mnist-dataset and convolutional neural-network on iOS with CoreML
Stars: ✭ 23 (-23.33%)
Mutual labels:  mnist
Python-TensorFlow-WebApp
Emerging Technologies Project - 4th Year 2017
Stars: ✭ 16 (-46.67%)
Mutual labels:  mnist
crohme-data-extractor
A modified extractor for the CROHME handwritten math symbols dataset.
Stars: ✭ 18 (-40%)
Mutual labels:  mnist
chainer-ADDA
Adversarial Discriminative Domain Adaptation in Chainer
Stars: ✭ 24 (-20%)
Mutual labels:  mnist
ELM-pytorch
Extreme Learning Machine implemented in Pytorch
Stars: ✭ 68 (+126.67%)
Mutual labels:  mnist
haskell-vae
Learning about Haskell with Variational Autoencoders
Stars: ✭ 18 (-40%)
Mutual labels:  mnist
mnist-challenge
My solution to TUM's Machine Learning MNIST challenge 2016-2017 [winner]
Stars: ✭ 68 (+126.67%)
Mutual labels:  mnist

mnist_test

mnist数据集的使用

one_hot

data = input_data.read_data_sets('MNIST_data', one_hot=True)

one_hot=True表示将样本标签转化为one_hot编码。
举例:假如一共10类。
0-->1000000000
1-->0100000000
2-->0010000000 3-->0001000000
以此类推。只有一位为1,1所在的位置就代表着第几类。

保存模型

saver=tf.train.Save() # 实例化saver对象
with tf.Session() as sess: # 在with结构for循环中一定轮数时 保存模型到当前回话
    for i in range(STEPS):
        if i % 轮数 ==0: 
            saver.save(sess,os.path.join(MODEL_SAVE_PATH,MODEL_NAME),global_step=global_step)

加载模型

with tf.Session() as sess:
    ckpt=tf.train.get_checkpoint_state(存储路径)
    if ckpt and ckpt.model_checkpoint_path:
        saver.restore(sess,ckpt.model_checkpoint_path)

实例化可还原滑动平均值的saver

ema=tf.train.ExponentialMovineAverage(滑动平均基数)
ema_restore=ema.variables_to_restore()
saver=tf.train.Saver(ema_restore)

准确率计算方法

correct_prediction=tf.equal(tf.argmax(y,1),tf.argmax(y_,1))
accuracy=tf.reduce_mean(tf.cast(correct_prediction,tf.float32))

遇到的问题

  1. CUDA_ERROE_OUT_OF_MEMORY
    服务器的GPU大小为M,tensorflow只能申请N(N<M),也就是tensorflow告诉你 不能申请到GPU的全部资源,然后就不干了
    解决方案:
config = tf.ConfigProto(allow_soft_placement=True)
# 最多占gpu资源的70%
gpu_options = tf.GPUOptions(per_process_gpu_memory_fraction=0.7)
# 开始不会给tensorflow全部gpu资源 而是按需增加
config.gpu_options.allow_growth = True
sess = tf.Session(config=config)
  1. Attempting to use uninitialized value
    解决方法:变量初始化
sess.run(tf.global_variables_initializer())
  1. Attempting to use uninitialized value Variable Caused by op u'Variable/read'
    解决方法: 将 sess.run(tf.global_variables_initializer()) 放到后面
Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].