目前在做分割模型部署,
根据
根据这个代码,我更改了板端部署的代码,想请问下下面这个代码里面的perception 存储的是什么数据啊
for (int h = 0; h < height; ++h) {-
for (int w = 0; w < width; ++w) {-
float top_score = -1000000.0f;-
int top_index = 0;-
float *c_data = data + (width * h + w) * channel;-
for (int c = 0; c < channel; c++) {-
if (c_data[c] > top_score) {-
top_score = c_data[c];-
top_index = c;-
}-
}-
perception->seg.seg[h * width + w] = top_index;-
}
颜值即正义
2
颜值即正义
3
你好!在这段代码中,perception->seg.seg[h * width + w]存储的是语义分割结果,相当于在h*w的单通道灰度图中为每个像素点分配一个值,该值的大小对应物体的分类序号。对perception本身的理解可以先参考include/base/perception_common.h,该头文件定义了结构体Perception,包含了在ptq_unet_post_preocess_method.cc中调用的各种参数,需要认真梳理里面的代码关系;之后可以查看include/method_data.h,PerceptionPtr是对Perception使用了智能指针shared_ptr的结果;最后再来分析ptq_unet_post_preocess_method.cc,可以看出perception获取了模型的多种信息,比如图像的长宽,类别数量,任务类别为分割,以及分割结果等等。