当前位置:网站首页>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
边栏推荐
- ArcMAP出现-15的问题无法访问[Provide your license server administrator with the following information:Err-15]
- CURRENT_TIMESTAMP(6) 函数是否存在问题?
- You have a Doubaqiong thesaurus, please check it
- Behind IDC's No. 1 position, what kind of "video cloud" is Alibaba Cloud building?
- 啥?他一个人写了个价值100万的软件,却用来开源了!
- H264 码率控制
- Mysql—— 内连接、左连接、右连接以及全连接查询
- StarRocks on AWS 回顾 | Data Everywhere 系列活动深圳站圆满结束
- iTextSharp操作PDF
- 没有接班人,格力只剩“明珠精选”
猜你喜欢
“68道 Redis+168道 MySQL”精品面试题(带解析)
Guidelines for Sending Overseas Mail (2)
爱可可AI前沿推介(8.10)
Alibaba Cloud Jia Zhaohui: Cloud XR platform supports Bizhen Technology to present a virtual concert of national style sci-fi
阿里云贾朝辉:云XR平台支持彼真科技呈现国风科幻虚拟演唱会
第5章 虚拟存储器
在web页面播放rtsp流视频(webrtc)
How to cultivate the design thinking of ui designers?
人脸考勤是选择人脸比对1:1还是人脸搜索1:N?
7. Instant-ngp
随机推荐
How to do foreign media publicity to grasp the key points
odps sql 不支持 unsupported feature CREATE TEMPORARY
Prada, big show?In the yuan in the universe that!
Diary 16
LeetCode中等题之搜索二维矩阵
阿里架构师整理一份企业级SSM架构实战文档,让你熟悉底层原理
娄底农产品检验实验室建设指南盘点
47Haproxy Cluster
An enhanced dynamic packet buffer management. The core part of the paper
Jenkins修改默认主目录
第5章 虚拟存储器
啥?他一个人写了个价值100万的软件,却用来开源了!
11 + chrome advanced debugging skills, learn to direct efficiency increases by 666%
十八、一起学习Lua 调试(Debug)
So delicious!Since using this interface artifact, my team efficiency has increased by 60%!
堪称神级的阿里巴巴“高并发”教程——基础+实战+源码+面试+架构 全包了
MySQL相关问题整理
数字藏品,“赌”字当头
Proprietary cloud ABC Stack, the real strength!
Pod生命周期