[caffe]深度学习之图像分类模型VGG解读

一、简介

vgg和googlenet是2014年imagenet竞赛的双雄,这两类模型结构有一个共同特点是go deeper。跟googlenet不同的是,vgg继承了lenet以及alexnet的一些框架,尤其是跟alexnet框架非常像,vgg也是5个group的卷积、2层fc图像特征、一层fc分类特征,可以看做和alexnet一样总共8个part。根据前5个卷积group,每个group中的不同配置,vgg论文中给出了A~E这五种配置,卷积层数从8到16递增。从论文中可以看到从8到16随着卷积层的一步步加深,貌似通过加深卷积层数也已经到达准确率提升的瓶颈了。后面的有一些论文针对卷积层输入的前处理(例如batch
normalization)和输出的后处理(例如prelu)做了研究。再进一步的提升方向会是什么呢?这个值得大家去深入思考。

二、网络分析

我根据http://cs.stanford.edu/people/karpathy/vgg_train_val.prototxt配置文件以及vgg论文指导修改得到了vgg_A网络结构。

在修改的过程中你会发现vgg为了做不同深度网络之间的对比,然后又不至于太多的修改网络,vgg中给所有的卷积层以及pool层都设置了一样的层操作参数,确保了每个group出来的shape都是一致的,不管你在卷积group中加多少层的卷积。

三、网络日志

以下是具体的shape log:

i0701 17:01:10.548092 26739 data_layer.cpp:85] output data size: 100,3,224,224
i0701 17:01:10.736845 26739 net.cpp:206] top shape: 100 3 224 224 (15052800)
i0701 17:01:10.736912 26739 net.cpp:206] top shape: 100 (100)
i0701 17:01:10.736929 26739 layer_factory.hpp:75] creating layer conv1_1
i0701 17:01:10.736968 26739 net.cpp:166] creating layer conv1_1
i0701 17:01:10.736979 26739 net.cpp:496] conv1_1 <- data
i0701 17:01:10.737004 26739 net.cpp:452] conv1_1 -> conv1_1
i0701 17:01:10.737030 26739 net.cpp:197] setting up conv1_1
i0701 17:01:10.738733 26739 net.cpp:206] top shape: 100 64 224 224 (321126400)
i0701 17:01:10.738770 26739 layer_factory.hpp:75] creating layer relu1_1
i0701 17:01:10.738786 26739 net.cpp:166] creating layer relu1_1
i0701 17:01:10.738824 26739 net.cpp:496] relu1_1 <- conv1_1
i0701 17:01:10.738838 26739 net.cpp:439] relu1_1 -> conv1_1 (in-place)
i0701 17:01:10.738853 26739 net.cpp:197] setting up relu1_1
i0701 17:01:10.738867 26739 net.cpp:206] top shape: 100 64 224 224 (321126400)
i0701 17:01:10.738878 26739 layer_factory.hpp:75] creating layer pool1
i0701 17:01:10.738890 26739 net.cpp:166] creating layer pool1
i0701 17:01:10.738900 26739 net.cpp:496] pool1 <- conv1_1
i0701 17:01:10.738914 26739 net.cpp:452] pool1 -> pool1
i0701 17:01:10.738930 26739 net.cpp:197] setting up pool1
i0701 17:01:10.738963 26739 net.cpp:206] top shape: 100 64 112 112 (80281600)
i0701 17:01:10.738975 26739 layer_factory.hpp:75] creating layer conv2_1
i0701 17:01:10.738992 26739 net.cpp:166] creating layer conv2_1
i0701 17:01:10.739001 26739 net.cpp:496] conv2_1 <- pool1
i0701 17:01:10.739017 26739 net.cpp:452] conv2_1 -> conv2_1
i0701 17:01:10.739030 26739 net.cpp:197] setting up conv2_1
i0701 17:01:10.746640 26739 net.cpp:206] top shape: 100 128 112 112 (160563200)
i0701 17:01:10.746669 26739 layer_factory.hpp:75] creating layer relu2_1
i0701 17:01:10.746682 26739 net.cpp:166] creating layer relu2_1
i0701 17:01:10.746691 26739 net.cpp:496] relu2_1 <- conv2_1
i0701 17:01:10.746702 26739 net.cpp:439] relu2_1 -> conv2_1 (in-place)
i0701 17:01:10.746714 26739 net.cpp:197] setting up relu2_1
i0701 17:01:10.746726 26739 net.cpp:206] top shape: 100 128 112 112 (160563200)
i0701 17:01:10.746734 26739 layer_factory.hpp:75] creating layer pool2
i0701 17:01:10.746749 26739 net.cpp:166] creating layer pool2
i0701 17:01:10.746759 26739 net.cpp:496] pool2 <- conv2_1
i0701 17:01:10.746770 26739 net.cpp:452] pool2 -> pool2
i0701 17:01:10.746783 26739 net.cpp:197] setting up pool2
i0701 17:01:10.746798 26739 net.cpp:206] top shape: 100 128 56 56 (40140800)
i0701 17:01:10.746809 26739 layer_factory.hpp:75] creating layer conv3_1
i0701 17:01:10.746809 26739 layer_factory.hpp:75] creating layer conv3_1
i0701 17:01:10.746825 26739 net.cpp:166] creating layer conv3_1
i0701 17:01:10.746835 26739 net.cpp:496] conv3_1 <- pool2
i0701 17:01:10.746846 26739 net.cpp:452] conv3_1 -> conv3_1
i0701 17:01:10.746860 26739 net.cpp:197] setting up conv3_1
i0701 17:01:10.747910 26739 net.cpp:206] top shape: 100 256 56 56 (80281600)
i0701 17:01:10.747939 26739 layer_factory.hpp:75] creating layer relu3_1
i0701 17:01:10.747954 26739 net.cpp:166] creating layer relu3_1
i0701 17:01:10.747963 26739 net.cpp:496] relu3_1 <- conv3_1
i0701 17:01:10.747974 26739 net.cpp:439] relu3_1 -> conv3_1 (in-place)
i0701 17:01:10.747985 26739 net.cpp:197] setting up relu3_1
i0701 17:01:10.747997 26739 net.cpp:206] top shape: 100 256 56 56 (80281600)
i0701 17:01:10.748009 26739 layer_factory.hpp:75] creating layer conv3_2
i0701 17:01:10.748021 26739 net.cpp:166] creating layer conv3_2
i0701 17:01:10.748030 26739 net.cpp:496] conv3_2 <- conv3_1
i0701 17:01:10.748045 26739 net.cpp:452] conv3_2 -> conv3_2
i0701 17:01:10.748060 26739 net.cpp:197] setting up conv3_2
i0701 17:01:10.750586 26739 net.cpp:206] top shape: 100 256 56 56 (80281600)
i0701 17:01:10.750610 26739 layer_factory.hpp:75] creating layer relu3_2
i0701 17:01:10.750624 26739 net.cpp:166] creating layer relu3_2
i0701 17:01:10.750635 26739 net.cpp:496] relu3_2 <- conv3_2
i0701 17:01:10.750648 26739 net.cpp:439] relu3_2 -> conv3_2 (in-place)
i0701 17:01:10.750669 26739 net.cpp:197] setting up relu3_2
i0701 17:01:10.750681 26739 net.cpp:206] top shape: 100 256 56 56 (80281600)
i0701 17:01:10.750690 26739 layer_factory.hpp:75] creating layer pool3
i0701 17:01:10.750702 26739 net.cpp:166] creating layer pool3
i0701 17:01:10.750710 26739 net.cpp:496] pool3 <- conv3_2
i0701 17:01:10.750725 26739 net.cpp:452] pool3 -> pool3
i0701 17:01:10.750740 26739 net.cpp:197] setting up pool3
i0701 17:01:10.750756 26739 net.cpp:206] top shape: 100 256 28 28 (20070400)
i0701 17:01:10.750764 26739 layer_factory.hpp:75] creating layer conv4_1
i0701 17:01:10.750779 26739 net.cpp:166] creating layer conv4_1
i0701 17:01:10.750788 26739 net.cpp:496] conv4_1 <- pool3
i0701 17:01:10.750800 26739 net.cpp:452] conv4_1 -> conv4_1
i0701 17:01:10.750825 26739 net.cpp:197] setting up conv4_1
i0701 17:01:10.756436 26739 net.cpp:206] top shape: 100 512 28 28 (40140800)
i0701 17:01:10.756474 26739 layer_factory.hpp:75] creating layer relu4_1
i0701 17:01:10.756489 26739 net.cpp:166] creating layer relu4_1
i0701 17:01:10.756499 26739 net.cpp:496] relu4_1 <- conv4_1
i0701 17:01:10.756510 26739 net.cpp:439] relu4_1 -> conv4_1 (in-place)
i0701 17:01:10.756523 26739 net.cpp:197] setting up relu4_1
i0701 17:01:10.756536 26739 net.cpp:206] top shape: 100 512 28 28 (40140800)
i0701 17:01:10.756546 26739 layer_factory.hpp:75] creating layer conv4_2
i0701 17:01:10.756559 26739 net.cpp:166] creating layer conv4_2
i0701 17:01:10.756568 26739 net.cpp:496] conv4_2 <- conv4_1
i0701 17:01:10.756583 26739 net.cpp:452] conv4_2 -> conv4_2
i0701 17:01:10.756597 26739 net.cpp:197] setting up conv4_2
i0701 17:01:10.766434 26739 net.cpp:206] top shape: 100 512 28 28 (40140800)
i0701 17:01:10.766474 26739 layer_factory.hpp:75] creating layer relu4_2
i0701 17:01:10.766490 26739 net.cpp:166] creating layer relu4_2
i0701 17:01:10.766500 26739 net.cpp:496] relu4_2 <- conv4_2
i0701 17:01:10.766513 26739 net.cpp:439] relu4_2 -> conv4_2 (in-place)
i0701 17:01:10.766531 26739 net.cpp:197] setting up relu4_2
i0701 17:01:10.766543 26739 net.cpp:206] top shape: 100 512 28 28 (40140800)
i0701 17:01:10.766552 26739 layer_factory.hpp:75] creating layer pool4
i0701 17:01:10.766573 26739 net.cpp:166] creating layer pool4
i0701 17:01:10.766582 26739 net.cpp:496] pool4 <- conv4_2
i0701 17:01:10.766595 26739 net.cpp:452] pool4 -> pool4
i0701 17:01:10.766608 26739 net.cpp:197] setting up pool4
i0701 17:01:10.766624 26739 net.cpp:206] top shape: 100 512 14 14 (10035200)
I0701 17:18:56.158187 29940 layer_factory.hpp:75] Creating layer conv5_1
I0701 17:18:56.158201 29940 net.cpp:166] Creating Layer conv5_1
I0701 17:18:56.158210 29940 net.cpp:496] conv5_1 <- pool4
I0701 17:18:56.158222 29940 net.cpp:452] conv5_1 -> conv5_1
I0701 17:18:56.158234 29940 net.cpp:197] Setting up conv5_1
I0701 17:18:56.168265 29940 net.cpp:206] Top shape: 100 512 14 14 (10035200)
I0701 17:18:56.168303 29940 layer_factory.hpp:75] Creating layer relu5_1
I0701 17:18:56.168320 29940 net.cpp:166] Creating Layer relu5_1
I0701 17:18:56.168329 29940 net.cpp:496] relu5_1 <- conv5_1
I0701 17:18:56.168341 29940 net.cpp:439] relu5_1 -> conv5_1 (in-place)
I0701 17:18:56.168355 29940 net.cpp:197] Setting up relu5_1
I0701 17:18:56.168368 29940 net.cpp:206] Top shape: 100 512 14 14 (10035200)
I0701 17:18:56.168378 29940 layer_factory.hpp:75] Creating layer conv5_2
I0701 17:18:56.168395 29940 net.cpp:166] Creating Layer conv5_2
I0701 17:18:56.168406 29940 net.cpp:496] conv5_2 <- conv5_1
I0701 17:18:56.168417 29940 net.cpp:452] conv5_2 -> conv5_2
I0701 17:18:56.168431 29940 net.cpp:197] Setting up conv5_2
I0701 17:18:56.178441 29940 net.cpp:206] Top shape: 100 512 14 14 (10035200)
I0701 17:18:56.178478 29940 layer_factory.hpp:75] Creating layer relu5_2
I0701 17:18:56.178493 29940 net.cpp:166] Creating Layer relu5_2
I0701 17:18:56.178501 29940 net.cpp:496] relu5_2 <- conv5_2
I0701 17:18:56.178514 29940 net.cpp:439] relu5_2 -> conv5_2 (in-place)
I0701 17:18:56.178527 29940 net.cpp:197] Setting up relu5_2
I0701 17:18:56.178539 29940 net.cpp:206] Top shape: 100 512 14 14 (10035200)
I0701 17:18:56.178547 29940 layer_factory.hpp:75] Creating layer pool5
I0701 17:18:56.178561 29940 net.cpp:166] Creating Layer pool5
I0701 17:18:56.178570 29940 net.cpp:496] pool5 <- conv5_2
I0701 17:18:56.178581 29940 net.cpp:452] pool5 -> pool5
I0701 17:18:56.178596 29940 net.cpp:197] Setting up pool5
I0701 17:18:56.178611 29940 net.cpp:206] Top shape: 100 512 7 7 (2508800)
I0701 17:18:56.178621 29940 layer_factory.hpp:75] Creating layer fc6
i0701 17:01:10.796613 26739 net.cpp:166] creating layer fc6
i0701 17:01:10.796622 26739 net.cpp:496] fc6 <- pool5
i0701 17:01:10.796634 26739 net.cpp:452] fc6 -> fc6
i0701 17:01:10.796650 26739 net.cpp:197] setting up fc6
i0701 17:01:11.236284 26739 net.cpp:206] top shape: 100 4096 (409600)
i0701 17:01:11.236351 26739 layer_factory.hpp:75] creating layer relu6
i0701 17:01:11.236373 26739 net.cpp:166] creating layer relu6
i0701 17:01:11.236384 26739 net.cpp:496] relu6 <- fc6
i0701 17:01:11.236404 26739 net.cpp:439] relu6 -> fc6 (in-place)
i0701 17:01:11.236423 26739 net.cpp:197] setting up relu6
i0701 17:01:11.236435 26739 net.cpp:206] top shape: 100 4096 (409600)
i0701 17:01:11.236444 26739 layer_factory.hpp:75] creating layer drop6
i0701 17:01:11.236464 26739 net.cpp:166] creating layer drop6
i0701 17:01:11.236472 26739 net.cpp:496] drop6 <- fc6
i0701 17:01:11.236486 26739 net.cpp:439] drop6 -> fc6 (in-place)
i0701 17:01:11.236500 26739 net.cpp:197] setting up drop6
i0701 17:01:11.236524 26739 net.cpp:206] top shape: 100 4096 (409600)
i0701 17:01:11.236534 26739 layer_factory.hpp:75] creating layer fc7
i0701 17:01:11.236549 26739 net.cpp:166] creating layer fc7
i0701 17:01:11.236557 26739 net.cpp:496] fc7 <- fc6
i0701 17:01:11.236569 26739 net.cpp:452] fc7 -> fc7
i0701 17:01:11.236585 26739 net.cpp:197] setting up fc7
i0701 17:01:11.301771 26739 net.cpp:206] top shape: 100 4096 (409600)
i0701 17:01:11.301842 26739 layer_factory.hpp:75] creating layer relu7
i0701 17:01:11.301864 26739 net.cpp:166] creating layer relu7
i0701 17:01:11.301877 26739 net.cpp:496] relu7 <- fc7
i0701 17:01:11.301898 26739 net.cpp:439] relu7 -> fc7 (in-place)
i0701 17:01:11.301916 26739 net.cpp:197] setting up relu7
i0701 17:01:11.301929 26739 net.cpp:206] top shape: 100 4096 (409600)
i0701 17:01:11.301939 26739 layer_factory.hpp:75] creating layer drop7
i0701 17:01:11.301954 26739 net.cpp:166] creating layer drop7
i0701 17:01:11.301962 26739 net.cpp:496] drop7 <- fc7
i0701 17:01:11.301972 26739 net.cpp:439] drop7 -> fc7 (in-place)
i0701 17:01:11.301985 26739 net.cpp:197] setting up drop7
i0701 17:01:11.302000 26739 net.cpp:206] top shape: 100 4096 (409600)
i0701 17:01:11.302008 26739 layer_factory.hpp:75] creating layer fc8
i0701 17:01:11.302023 26739 net.cpp:166] creating layer fc8
i0701 17:01:11.302032 26739 net.cpp:496] fc8 <- fc7
i0701 17:01:11.302044 26739 net.cpp:452] fc8 -> fc8
i0701 17:01:11.302058 26739 net.cpp:197] setting up fc8
i0701 17:01:11.464764 26739 net.cpp:206] top shape: 100 10000 (1000000)

shape的计算方式可以参考[caffe]深度学习之图像分类模型AlexNet解读

版权声明:本文为博主原创文章,未经博主允许不得转载。

时间: 2025-01-17 09:55:21

[caffe]深度学习之图像分类模型VGG解读的相关文章

【转】[caffe]深度学习之图像分类模型AlexNet解读

[caffe]深度学习之图像分类模型AlexNet解读 原文地址:http://blog.csdn.net/sunbaigui/article/details/39938097 本文章已收录于:  深度学习知识库  分类: deep learning(28)  版权声明:本文为博主原创文章,未经博主允许不得转载. 在imagenet上的图像分类challenge上Alex提出的alexnet网络结构模型赢得了2012届的冠军.要研究CNN类型DL网络模型在图像分类上的应用,就逃不开研究alexn

[caffe]深度学习之图像分类模型AlexNet解读

在imagenet上的图像分类challenge上Alex提出的alexnet网络结构模型赢得了2012届的冠军.要研究CNN类型DL网络模型在图像分类上的应用,就逃不开研究alexnet,这是CNN在图像分类上的经典模型(DL火起来之后). 在DL开源实现caffe的model例子中,它也给出了alexnet的复现,详细网络配置文件例如以下https://github.com/BVLC/caffe/blob/master/models/bvlc_reference_caffenet/train

Caffe 深度学习框架上手教程

本文来源:http://suanfazu.com/t/caffe/281 本文的主要目的保存一个链接,建议阅读原文. Caffe(Convolutional Architecture for Fast Feature Embedding)是一个清晰而高效的深度学习框架,其作者是博士毕业于UC Berkeley的 贾扬清,目前在Google工作. Caffe是纯粹的C++/CUDA架构,支持命令行.Python和MATLAB接口:可以在CPU和GPU直接无缝切换: Caffe::set_mode(

深度学习 vs. 概率图模型 vs. 逻辑学

深度学习 vs. 概率图模型 vs. 逻辑学 摘要:本文回顾过去50年人工智能(AI)领域形成的三大范式:逻辑学.概率方法和深度学习.文章按时间顺序展开,先回顾逻辑学和概率图方法,然后就人工智能和机器学习的未来走向做些预测. [编者按]在上个月发表博客文章<深度学习 vs. 机器学习 vs. 模式识别>之后,CMU博士.MIT博士后及vision.ai联合创始人Tomasz Malisiewicz这一次带领我们回顾50年来人工智能领域三大范式(逻辑学.概率方法和深度学习)的演变历程.通过本文我

Ubuntu 14.04 安装caffe深度学习框架

简介:如何在ubuntu 14.04 下安装caffe深度学习框架. 注:安装caffe时一定要保持网络状态好,不然会遇到很多麻烦.例如下载不了,各种报错. 一.安装依赖包 $ sudo apt-get install git$ sudo apt-get install libprotobuf-dev libleveldb-dev libsnappy-dev libopencv-dev libhdf5-serial-dev protobuf-compiler $ sudo apt-get ins

深度学习人脸识别实验---VGG模型

特别说明:本次实验步骤大部分来源于http://blog.csdn.net/wjmishuai/article/details/50658670 1.caffe环境配置 主要参考:<深度学习 21天实战Caffe> 2.VGG人脸识别模型资料(提供论文和以及训练完的人脸模型) http://www.robots.ox.ac.uk/~vgg/software/vgg_face/ 3.LMDB数据集的获取 数据集划分 #保存图片的路径 PATH=/media/img echo "star

Caffe 深度学习框架介绍

转自:http://suanfazu.com/t/caffe/281 Caffe是一个清晰而高效的深度学习框架,其作者是博士毕业于UC Berkeley的贾扬清,目前在Google工作. Caffe是纯粹的C++/CUDA架构,支持命令行.Python和MATLAB接口:可以在CPU和GPU直接无缝切换: Caffe::set_mode(Caffe::GPU); Caffe的优势 上手快:模型与相应优化都是以文本形式而非代码形式给出.Caffe给出了模型的定义.最优化设置以及预训练的权重,方便立

Caffe深度学习计算框架

Caffe | Deep Learning Framework是一个清晰而高效的深度学习框架,其作者是博士毕业于UC Berkeley的 Yangqing Jia,目前在Google工作.Caffe是纯粹的C++/CUDA架构,支持命令行.Python和MATLAB接口:可以在CPU和GPU直接无缝切换: 1 Caffe::set_mode(Caffe::GPU); Caffe的优势 上手快:模型与相应优化都是以文本形式而非代码形式给出. Caffe给出了模型的定义.最优化设置以及预训练的权重,

机器学习之深度学习常用的模型和方法

Deep Learning的常用模型或者方法 AutoEncoder自动编码器 Deep Learning最简单的一种方法是利用人工神经网络的特点,人工神经网络(ANN)本身就是具有层次结构的系统,如果给定一个神经网络,我们假设其输出与输入是相同的,然后训练调整其参数,得到每一层中的权重.自然地,我们就得到了输入I的几种不同表示(每一层代表一种表示),这些表示就是特征.自动编码器就是一种尽可能复现输入信号的神经网络.为了实现这种复现,自动编码器就必须捕捉可以代表输入数据的最重要的因素,就像PCA