ncnn:提取所有层特征值
生活随笔
收集整理的這篇文章主要介紹了
ncnn:提取所有层特征值
小編覺得挺不錯的,現在分享給大家,幫大家做個參考.
官方代碼托管地址:https://github.com/Tencent/ncnn
在Extractor類中添加以下方法:
int Extractor::extract_all_blobs() {for (int blob_index = 0; blob_index < blob_mats.size(); blob_index++){Mat outMat;extract(blob_index, outMat);// write to filechar path[256];char id[8];strcpy(path, "./ncnn_blobs_data/");sprintf(id, "%d", blob_index);strcat(path, id);strcat(path, ".txt");FILE *fp = fopen(path, "w+");if(!fp)fprintf(stderr, "error open file\n");// headerfprintf(fp, net->blobs[blob_index].name.c_str());fprintf(fp, "\n");for (int idx = 0; idx < outMat.w * outMat.h * outMat.c; idx++)fprintf(fp, "%f\n", outMat[idx]);fclose(fp);}return 0; }
轉載于:https://www.cnblogs.com/pepetang/p/11347557.html
總結
以上是生活随笔為你收集整理的ncnn:提取所有层特征值的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: go语言在Windows系统下编译成li
- 下一篇: Bootstrap Table实现表格高