多目标跟踪Darklabel自定义数据格式---视频标注

Posted wait a minute~

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了多目标跟踪Darklabel自定义数据格式---视频标注相关的知识,希望对你有一定的参考价值。

1.环境

windows
DarkLabel

2.准备

(1)标注工具

DarkLabel2.4.zip-深度学习文档类资源-CSDN下载

官方GitHub地址

(2)需要标注的视频
   自己准备

3.设计自己的标注格式

 上面是DarkLable解压后的目录,如果要修改对应的配置,我们可以直接在darklabel.yml文件中进行修改。这里面的内容提供源码的作者已经进行了解读:

%YAML:1.0
---
## Default Settings
media_path_root: "H:\\\\darklabel_test\\\\media"          # if specified, image/video files are opened in this folder by default
gt_path_root: "H:\\\\darklabel_test\\\\gt"          # if specified, gt files are loaded and saved in $gt_path_root\\ by default
auto_gt_load: 0                # if true, gt is loaded from $gt_path_root\\ when media is opened (you have to select gt format first before open media. if $gt_path_root\\ is not defined, gt is loaded from media path)
gt_file_ext: "xml"              # default gt save file format (supported formats: xml, txt, csv)
gt_merged: 0                  # 0: save gt as separate file for each image, 1: save gt in one file
delimiter: ","                   # separating delimiter of gt datum (it's effective only when gt is saved in txt)
database_name: "Unknown"        # it is used when saving gt data in xml format: <database>database_name</database>
classes_set: "my_classes1"   # predefined classes set (tag name of classes set)

## Predefined Classes Sets (you can define and add your own classes set here)
my_classes1: ["person", "vehicle", "bicycle", "motorbike", "animal", "tree", "building"]
coco_classes: ["person", "bicycle", "car", "motorcycle", "airplane", "bus", "train", "truck", "boat", "traffic light", "fire hydrant", "stop sign", "parking meter", "bench", "bird", "cat", "dog", "horse", "sheep", "cow", "elephant", "bear", "zebra", "giraffe", "backpack", "umbrella", "handbag", "tie", "suitcase", "frisbee", "skis", "snowboard", "sports ball", "kite", "baseball bat", "baseball glove", "skateboard", "surfboard", "tennis racket", "bottle", "wine glass", "cup", "fork", "knife", "spoon", "bowl", "banana", "apple", "sandwich", "orange", "broccoli", "carrot", "hot dog", "pizza", "donut", "cake", "chair", "couch", "potted plant", "bed", "dining table", "toilet", "tv", "laptop", "mouse", "remote", "keyboard", "cell phone", "microwave", "oven", "toaster", "sink", "refrigerator", "book", "clock", "vase", "scissors", "teddy bear", "hair drier", "toothbrush"]
voc_classes: ["aeroplane", "bicycle", "bird", "boat", "bottle", "bus", "car", "cat", "chair", "cow", "diningtable", "dog", "horse", "motorbike", "person", "pottedplant", "sheep", "sofa", "train", "tvmonitor"]

## GUI Settings (you can also enter double quoted virtual key code for hotkeys: e.g. "32" for spacebar)
pg_step_size: 30         # navigation step size when PgUp and PgDn key is pressed
min_object_size: 10     # minimum box/object size to be allowed (in pixels)
box_line_width: 2       # line width of bounding boxes
box_color: [0,255,0]     # default box color: [b, g, r] (for boxes that have no ID)
highlight_width: 2      # line width of highlighted bounding box boundaries
cross_width: 1           # width of cross line indicating mouse position
hotkey_left: "a"          # secondary hotkey for left arrow key (move backward)
hotkey_right: "d"        # secondary hotkey for right arrow key (move forward)
hotkey_pgup: "q"       # secondary hotkey for page up key (move backword pg_step_size)
hotkey_pgdn: "e"       # secondary hotkey for page down key (move forward pg_step_size)
hotkey_shift: "s"         # secondary hotkey for SHIFT key (box editing mode)
hotkey_ctrl: "w"         # secondary hotkey for CTRL key (scroll mode of zoomed window)
hotkey_return: "32"     # secondary hotkey for Return/Enter key (tracking)

## Export Annotation results as Video or Image List
export_video_fps: 10              # fps of output video when the input media is image list and the save type is video. If the input media is video, the origirnla fps is preserved.
export_video_codec: "XVID"      # opencv fourcc codecs: "XVID", "DIVX", "MJPG", "FFV1", ... (full list of fourcc: http://www.fourcc.org/codecs.php)
export_image_format: "png"     # image format when the input media is video and the save type is image list ("png", "jpg", "bmp", ...). If the input media is image list, the original format is preserved.

## User-defined GT Formats (format0 ~ format99)
#  [format specifiers]
#   - fn: video frame number (e.g. 0, 1, 2, ...)
#   - iname: image file name (e.g. sample.png)
#   - cname: class name or label of the object (e.g. dog, cat, ...)
#   - classid: zero-based index of object class in the classes set (e.g. 0, 1, 2, ...)
#   - id: object instance id (e.g. 0, 1, 2, ...)
#   - x1, y1, x2, y2, cx, cy, w, h: bounding box (xmin, ymin, xmax, ymax, xcenter, ycenter, width, height)
#   - nx1, ny1, nx2, ny2, ncx, ncy, nw, nh: normalized bounding box (e.g. nx1 = x1 / image_width, nh = h / image_height)
#   - c=n: constant value (e.g. c=0, c=-1, c=1.23, ...). It can be used to save and load dummy values (see format2: MOT example)
#   - difficult: difficult sample to train or not (it comes from pascal voc) (e.g. 0, 1)

format0:    # pascal voc & imagenet (predefined format]
  fixed_filetype: 1                 # if specified as true, save setting isn't changeable in GUI
  data_fmt: [cname, difficult, x1, y1, x2, y2]
  gt_file_ext: "xml"                # if not specified, default setting is used
  gt_merged: 0                    # if not specified, default setting is used
  classes_set: "voc_classes"      # if not specified, default setting is used 
  name: "pascal voc"              # if not specified, "[fmt%d] $data_fmt" is used as default format name

format1:    # darknet yolo (predefined format]
  fixed_filetype: 1                 # if specified as true, save setting isn't changeable in GUI
  data_fmt: [classid, ncx, ncy, nw, nh]
  gt_file_ext: "txt"                 # if not specified, default setting is used
  gt_merged: 0                    # if not specified, default setting is used
  delimiter: " "                     # if not spedified, default delimiter(',') is used
  classes_set: "coco_classes"     # if not specified, default setting is used
  name: "darknet yolo"           # if not specified, "[fmt%d] $data_fmt" is used as default format name

format2:    # MOT (predefined format]
  fixed_filetype: 1                 # if specified as true, save setting isn't changeable in GUI
  data_fmt: [fn, id, x1, y1, w, h, c=-1, c=-1, c=-1, c=-1]
  gt_file_ext: "csv"                 # if not specified, default setting is used
  gt_merged: 1                    # if not specified, default setting is used
  classes_set: "coco_classes"     # if not specified, default setting is used
  name: "MOT"                     # if not specified, "[fmt%d] $data_fmt" is used as default format name

format3:    # example of user-defined format (pascal voc & imagenet + object id)
  fixed_filetype: 0                 # if specified as true, save setting isn't changeable in GUI
  data_fmt: [cname, id, difficult, x1, y1, x2, y2]
  gt_file_ext: "xml"                # if not specified, default setting is used
  gt_merged: 0                    # if not specified, default setting is used
  classes_set: "voc_classes"      # if not specified, default setting is used 
  name: "pascal voc + id"       # if not specified, "[fmt%d] $data_fmt" is used as default format name

format4:    # example of user-defined format (darknet yolo + object id)
  fixed_filetype: 0                 # if specified as true, save setting isn't changeable in GUI
  data_fmt: [classid, id, ncx, ncy, nw, nh]
  gt_file_ext: "txt"                 # if not specified, default setting is used
  gt_merged: 0                    # if not specified, default setting is used
  delimiter: " "                     # if not spedified, default delimiter(',') is used
  classes_set: "coco_classes"     # if not specified, default setting is used
  name: "darknet yolo + id"      # if not specified, "[fmt%d] $data_fmt" is used as default format name

format5:    # example of user-defined format (object tracking in videos)
  fixed_filetype: 0                 # if specified as true, save setting isn't changeable in GUI
  data_fmt: [fn, cname, id, x1, y1, w, h]
  gt_file_ext: "txt"                  # initial setting (the setting can be changed in GUI)
  gt_merged: 1                     # initial setting (the setting can be changed in GUI)
  classes_set: "my_classes1"      # if not specified, default setting is used 
  
format6:     # example of user-defined format (object tracking in image sequence)
  fixed_filetype: 0                 # if specified as true, save setting isn't changeable in GUI
  data_fmt: [iname, cname, id, x1, y1, w, h]
  gt_file_ext: "txt"                 # if not specified, default setting is used. The setting can be changed in GUI
  gt_merged: 1                     # if not specified, default setting is used. The setting can be changed in GUI
  classes_set: "my_classes1"      # if not specified, default setting is used 

format7:     # other example of user-defined format
  fixed_filetype: 0                 # if specified as true, save setting isn't changeable in GUI
  data_fmt: [classid, difficult, x1, y1, x2, y2]
  gt_file_ext: "xml"                  # if not specified, default setting is used. The setting can be changed in GUI
  gt_merged: 0                     # if not specified, default setting is used. The setting can be changed in GUI
  classes_set: "coco_classes"     # if not specified, default setting is used

format8:    # other example of user-defined format
  fixed_filetype: 0                 # if specified as true, save setting isn't changeable in GUI
  data_fmt: [cname, x1, y1, w, h]
  gt_file_ext: "xml"                 # if not specified, default setting is used. The setting can be changed in GUI
  gt_merged: 0                     # if not specified, default setting is used. The setting can be changed in GUI

以MOT16数据格式为例,我们可以修改添加(我们需要了解MOT16的gt是什么格式):

[fn, id, x1, y1, w, h, c=1 [0 ignore,1 activate], c=came, c=visibility ratio]

my_classes2:['person']

format9:    # other example of user-defined format
  fixed_filetype: 1                 # if specified as true, save setting isn't changeable in GUI
  data_fmt: [fn, id, x1, y1, w, h, c=1, c=cname, c=1]
  gt_file_ext: "txt"                 # if not specified, default setting is used
  gt_merged: 1                    # if not specified, default setting is used
  classes_set: "myclasses2"     # if not specified, default setting is used
  name: "MOT16"                     # if not specified, "[fmt%d] $data_fmt" is used as default format name

4.标注工具界面以及使用技巧

标注工具界面(选中我们自定义的标注文件)

 标注结果:

0,0,40,199,33,34,1,0,1
0,1,117,206,37,39,1,0,1
0,2,358,244,17,14,1,0,1
0,3,381,242,19,16,1,0,1
0,4,413,242,16,13,1,0,1
0,5,423,248,15,14,1,0,1
0,6,769,61,83,80,1,0,1
1,0,40,200,33,34,1,0,1
1,1,119,207,37,39,1,0,1
1,2,357,247,18,15,1,0,1
1,3,379,242,21,16,1,0,1
1,4,414,242,16,13,1,0,1
1,5,424,249,15,14,1,0,1
1,6,754,71,83,80,1,0,1

标注技巧:

1.鼠标拖动:创建一个框;

2.Shift +右键单击(特定框出现红色线条或者红色框就是被选中):仅删除所选框
3.Shift +右键单击(空,不选择任何,容易误判删除了所有得标注框)删除当前屏幕上的所有框。

4.标注好一帧后,按enter键,会预测后结果,如果框出入比较大后,可以搭配使用2.3条,尽量不要一下子就预测了整个视频,因为框到后面越来越偏,再进行修改会非常的麻烦。

比较全的标注文档:视频标注软件Darklabel用法指南_pprp的博客-CSDN博客_darklabel安装

以上是关于多目标跟踪Darklabel自定义数据格式---视频标注的主要内容,如果未能解决你的问题,请参考以下文章

快讯 | 旷视科技“基于神经网络模型的目标跟踪方法及装置”获中国专利优秀奖

论文解读SortDeep-Sort多目标跟踪算法

多目标跟踪——评测指标

多目标跟踪 | 评测指标

多目标跟踪 | 评测指标

使用 Piwik + Ruby on Rails 跟踪目标转换中的自定义变量