import tensorflow as tf

构建卷积神经网络

model = tf.keras.models.Sequential([ tf.keras.layers.Conv2D(64, (5, 5), activation='relu', input_shape=(28, 28, 1)), tf.keras.layers.MaxPooling2D((2, 2)), tf.keras.layers.Flatten(), tf.keras.layers.Dense(128, activation='relu'), tf.keras.layers.Dense(10, activation='softmax') ])

打印模型结构

model.summary()

Python 卷积神经网络构建:手写数字识别模型示例

原文地址: https://www.cveoy.top/t/topic/oe0M 著作权归作者所有。请勿转载和采集!

免费AI点我,无需注册和登录