Skip to content

Commit

Permalink
fix the yolov8 seg error, synchronize the sequence of onnx output nodes
Browse files Browse the repository at this point in the history
  • Loading branch information
BUG1989 committed Nov 3, 2024
1 parent 5d3e011 commit 3f4d6a2
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 14 deletions.
14 changes: 7 additions & 7 deletions examples/ax620e/ax_yolov8_seg_steps.cc
Original file line number Diff line number Diff line change
Expand Up @@ -65,12 +65,12 @@ namespace ax
std::vector<detection::Object> proposals;
std::vector<detection::Object> objects;
timer timer_postprocess;
float* output_ptr[3] = {(float*)io_data->pOutputs[4].pVirAddr, // 1*80*80*144
(float*)io_data->pOutputs[5].pVirAddr, // 1*40*40*144
(float*)io_data->pOutputs[6].pVirAddr}; // 1*20*20*144
float* output_seg_ptr[3] = {(float*)io_data->pOutputs[1].pVirAddr, // 1*80*80*32
(float*)io_data->pOutputs[2].pVirAddr, // 1*40*40*32
(float*)io_data->pOutputs[3].pVirAddr}; // 1*20*20*32
float* output_ptr[3] = {(float*)io_data->pOutputs[0].pVirAddr, // 1*80*80*144
(float*)io_data->pOutputs[1].pVirAddr, // 1*40*40*144
(float*)io_data->pOutputs[2].pVirAddr}; // 1*20*20*144
float* output_seg_ptr[3] = {(float*)io_data->pOutputs[3].pVirAddr, // 1*80*80*32
(float*)io_data->pOutputs[4].pVirAddr, // 1*40*40*32
(float*)io_data->pOutputs[5].pVirAddr}; // 1*20*20*32
for (int i = 0; i < 3; ++i)
{
auto feat_ptr = output_ptr[i];
Expand All @@ -79,7 +79,7 @@ namespace ax
detection::generate_proposals_yolov8_seg_native(stride, feat_ptr, feat_seg_ptr, PROB_THRESHOLD, proposals, input_w, input_h, NUM_CLASS);
}
// 1*32*160*160
auto mask_proto_ptr = (float*)io_data->pOutputs[0].pVirAddr;
auto mask_proto_ptr = (float*)io_data->pOutputs[6].pVirAddr;

detection::get_out_bbox_mask(proposals, objects, mask_proto_ptr, DEFAULT_MASK_PROTO_DIM, DEFAULT_MASK_SAMPLE_STRIDE, NMS_THRESHOLD, input_h, input_w, mat.rows, mat.cols);
fprintf(stdout, "post process cost time:%.2f ms \n", timer_postprocess.cost());
Expand Down
14 changes: 7 additions & 7 deletions examples/ax650/ax_yolov8_seg_steps.cc
Original file line number Diff line number Diff line change
Expand Up @@ -65,12 +65,12 @@ namespace ax
std::vector<detection::Object> proposals;
std::vector<detection::Object> objects;
timer timer_postprocess;
float* output_ptr[3] = {(float*)io_data->pOutputs[4].pVirAddr, // 1*80*80*144
(float*)io_data->pOutputs[5].pVirAddr, // 1*40*40*144
(float*)io_data->pOutputs[6].pVirAddr}; // 1*20*20*144
float* output_seg_ptr[3] = {(float*)io_data->pOutputs[1].pVirAddr, // 1*80*80*32
(float*)io_data->pOutputs[2].pVirAddr, // 1*40*40*32
(float*)io_data->pOutputs[3].pVirAddr}; // 1*20*20*32
float* output_ptr[3] = {(float*)io_data->pOutputs[0].pVirAddr, // 1*80*80*144
(float*)io_data->pOutputs[1].pVirAddr, // 1*40*40*144
(float*)io_data->pOutputs[2].pVirAddr}; // 1*20*20*144
float* output_seg_ptr[3] = {(float*)io_data->pOutputs[3].pVirAddr, // 1*80*80*32
(float*)io_data->pOutputs[4].pVirAddr, // 1*40*40*32
(float*)io_data->pOutputs[5].pVirAddr}; // 1*20*20*32
for (int i = 0; i < 3; ++i)
{
auto feat_ptr = output_ptr[i];
Expand All @@ -79,7 +79,7 @@ namespace ax
detection::generate_proposals_yolov8_seg_native(stride, feat_ptr, feat_seg_ptr, PROB_THRESHOLD, proposals, input_w, input_h, NUM_CLASS);
}
// 1*32*160*160
auto mask_proto_ptr = (float*)io_data->pOutputs[0].pVirAddr;
auto mask_proto_ptr = (float*)io_data->pOutputs[6].pVirAddr;

detection::get_out_bbox_mask(proposals, objects, mask_proto_ptr, DEFAULT_MASK_PROTO_DIM, DEFAULT_MASK_SAMPLE_STRIDE, NMS_THRESHOLD, input_h, input_w, mat.rows, mat.cols);
fprintf(stdout, "post process cost time:%.2f ms \n", timer_postprocess.cost());
Expand Down

0 comments on commit 3f4d6a2

Please sign in to comment.