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

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
主站蜘蛛池模板: 九龙坡区| 永福县| 临猗县| 黄陵县| 买车| 湟源县| 威远县| 双桥区| 荣成市| 彭泽县| 阜南县| 平邑县| 安新县| 新民市| 玉田县| 岳普湖县| 安塞县| 阜宁县| 吴忠市| 东辽县| 哈巴河县| 海兴县| 封丘县| 莱西市| 山阴县| 武鸣县| 乌恰县| 法库县| 堆龙德庆县| 青神县| 华亭县| 石泉县| 富裕县| 石狮市| 霞浦县| 包头市| 岱山县| 长兴县| 开化县| 怀柔区| 新营市|