官术网_书友最值得收藏!

Handwritten number recognition with Keras and MNIST

A typical neural network for a digit recognizer may have 784 input pixels connected to 1,000 neurons in the hidden layer, which in turn connects to 10 output targets — one for each digit. Each layer is fully connected to the layer above. A graphical representation of this network is shown as follows, where x are the inputs, h are the hidden neurons, and y are the output class variables:

In this notebook, we will build a neural network that will recognize handwritten numbers from 0-9.

The type of neural network that we are building is used in a number of real-world applications, such as recognizing phone numbers and sorting postal mail by address. To build this network, we will use the MNIST dataset.

We will begin as shown in the following code by importing all the required modules, after which the data will be loaded, and then finally building the network:

# Import Numpy, keras and MNIST data
import numpy as np
import matplotlib.pyplot as plt

from keras.datasets import mnist
from keras.models import Sequential
from keras.layers.core import Dense, Dropout, Activation
from keras.utils import np_utils
主站蜘蛛池模板: 九寨沟县| 承德县| 萍乡市| 龙江县| 马公市| 乐清市| 新宁县| 且末县| 浦江县| 东明县| 宁南县| 额敏县| 中超| 鹤岗市| 尤溪县| 宜城市| 武隆县| 赣榆县| 青浦区| 游戏| 临西县| 安塞县| 大渡口区| 弥勒县| 平罗县| 神木县| 临城县| 长海县| 黔东| 类乌齐县| 福泉市| 都江堰市| 林口县| 横山县| 铜鼓县| 安庆市| 马关县| 汤阴县| 久治县| 原平市| 嵊泗县|