YOLOV3批量检测图片,只显示一类检测结果,并输出位置信息保存到txt
第一步: 首先修改YOLOV3中src/imge.c中的void draw_detections函数。这里的修改实现了保存检测类别的位置信息到txt文档,附修改代码
void draw_detections(char *filename, image im, detection *dets, int num, float thresh, char **names, image **alphabet, int classes)
{
int i,j;
//将filename的文件名提取出来,即去掉.jpg的后缀,加上.txt的后缀
char *output = filename;
int haha = 0;
for (haha = strlen(filename)-1; haha>=0; haha--){
if((filename[haha]!='j')&&(filename[haha]!='p')&&(filename[haha]!='g')&&(filename[haha]!='.')){
break;
}
else{
output[haha] = '\0';
}
}
output = strcat(filename, ".txt");
//创建保存位置信息txt文档
FILE *fp;
if ( (fp = fopen(output, "w+")) == NULL ){
printf("创建文档失败:\n");
}
for(i = 0; i < num; ++i){
char labelstr[4096] = {0};
int class = -1;

该博客介绍了如何使用YOLOV3进行批量图片检测,仅显示一类检测结果并输出其位置信息到TXT文件。教程包括修改YOLOV3代码、编写shell脚本以及执行检测的过程。
最低0.47元/天 解锁文章

被折叠的 条评论
为什么被折叠?



