code_2.py 531 字节
Newer Older
ToTensor's avatar
ToTensor 已提交
1 2 3 4 5 6 7 8 9
model.add(Max Pooling2D(pool_size=(2, 2))) # 添加Max Pooling2D层
model.add(Conv2D(64, (3, 3), activation='relu')) # 添加Conv2D层
model.add(Max Pooling2D(pool_size=(2, 2))) # 添加Max Pooling2D层
model.add(Dropout(0.25)) # 添加Dropout层
model.add(Flatten()) # 添加展平层
model.add(Dense(128, activation='relu')) # 添加全连接层
model.add(Dropout(0.5)) # 添加Dropout层
model.add(Dense(10, activation='softmax')) # Softmax分类激活, 输出10维分类码
model.compile(optimizer='rmsprop', # 指定优化器