当前位置:网站首页>rpn:def concat_box_prediction_layers
rpn:def concat_box_prediction_layers
2022-08-10 12:11:00 【Eden_mm】
#因为特征图大小不一样,生成的prediction_layers维度?也不一样,所以需要进行调整!!
def concat_box_prediction_layers(box_cls: List[Tensor], box_regression: List[Tensor]) -> Tuple[Tensor, Tensor]:
box_cls_flattened = []
box_regression_flattened = []
#意思就是lable是对整体的feature-concat的特征负责,所以需要使得不同feature的输出,对objectness and the box_regression有相同的表示,直接看代码吧
# for each feature level, permute(排列) the outputs to make them be in the
# same format as the labels. Note that the labels are computed for
# all feature levels concatenated, so we keep the same representation
# for the objectness and the box_regression
for box_cls_per_level, box_regression_per_level in zip(box_cls, box_regression):
N, AxC, H, W = box_cls_per_level.shape
Ax4 = box_regression_per_level.shape[1]
A = Ax4 // 4
C = AxC // A
box_cls_per_level = permute_and_flatten(box_cls_per_level, N, A, C, H, W)
box_cls_flattened.append(box_cls_per_level)
box_regression_per_level = permute_and_flatten(box_regression_per_level, N, A, 4, H, W)
box_regression_flattened.append(box_regression_per_level)
# concatenate on the first dimension (representing the feature levels), to
# take into account the way the labels were generated (with all feature maps
# being concatenated as well)
# 前面还好,后面关于torch.cat按指定维度拼接这里有点晕。难道其它维度相同吗都??
box_cls = torch.cat(box_cls_flattened, dim=1).flatten(0, -2)
box_regression = torch.cat(box_regression_flattened, dim=1).reshape(-1, 4)
return box_cls, box_regression
边栏推荐
- 漏洞管理计划的未来趋势
- 娄底干细胞制备实验室建设须知要求
- You have a Doubaqiong thesaurus, please check it
- CURRENT_TIMESTAMP(6) 函数是否存在问题?
- LeetCode medium topic search of two-dimensional matrix
- leetcode/两个链表的第一个重合节点
- G1和CMS的三色标记法及漏标问题
- Solve the idea that unit tests cannot use Scanner
- Real-time data warehouse practice of Baidu user product flow and batch integration
- 这三个 Go 水平自测题,你手写不出来还是先老实上班吧,过来看看
猜你喜欢
阿里架构师整理一份企业级SSM架构实战文档,让你熟悉底层原理
CV复习:空洞卷积
ArcMAP出现-15的问题无法访问[Provide your license server administrator with the following information:Err-15]
11 + chrome advanced debugging skills, learn to direct efficiency increases by 666%
海外邮件发送指南(二)
没有接班人,格力只剩“明珠精选”
Real-time data warehouse practice of Baidu user product flow and batch integration
StarRocks on AWS 回顾 | Data Everywhere 系列活动深圳站圆满结束
如何培养ui设计师的设计思维?
多线程下自旋锁设计基本思想
随机推荐
堪称神级的阿里巴巴“高并发”教程——基础+实战+源码+面试+架构 全包了
蚂蚁金服+拼多多+抖音+天猫(技术三面)面经合集助你拿大厂offer
娄底妆品实验室建设规划构思
Chapter9 : De Novo Molecular Design with Chemical Language Models
Hackbar 使用教程
Alibaba Cloud Jia Zhaohui: Cloud XR platform supports Bizhen Technology to present a virtual concert of national style sci-fi
如何培养ui设计师的设计思维?
odps sql 不支持 unsupported feature CREATE TEMPORARY
CodeForces - 628D (digital dp)
G1和CMS的三色标记法及漏标问题
mSystems | 中农汪杰组揭示影响土壤“塑料际”微生物群落的机制
【集合】HashSet和ArrayList的查找Contains()时间复杂度
48 the mysql database
Does face attendance choose face comparison 1:1 or face search 1:N?
十八、一起学习Lua 调试(Debug)
LeetCode中等题之搜索二维矩阵
专有云ABC Stack,真正的实力派!
「网络架构」网络代理第一部分: 代理概述
Solve the idea that unit tests cannot use Scanner
金山云要飘到哪里?