接着上一篇博客:深度学习入门实战----基于Keras的手写数字识别 (LeNet)
本文采用经典的VGG16网络结构
VGG16 论文题目:《Very Deep Convolutional Networks For Large-Scale Image Recongnition》
论文链接:paper link
背景介绍可参照上一篇博客,本文直接贴上VGG16的代码:
import inspect
import os
import numpy as np
import tensorflow as tf
import time
VGG_MEAN = [103.939, 116.779, 123.68]
class Vgg16:
def __init__(self, vgg16_npy_path=None):
if vgg16_npy_path is None:
path = inspect.getfile(Vgg16)
path = os.path.abspath(os.path.join(path, os.pardir))
path = os.path.join(path, "vgg16.npy")
vgg16_npy_path = path
print(path)
self.data_dict = np.load(vgg16_npy_path, encoding&