Toybrick

翻译成c语言的代码

chinaflys

注册会员

积分
166
楼主
发表于 2021-1-27 17:46:38    查看: 10332|回复: 1 | [复制链接]    打印 | 只看该作者
本人最近在做一个用yolov3的模型,进行识别的程序,可咱们的示例代码是用c++编译器编译的,而我目前用的buildroot系统只能用c编译器,以下这个代码编译不通过,希望版主能够帮我解决??
int yolov3_post_process(float* input0, float* input1, float* out_pos, float* out_prop, int* out_label)
{
        float(&output0)[1][GRID0][GRID0][SPAN][LISTSIZE] = *((float(*)[1][GRID0][GRID0][SPAN][LISTSIZE])buffer);
        float(&output1)[1][GRID1][GRID1][SPAN][LISTSIZE] = *((float(*)[1][GRID1][GRID1][SPAN][LISTSIZE])(buffer +LISTSIZE *SPAN *GRID0 *GRID0));

        for (int i = 0; i < SPAN; i++){
                for (int j = 0; j < LISTSIZE; j++){

                        int bias0 = i*LISTSIZE*GRID0*GRID0+ j*GRID0*GRID0;
                        for (int k = 0; k < GRID0; k++){
                                int bias_k = bias0 + k*GRID0;
                                for (int l = 0; l < GRID0; l++){
                                        output0[0][k][l][i][j] = input0[(bias_k+l)];
                                }
                        }

                        int bias1 = i*LISTSIZE*GRID1*GRID1+ j*GRID1*GRID1;
                        for (int k = 0; k < GRID1; k++){
                                int bias_k = bias1 + k*GRID1;
                                for (int l = 0; l < GRID1; l++){
                                        output1[0][k][l][i][j] = input1[bias_k+l];
                                }
                        }

                }
        }

        int object_num = process(output0, output1, out_pos, out_prop, out_label);
        return object_num;
}


就是float(&output0)[1][,和float(&output1)[1][,因为c语法里面没有引用用法,只能用c++编译器才能够编译通过,而我目前不能使用c++编译器;
回复

使用道具 举报

brunolin

高级会员

积分
620
沙发
发表于 2021-3-5 09:33:38 | 只看该作者
參考一下這個
人工智能开发系列(3) YOLOV3开发与实现
裡面有提供一個C的範例程式 C-yolov3/
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

产品中心 购买渠道 开源社区 Wiki教程 资料下载 关于Toybrick


快速回复 返回顶部 返回列表