TensorFlow/MNIST: Difference between revisions
From charlesreid1
No edit summary |
|||
| Line 44: | Line 44: | ||
import tensorflow as tf | import tensorflow as tf | ||
</pre> | </pre> | ||
Variable definitions for use in the rest of the model: | |||
<pre> | <pre> | ||
| Line 60: | Line 62: | ||
FLAGS = None | FLAGS = None | ||
</pre> | </pre> | ||
=Flags= | =Flags= | ||
Revision as of 10:13, 27 October 2017
MNIST Convolutional Neural Network
Concept: Simple, end-to-end, LeNet-5-like convolutional MNIST model example. Meant as a tutorial for simple convolutional models.
Link to original data set: http://yann.lecun.com/exdb/mnist/
License
# Copyright 2015 The TensorFlow Authors. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. # ==============================================================================
Import Statements and Variables
Import statements:
from __future__ import absolute_import from __future__ import division from __future__ import print_function import argparse import gzip import os import sys import time import numpy from six.moves import urllib from six.moves import xrange # pylint: disable=redefined-builtin import tensorflow as tf
Variable definitions for use in the rest of the model:
SOURCE_URL = 'http://yann.lecun.com/exdb/mnist/' WORK_DIRECTORY = 'data' IMAGE_SIZE = 28 NUM_CHANNELS = 1 PIXEL_DEPTH = 255 NUM_LABELS = 10 VALIDATION_SIZE = 5000 # Size of the validation set. SEED = 66478 # Set to None for random seed. BATCH_SIZE = 64 NUM_EPOCHS = 10 EVAL_BATCH_SIZE = 64 EVAL_FREQUENCY = 100 # Number of steps between evaluations. FLAGS = None