如何使用CNN训练不同大小的输入数据? [英] How to use CNN to train input data of different size?

查看:74
本文介绍了如何使用CNN训练不同大小的输入数据?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

CNN似乎主要用于固定大小的输入.现在我想使用CNN来训练一些大小不同的句子,有哪些常用方法?

解决方案

以下建议主要与计算机视觉taks的CNN有关(特别是对于识别),但对您的领域也可能会有帮助:在He等人的深度卷积网络中用于视觉识别的空间金字塔池"中提出了空间金字塔池层.

总体思路:CNN的卷积层(以及相关的层,例如池化,局部响应规范化等)能够处理可变大小的输入.因此,可变大小输入的问题向下传播到需要固定大小向量的第一完全连接/内部产品层.他等.建议在第一个完全连接的层之前添加空间金字塔池化层(本文中有详细信息).该层本身通过将最后一个卷积层(或后续的合并或响应归一化层)的特征图按层次划分为固定数量的箱来工作.在这些垃圾箱中,响应通常被合并,从而创建固定大小的输出(大小取决于垃圾箱的层次结构和数量).请参阅本文以获取插图.

该层已基于Caffe实现,可在GitHub上使用: ShaoqingRen/SPP_net ..>

CNN seems to be implemented mostly for fixed size input. Now I want to use CNN to train some sentences of different size, what are some common methods?

解决方案

The following suggestion is mostly related to CNNs for computer vision taks (in particular for recognition), but might also be helpful in your domain: I would have a look at "Spatial Pyramid Pooling in Deep Convolutional Networks for Visual Recognition" by He et al. proposing a Spatial Pyramid Pooling layer.

The general idea: The convolutional layers of a CNN (and related layers such as pooling, local response normalization etc.) are able to process variable sized input. Therefore, the problem of variable sized input propagates down to the first fully connected/inner product layer which requires a vector of fixed size. He et al. propose to add the Spatial Pyramid Pooling Layer just before the first fully-connected layer (details in the paper). The layer itself works by hierarchically partitioning the feature maps of the last convolutional layer (or the subsequent pooling or response normalization layer) into a fixed number of bins. Within these bins, responses are pooled as usually, creating a fixed-sized output (where the size depends on the hierarchy and number of bins). please see the paper for illustration.

The layer has been implemented based on Caffe and is available on GitHub: ShaoqingRen/SPP_net.

这篇关于如何使用CNN训练不同大小的输入数据?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆