Coder Social home page Coder Social logo

ezhangle / darknet Goto Github PK

View Code? Open in Web Editor NEW

This project forked from wuxiaolang/darknet

0.0 1.0 0.0 27.98 MB

为 YOLO c 版本添加接口以批量处理 TUM、KITTI 数据集并保存检测结果

License: Other

Makefile 0.33% Python 0.91% C 90.13% Shell 0.21% Cuda 7.75% C++ 0.67%

darknet's Introduction

YOLO 批量处理 TUM、KITTI 数据集并保存检测结果

0. 主要工作:

  • darknet.c 中添加了 detect_tum_batch 命令处理 tum 和自制数据集,添加 detect_kitti_batch 命令处理 kitti 数据集
  • detector.c 中添加了读取数据集图像的函数 test_detector_tum_batch()test_detector_kitti_batch()
  • image.c 中添加了绘制与保存结果(txt 文件和绘制检测框的图像)的函数 draw_save_detections()
  • 代码:https://github.com/wuxiaolang/darknet

1. 指令

1.1 TUM 数据集

  • 指令:
./darknet detect_tum_batch [path_of_cfg] [path_of_weight] [path_of_dataset] [output_folder] [-thresh thresh]
  • 例如:
./darknet detect_tum_batch cfg/yolov3.cfg yolov3.weights /home/wu/data/dataset/rgbd_dataset_freiburg1_desk/ /home/wu/data/ -thresh 0.4
  • 注意:请在 [output_folder] 下创建 yolo_imgsyolo_txts 文件夹来存放绘制了检测框的图片和检测框 txt 信息。

1.2 KITTI 数据集

  • 指令:
./darknet detect_kitti_batch [path_of_cfg] [path_of_weight] [path_of_dataset] [output_folder] [-thresh thresh]

  例如:

./darknet detect_kitti_batch cfg/yolov3.cfg yolov3.weights /home/wu/data/dataset/kitti/color/07/ /home/wu/data/ -thresh 0.4
  • 注意
    • ① 请在 [output_folder] 下创建 yolo_imgsyolo_txts 文件夹来存放绘制了检测框的图片和检测框 txt 信息;
    • ② 在 test_detector_kitti_batch() 函数中默认采用的是 image_2 kitti 彩色数据集,如果使用 gray 数据集,可以将 image_2 改成 image_0image_1
  • 其他数据集:可仿照改动的函数写。

2. 结果保存

2.1 txt 文件存储的内容

  • 以下所有的输出格式、内容可以在 detector.ctest_detector_tum_batch() 函数中修改。
  • 输出的图片保存在 output_folder/yolo_imgs 路径下,文件名为:[时间戳].jpg,例如 1905140001.223000.jpg
  • 输出的 txt 文件保存在 output_folder/yolo_txts 路径下,文件名为:[时间戳].txt,例如 1905140001.223000.txt
  • txt 保存格式:类别 ID   左上角.x   左上角.y   长   宽   置信度
    66   70    294   260   185    0.794691
    64   255   258   63     38    0.813716
    62   224   0     243   234    0.610995
    

2.2 输出文件的文件名

  • TUM 数据集中,由于数据集图像是根据时间戳命名的,且 rgb.txt 中存储的也是时间戳,所以我将输出文件的文件名也由时间戳命名,例如:1905140001.223000.jpg1905140001.223000.txt
  • KITTI 数据集有图像是按序号命名的 000001.png,在 times.txt 文件中保存的是时间戳 1.038752e-01,所以在 KITTI 数据集处理函数中我写了两种存储方式:
    • 第一种是按序号命名(默认情况),结果保存为:000001.jpg000001.txt
    • 第二种是按照时间戳命名,结果保存为:0.10387.jpg0.10387.txt
    • 可在 test_detector_kitti_batch() 函数中选择
      // 【方法 ①】: 以序号命名
      printf("文件序号: %06d\n", num);
      sprintf(output_file_name, "%06d", num);
      // // 【方法 ②】: 以时间戳命名
      // // 逐行读取 txt 文件的时间戳:1.036224e-01.
      // memset(szTest, 0, sizeof(szTest));
      // fgets(szTest, sizeof(szTest) - 1, fp_rgb_txt); // 包含了换行符
      // strncpy(output_file_name, szTest, 12);
      // // 将时间戳转换成十进制
      // double tmp_name = strtod(output_file_name, NULL);   // note strtod() 转换成 lf 十进制类型.
      // // 保留 5 位小数.
      // sprintf(output_file_name, "%.5lf", tmp_name);

YOLO


2019.03.11
[email protected]

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.