卷积神经网络VGG16
发布日期:2021-05-14 10:21:08 浏览次数:21 分类:精选文章

本文共 4699 字,大约阅读时间需要 15 分钟。

VGG16���������������������������������������������������

������������

VGG16���������������������������������������CNN���������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������VGG16���������������������������������������������������������������������������������

������������������format

  • ���������������VGG16������������������RGB������������������������ 224��224���������
  • ���������������������3������������������������������������������������������������ (224, 224, 3)���
  • ���������������ZeroPadding������������������������������������VGG16������������������������������������������������������������������0��������������������������������������� (224+2, 224+2, 3)���

������������������Convolutional Layer���

1. ���������������

  • ������������������3��3���
  • ������������������64������
  • ���������������64��3��3=576������������
  • ���������������ReLU���
  • ���������������(224+2-3+1, 224+2-3+1, 64) ��� (224, 224, 64)���

2. ���������������

  • ���������������������������������������64������������������������������������
  • ���������������(224, 224, 64)���

3. ���������������

  • ������������������3��3���
  • ������������������64������
  • ���������������ReLU���
  • ������������������������������������������������������ (224+2, 224+2, 64)���
  • ���������������(224, 224, 128)���

4. ������������������MaxPooling���

  • ������������������2��2���
  • ������������������Same���2��2���
  • ���������������������������������MaxPooling������
  • ���������������(112, 112, 128)���

������������������

A. ���������������

  • ������������������3��3���
  • ������������������128������
  • ���������������ReLU���
  • ��������������������������� (112+2,112+2,128)���
  • ���������������(112,112,256)���

B. ���������������

  • ������������������2��2���
  • ������������������Same���2��2���
  • ���������������������������������
  • ���������������(56, 56, 256)���

������������������������

  • ������������������3��3���
  • ������������������256������
  • ���������������ReLU���
  • ��������������������������� (56+2,56+2,256)���
  • ���������������(56,56,512)���

������������������������

  • ������������������2��2���
  • ������������������Same���2��2���
  • ���������������������������������
  • ���������������(28,28,512)���

������������������������

  • ������������������3��3���
  • ������������������512������
  • ���������������ReLU���
  • ��������������������������� (28+2,28+2,512)���
  • ���������������(28,28,1024)���

������������������������

  • ������������������2��2���
  • ������������������Same���2��2���
  • ���������������������������������
  • ���������������(14,14,1024)���

������������������

1. ������Flatten Layer

������������������������������������14��14��1024=25088���

2. ������������1���Dense Layer 1���

  • ���������������1024������
  • ���������������ReLU���
  • ���������������1024���������������

3. ������������2���Dense Layer 2���

  • ���������������4096���������������������������������������������������
  • ���������������ReLU���
  • ���������������4096���������������

������������������Classification Layer���

  • ���������������1000������������������������������������������������
  • ���������������Softmax������������������������
  • ���������������������������������������������������

���������������������

  • ���������������������Xavier initialization���������������������������������������
  • ���������������������������������������������������������������������������������������������

���������������������

from keras import layers
from tensorflow.keras import Model
import tensorflow as tf
# model definition
model = Model(
input_tensor=tf.keras.Input(shape=(224, 224, 3)),
layers=[
layers.Conv2D(64, (3,3), activation='relu'),
layers.Padding2D((1,1)),
layers.Conv2D(64, (3,3), activation='relu'),
layers.MaxPooling2D((2,2), strides=(2,2)),
layers.Conv2D(128, (3,3), activation='relu'),
layers.Padding2D((1,1)),
layers.Conv2D(128, (3,3), activation='relu'),
layers.MaxPooling2D((2,2), strides=(2,2)),
layers.Conv2D(256, (3,3), activation='relu'),
layers.Padding2D((1,1)),
layers.Conv2D(256, (3,3), activation='relu'),
layers.MaxPooling2D((2,2), strides=(2,2)),
layers.Flatten(),
layers.Dense(4096, activation='relu'),
layers.Dense(1000, activation='softmax')
]
)
# ���������������������
model.load_weights("vgg16_weights.hdf5")

���������������

������������������������������������������������VGG16���������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������CNN���������������������������������

上一篇:利用python爬虫大量爬取网页图片
下一篇:解决出现 ImportError: No module named 'tensorflow_datasets'的问题

发表评论

最新留言

网站不错 人气很旺了 加油
[***.192.178.218]2025年04月19日 02时12分49秒