bevdet-tensorrt-cpp
bevdet-tensorrt-cpp copied to clipboard
增加Pre-process-net stage后未达到预期结果
@LCH1238 作者你好,感谢你的开源。
有个问题请教你:
由于你的代码中使用去掉pre-process-net模块的模型转换和推理的,而我的模型中有pre-process-net模块,所以我修改转模型的代码,将自己的模型转成三个阶段,分别是image-stage-4d-depth
,pre-process-stage-4d-depth
,bev-stage-4d-depth
。
InitEngine()
中,三个模型的输入输出维度是:
images : 6 3 512 1408
rot : 1 6 3 3
trans : 1 6 3
intrin : 1 6 3 3
post_rot : 1 6 3 3
post_trans : 1 6 3
bda : 1 3 3
depth : 6 118 32 88
images_feat : 6 32 88 80
pre_process_input : 1 80 128 128
pre_process_output : 1 80 128 128
BEV_feat : 1 160 128 128
reg_0 : 1 2 128 128
height_0 : 1 1 128 128
dim_0 : 1 3 128 128
rot_0 : 1 2 128 128
vel_0 : 1 2 128 128
heatmap_0 : 1 10 128 128
我对推理代码做了如下修改:
- 将bev_pool_v2的输出赋值给pre-process-net的输入:
bev_pool_v2(bevpool_channel, unique_bev_num, bev_h * bev_w,
(float*)imgstage_buffer[imgbuffer_map["depth"]],
(float*)imgstage_buffer[imgbuffer_map["images_feat"]],
ranks_depth_dev, ranks_feat_dev, ranks_bev_dev,
interval_starts_dev, interval_lengths_dev,
// (float*)bevstage_buffer[bevbuffer_map["BEV_feat"]]//out
(float*)preprocessstage_buffer[preprocessbuffer_map["pre_process_input"]]
);
- 然后进行Pre-process stage network forward:
if(!preprocessstage_context->enqueueV2(preprocessstage_buffer, stream, nullptr)){
printf("Pre-peocess stage forward failing!\n");
}
CHECK_CUDA(cudaDeviceSynchronize());
- 将Pre-process stage的输出复制给bevstage_buffer的当前BEV_feat:
CHECK_CUDA(cudaMemcpy((float*)bevstage_buffer[bevbuffer_map["BEV_feat"]], (float*)preprocessstage_buffer[preprocessbuffer_map["pre_process_output"]],
bev_h * bev_w * bevpool_channel * sizeof(float), cudaMemcpyDeviceToDevice));
最后依次进行align BEV feature 、BEV stage network forward、post process
我训练得到的pth模型的mAP=0.43,并不算低,但是转化为tensorrt后,用上述的推理代码,和本仓库提供的sample,输出结果只有16个object,而且使用viewer.py
可视化我的推理结果,发现检测框并不在点云目标上。
请问你知道原因吗?或者我修改的推理代码逻辑是否正确?
期待你的回复!