deep-learning - 卷积神经网络中的聚合和连接有什么区别?
问题描述
当我阅读一些关于 CNN 的经典论文时,如 Inception family、ResNet、VGGnet 等,我注意到术语concatenation、summation和aggregation,这让我很困惑(summation 对我来说很容易理解)。有人能告诉我它们之间有什么区别吗?也许以更具体的方式,例如使用示例来说明维度和表示能力的差异。
解决方案
- Concatenation generally consists of taking 2 or more output tensors from different network layers and concatenating them along the channel dimension
- Aggregation consists in taking 2 or more output tensors from different network layers and applying a chosen multivariate function on them to aggregate the results
- Summation is a special case of aggregation where the function is a sum
This implies that we lose information by doing aggregation. On the other hand, concatenation will make it possible to retain information at the cost of greater memory usage.
E.g. in PyTorch:
import torch
batch_size = 8
num_channels = 3
h, w = 512, 512
t1 = torch.rand(batch_size, num_channels, h, w) # A tensor with shape [8, 3, 512, 512]
t2 = torch.rand(batch_size, num_channels, h, w) # A tensor with shape [8, 3, 512, 512]
torch.cat((t1, t2), dim=1) # A tensor with shape [8, 6, 512, 512]
t1 + t2 # A tensor with shape [8, 3, 512, 512]
推荐阅读
- filehelpers - FileHelpers 问题 - 如何在没有换行符或分隔符的情况下读取固定长度文件
- css - 如何在 .NET Framework 项目中禁用 SCSS 编译文件
- html5-canvas - Canvas 中奇怪的视图框字体大小调整行为
- c# - 在 Visual Studio 2019 中重新启用标题栏
- javascript - 如何使用 JavaScript 显示图像和文本搜索结果?
- java - Spring boot Jsp / Tag在不同模块中
- jquery - Jssor 是否可以在滑块上放置一个暂停按钮并播放?
- spring - Spring Boot 执行器端点未通过 HTTP 公开
- python - 将 Pandas DataFrame 列值与另一个 DataFrame 列匹配
- glsl - Vulkan 是否支持着色器中的原子浮点操作?