当前位置:网站首页>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
边栏推荐
- Keithley DMM7510精准测量超低功耗设备各种运作模式功耗
- 吃透Chisel语言.36.Chisel实战之以FIFO为例(一)——FIFO Buffer和Bubble FIFO的Chisel实现
- Drive IT Modernization with Low Code
- Golang分布式应用之etcd
- Prada, big show?In the yuan in the universe that!
- dedecms supports one-click import of Word content
- 【jstack、jps命令使用】排查死锁
- 什么是云流化?
- Crypto Gaming: The Future of Gaming
- 啥?他一个人写了个价值100万的软件,却用来开源了!
猜你喜欢

Prada, big show?In the yuan in the universe that!

【论文+代码】PEBAL/Pixel-wise Energy-biased Abstention Learning for Anomaly Segmentation on Complex Urban Driving Scenes(复杂城市驾驶场景异常分割的像素级能量偏置弃权学习)

线代 | 秒杀方法与技巧

Behind IDC's No. 1 position, what kind of "video cloud" is Alibaba Cloud building?

吃透Chisel语言.36.Chisel实战之以FIFO为例(一)——FIFO Buffer和Bubble FIFO的Chisel实现

第5章 虚拟存储器

爱可可AI前沿推介(8.10)

人脸考勤是选择人脸比对1:1还是人脸搜索1:N?

Keithley DMM7510精准测量超低功耗设备各种运作模式功耗

Custom filters and interceptors implement ThreadLocal thread closure
随机推荐
LT8911EXB MIPI CSI/DSI to EDP signal conversion
【jstack、jps命令使用】排查死锁
MySQL相关问题整理
Codeforces Round #276 (Div. 1) D. Kindergarten
CodeForces - 628D (digital dp)
人脸考勤是选择人脸比对1:1还是人脸搜索1:N?
Chapter 5 virtual memory
The 6th "Blue Hat Cup" National College Student Network Security Skills Competition Semi-Final Part WriteUp
十八、一起学习Lua 调试(Debug)
Accumulated and thin hair!Safety Dog has once again obtained the certification of scientific and technological achievements transformation!
LeetCode medium topic search of two-dimensional matrix
Behind IDC's No. 1 position, what kind of "video cloud" is Alibaba Cloud building?
The god-level Alibaba "high concurrency" tutorial - basic + actual combat + source code + interview + architecture is all-inclusive
吃透Chisel语言.36.Chisel实战之以FIFO为例(一)——FIFO Buffer和Bubble FIFO的Chisel实现
You have a Doubaqiong thesaurus, please check it
娄底污水处理厂实验室建设管理
【iOS】Organization of interviews
Threshold-based filtering buffer management scheme in a shared buffer packet switch core part of the paper
sprintboot项目通过interceptor和filter实现接入授权控制
Educational Codeforces Round 41 (Rated for Div. 2) E. Tufurama