tensorflow - Last fc layers in VGG16
问题描述
The VGG16 architecture has input: 224x224x3 images.I want to have 48x48x3 inputs but to do this in keras, we remove the last fc layers which have 4096 neurons each.Why we have to do this? and is it needed to add another size of fc layers for this input?
解决方案
VGG16 的最终池化层具有输入图像的维度7x7x512
。224x224
从那里 VGG16 使用全连接层(7x7x512)x4096
来获得4096
维度输出。但是,由于您的输入大小不同,最终池化层的特征输出维度也会不同(2x2x512
我认为)。因此,您需要更改全连接层的矩阵维度以使其工作。不过,您还有另外两个选择
- 使用跨空间维度的全局平均池化来获取
512
维度特征,然后使用少数完全连接的层来获取您的类数。 - 调整输入图像的大小
224x224x3
,您无需更改模型架构中的任何内容。
推荐阅读
- reactjs - 如何在 tsx 文件上使用条带库。得到错误
- c# - 数据库更新的通用方法
- c# - Blazor 服务器端授权
- ruby-on-rails - ECS任务中的Puma突然需要10分钟才能启动
- java - Vertx如何使Eventbus请求等待消费者消息回复
- java - 验证 xml:space="preserve" 是否存在于 xml 请求中,并在 xml 响应中包含 xml:space="preserve"
- javascript - 尝试使用 export {} 导出函数导致错误
- java - 归档构建后如何删除原始詹金斯构建
- python - 在 Python 的数据集中过滤“包含值”
- python - 如何在 tkinter python 中执行(“之后”脚本)时处理无效命令名错误