资源简介
模仿VGGnet基于keras的cifar-10图像识别模型,epoch可以稍微小一点
代码片段和文件信息
# -*- coding: utf-8 -*-
import os
os.environ[‘KERAS_BACKEND‘]=‘tensorflow‘
import numpy as np
from keras import layers regularizers
from keras.layers import Input Dense Activation ZeroPadding2D BatchNormalization Flatten Conv2D
from keras.layers import AveragePooling2D MaxPooling2D Dropout GlobalMaxPooling2D GlobalAveragePooling2D
from keras.models import Model
from keras.preprocessing import image
from keras.utils import layer_utils
from keras.utils.data_utils import get_file
from keras.applications.imagenet_utils import preprocess_input
import pydot
import graphviz
from IPython.display import SVG
from keras.utils.vis_utils import model_to_dot
from keras.utils import plot_model
import pickle
def HappyModel(input_shape):
“““
Implementation of the HappyModel.
Arguments:
input_shape -- shape of the images of the dataset
Returns:
model -- a Model() instance in Keras
“““
### START CODE HERE ###
# Feel free to use the suggested outline in the text above to get started and run through the whole
# exercise (including the later portions of this notebook) once. The come back also try out other
# network architectures as well.
# Define the input placeholder as a tensor with shape input_shape. Think of this as your input image!
X_input = Input(input_shape)
# layer1 group 16*16*8
X = ZeroPadding2D((3 3))(X_input)
X = Conv2D(8 (7 7) strides=(1 1) name=‘conv1‘)(X)
X = BatchNormalization(axis = 3 name = ‘bn1‘)(X)
X = Activation(‘relu‘)(X)
X = MaxPooling2D((2 2) name=‘max_pool1‘)(X)
# layer2 group 8*8*16
X = ZeroPadding2D((2 2))(X)
X = Conv2D(16 (5 5) strides=(1 1) name=‘conv2‘)(X)
X = BatchNormalization(axis = 3 name = ‘bn2‘) (X)
X = Activation(‘relu‘)(X)
X = MaxPooling2D((2 2) name=‘max_pool2‘)(X)
# layer3 group 4*4*32
X = ZeroPadding2D((1 1))(X)
X = Conv2D(32 (3 3) strides=(1 1) name=‘conv3‘)(X)
X = BatchNormalization(axis = 3 name = ‘bn3‘) (X)
X = Activation(‘relu‘)(X)
X = MaxPooling2D((2 2) name=‘max_pool3‘)(X)
#layer4 group 2*2*64
X = Conv2D(64 (1 1) strides=(1 1) name=‘conv4‘)(X)
X = BatchNormalization(axis = 3 name = ‘bn4‘)(X)
X = Activation(‘relu‘)(X)
X = MaxPooling2D((2 2) name=‘max_pool4‘)(X)
#layer5 group 2*2*32
X = ZeroPadding2D((1 1))(X)
X = Conv2D(32 (3 3) strides=(1 1) name=‘conv5‘)(X)
X = BatchNormalization(axis = 3 name = ‘bn5‘)(X)
X = Activation(‘relu‘)(X)
X = MaxPooling2D((2 2) name=‘max_pool5‘)(X)
# FLATTEN X (means convert it to a vector) + FULLYCONNECTED
X = Flatten()(X)
X = Dense(128 activation=‘sigmoid‘ name=‘fc1‘)(X)
X = Dense(32 activation=‘sigmoid‘ name=‘fc2‘)(X)
X = Dense(10 activation=‘sigmoid‘ name=‘fc3‘)(X)
# Create mod
相关资源
- Python-用PyTorch10实现FasterRCNN和MaskRCNN比
- Python-基于tensorflow实现的用textcnn方法
- Python-FastSCNN的PyTorch实现快速语义分割
- 基于深度学习堆栈自动编码器模型的
- 性别模型库 simple_CNN.81-0.96.hdf5
- lightened_cnn_S 5M模型
- TBCNN 源码
- faster rcnn(python+caffe)源代码
- CNN卷积神经网络PYTHON
- 基于CNN的图像搜索demo
- python实现的卷积神经网络CNN无框架
- 机器学习对应的相关python代码SVM、C
- 基于 CNN 的疲劳检测源码-Python
- CNN网络代码,数据集,及对应论文和
- Faster-RCNN-TensorFlow-Python3.5-master
- MTCNN源码python版
- keras实现中文文本分类
- pytorch版本手写体识别MNIST.zip
- Mask R-CNN源码(TensorFlow版本)
- TensorflowOpenCV实现的CNN车牌识别代码
- 文本分类代码集合含数据_TextCNN_Text
- python实现CNN中文文本分类
- Deep learning with Python Francois Chollet
- 基于卷积神经网络的手势识别
- CNN用于图像分类以外的数字序列.rar
- DnCNN tensorflow实现
- Python-Tensorflow实现SpatialAsDeepSpatialCNN
- CNN+pythoncode8.18.zip
- 肺结节识别采用CNN
- RNN python
评论
共有 条评论