Darknet Detection

The following pipelines will take in a set of images or a video file. Each frame will be evaluated by the Darknet yolo algorithm with a weight file that was trained on the virat data set. This weight file will identify any ‘person’ or ‘vehicle’ objects in the image. The detections will then be drawn on the input image and displayed to the user, and written to disk.

Setup

In order to execute pipeline files, follow these steps to set up KWIVER

In order to run the pipelines associated with this tutorial you will need to download the associated data package. The download process is done via targets created in the build process. In a bash terminal in your KWIVER build directory, make the following targets:

make external_darknet_example
make setup_darknet_example

If you are using Visual Studio, manually build the external_darknet_example project, followed by the setup_darknet_example project.

This will pull, place, and configure all the data associated with thise exampe into <your KWIVER build directory>/examples/pipeline/darknet folder

The following files will be in the <build directory>/examples/pipelines/darknet folder:

  • images - Directory containing images used in this example

  • models - Directory containing configuration and weight files needed by Darknet

  • output - Directory where new images will be placed when the pipeline executes

  • video - Directory containing the video used in this example

  • configure.cmake - CMake script to set configure *.in files specific to your system

  • darknet_image.pipe - The pipe file to run Darknet on the provided example images

  • darknet_image.pipe.in - The pipe file to be configured to run on your system

  • darknet_video.pipe - The pipe file to run Darknet on the provided example video

  • darknet_video.pipe.in - The pipe file to be configured to run on your system

  • image_list.txt - The images to be used by the darknet_image.pipe file

  • image_list.txt.in - The list file to be configured to run on your system

  • readme.txt - This tutorial supersedes content in this file

Execution

Run the following command from the kwiver buildbin directory (bin/release on windows) Relativly point to the darknet_image.pipe or darknet_video.pipe file like this:

# Windows Example :
kwiver runner ..\..\examples\pipelines\darknet\darknet_image.pipe
# Linux Example :
./kwiver runner ../examples/pipelines/darknet/darknet_image.pipe

# Windows Example :
kwiver runner ..\..\examples\pipelines\darknet\darknet_video.pipe
# Linux Example :
./kwiver runner ../examples/pipelines/darknet/darknet_video.pipe

NOTE, you will need to supply a video file for the darknet_video pipe at this time. We will update the zip contents ASAP.

The darknet_image.pipe file will put all generated output to the examples/pipelines/darknet/output/images

The darknet_video.pipe file will put all generated output to the examples/pipelines/darknet/output/video

Image Detection

Process Graph

darknet_image

The following image displays the pipeline graph. Each process is linked to its associated definition page to learn more about it and the algorithms it uses.

strict digraph "unnamed" { clusterrank=local; subgraph "cluster_disp" { color=lightgray; "disp_main" [label=<<u>disp<br/>:: image_viewer</u>>,shape=ellipse,rank=same,fontcolor=blue,fontsize=16,href="../sprokit/processes/image_viewer.html"]; "disp_input_image" [label="image\n:: kwiver:image",shape=none,height=0,width=0,fontsize=12]; "disp_input_image" -> "disp_main" [arrowhead=none,color=black]; "disp_input_timestamp" [label="timestamp\n:: kwiver:timestamp",shape=none,height=0,width=0,fontsize=12]; "disp_input_timestamp" -> "disp_main" [arrowhead=none,color=black]; "disp_output__heartbeat" [label="_heartbeat\n:: _none",shape=none,height=0,width=0,fontsize=12]; "disp_main" -> "disp_output__heartbeat" [arrowhead=none,color=black]; } subgraph "cluster_draw" { color=lightgray; "draw_main" [label=<<u>draw<br/>:: draw_detected_object_boxes</u>>,shape=ellipse,rank=same,fontcolor=blue,fontsize=16,href="../sprokit/processes/draw_detected_object_boxes.html"]; "draw_input_detected_object_set" [label="detected_object_set\n:: kwiver:detected_object_set",shape=none,height=0,width=0,fontsize=12]; "draw_input_detected_object_set" -> "draw_main" [arrowhead=none,color=black]; "draw_input_image" [label="image\n:: kwiver:image",shape=none,height=0,width=0,fontsize=12]; "draw_input_image" -> "draw_main" [arrowhead=none,color=black]; "draw_output__heartbeat" [label="_heartbeat\n:: _none",shape=none,height=0,width=0,fontsize=12]; "draw_main" -> "draw_output__heartbeat" [arrowhead=none,color=black]; "draw_output_image" [label="image\n:: kwiver:image",shape=none,height=0,width=0,fontsize=12]; "draw_main" -> "draw_output_image" [arrowhead=none,color=black]; } subgraph "cluster_input" { color=lightgray; "input_main" [label=<<u>input<br/>:: frame_list_input</u>>,shape=ellipse,rank=same,fontcolor=blue,fontsize=16,href="../sprokit/processes/frame_list_input.html"]; "input_output__heartbeat" [label="_heartbeat\n:: _none",shape=none,height=0,width=0,fontsize=12]; "input_main" -> "input_output__heartbeat" [arrowhead=none,color=black]; "input_output_image" [label="image\n:: kwiver:image",shape=none,height=0,width=0,fontsize=12]; "input_main" -> "input_output_image" [arrowhead=none,color=black]; "input_output_image_file_name" [label="image_file_name\n:: kwiver:image_file_name",shape=none,height=0,width=0,fontsize=12]; "input_main" -> "input_output_image_file_name" [arrowhead=none,color=black]; "input_output_timestamp" [label="timestamp\n:: kwiver:timestamp",shape=none,height=0,width=0,fontsize=12]; "input_main" -> "input_output_timestamp" [arrowhead=none,color=black]; } subgraph "cluster_write" { color=lightgray; "write_main" [label=<<u>write<br/>:: image_writer</u>>,shape=ellipse,rank=same,fontcolor=blue,fontsize=16,href="../sprokit/processes/image_writer.html"]; "write_input_image" [label="image\n:: kwiver:image",shape=none,height=0,width=0,fontsize=12]; "write_input_image" -> "write_main" [arrowhead=none,color=black]; "write_input_timestamp" [label="timestamp\n:: kwiver:timestamp",shape=none,height=0,width=0,fontsize=12]; "write_input_timestamp" -> "write_main" [arrowhead=none,color=black]; "write_output__heartbeat" [label="_heartbeat\n:: _none",shape=none,height=0,width=0,fontsize=12]; "write_main" -> "write_output__heartbeat" [arrowhead=none,color=black]; } subgraph "cluster_yolo_v2" { color=lightgray; "yolo_v2_main" [label=<<u>yolo_v2<br/>:: image_object_detector</u>>,shape=ellipse,rank=same,fontcolor=blue,fontsize=16,href="../sprokit/processes/image_object_detector.html"]; "yolo_v2_input_image" [label="image\n:: kwiver:image",shape=none,height=0,width=0,fontsize=12]; "yolo_v2_input_image" -> "yolo_v2_main" [arrowhead=none,color=black]; "yolo_v2_output__heartbeat" [label="_heartbeat\n:: _none",shape=none,height=0,width=0,fontsize=12]; "yolo_v2_main" -> "yolo_v2_output__heartbeat" [arrowhead=none,color=black]; "yolo_v2_output_detected_object_set" [label="detected_object_set\n:: kwiver:detected_object_set",shape=none,height=0,width=0,fontsize=12]; "yolo_v2_main" -> "yolo_v2_output_detected_object_set" [arrowhead=none,color=black]; } subgraph "cluster_yolo_v2_csv_writer" { color=lightgray; "yolo_v2_csv_writer_main" [label=<<u>yolo_v2_csv_writer<br/>:: detected_object_output</u>>,shape=ellipse,rank=same,fontcolor=blue,fontsize=16,href="../sprokit/processes/detected_object_output.html"]; "yolo_v2_csv_writer_input_detected_object_set" [label="detected_object_set\n:: kwiver:detected_object_set",shape=none,height=0,width=0,fontsize=12]; "yolo_v2_csv_writer_input_detected_object_set" -> "yolo_v2_csv_writer_main" [arrowhead=none,color=black]; "yolo_v2_csv_writer_input_image_file_name" [label="image_file_name\n:: kwiver:image_file_name",shape=none,height=0,width=0,fontsize=12]; "yolo_v2_csv_writer_input_image_file_name" -> "yolo_v2_csv_writer_main" [arrowhead=none,color=black]; "yolo_v2_csv_writer_output__heartbeat" [label="_heartbeat\n:: _none",shape=none,height=0,width=0,fontsize=12]; "yolo_v2_csv_writer_main" -> "yolo_v2_csv_writer_output__heartbeat" [arrowhead=none,color=black]; } subgraph "cluster_yolo_v2_kw18_writer" { color=lightgray; "yolo_v2_kw18_writer_main" [label=<<u>yolo_v2_kw18_writer<br/>:: detected_object_output</u>>,shape=ellipse,rank=same,fontcolor=blue,fontsize=16,href="../sprokit/processes/detected_object_output.html"]; "yolo_v2_kw18_writer_input_detected_object_set" [label="detected_object_set\n:: kwiver:detected_object_set",shape=none,height=0,width=0,fontsize=12]; "yolo_v2_kw18_writer_input_detected_object_set" -> "yolo_v2_kw18_writer_main" [arrowhead=none,color=black]; "yolo_v2_kw18_writer_input_image_file_name" [label="image_file_name\n:: kwiver:image_file_name",shape=none,height=0,width=0,fontsize=12]; "yolo_v2_kw18_writer_input_image_file_name" -> "yolo_v2_kw18_writer_main" [arrowhead=none,color=black]; "yolo_v2_kw18_writer_output__heartbeat" [label="_heartbeat\n:: _none",shape=none,height=0,width=0,fontsize=12]; "yolo_v2_kw18_writer_main" -> "yolo_v2_kw18_writer_output__heartbeat" [arrowhead=none,color=black]; } "draw_output_image" -> "disp_input_image" [minlen=1,color=black,weight=1]; "draw_output_image" -> "write_input_image" [minlen=1,color=black,weight=1]; "input_output_image" -> "yolo_v2_input_image" [minlen=1,color=black,weight=1]; "input_output_image" -> "draw_input_image" [minlen=1,color=black,weight=1]; "input_output_image_file_name" -> "yolo_v2_kw18_writer_input_image_file_name" [minlen=1,color=black,weight=1]; "input_output_image_file_name" -> "yolo_v2_csv_writer_input_image_file_name" [minlen=1,color=black,weight=1]; "input_output_timestamp" -> "disp_input_timestamp" [minlen=1,color=black,weight=1]; "yolo_v2_output_detected_object_set" -> "draw_input_detected_object_set" [minlen=1,color=black,weight=1]; "yolo_v2_output_detected_object_set" -> "yolo_v2_kw18_writer_input_detected_object_set" [minlen=1,color=black,weight=1]; "yolo_v2_output_detected_object_set" -> "yolo_v2_csv_writer_input_detected_object_set" [minlen=1,color=black,weight=1]; }

darknet_video

The following image displays the pipeline graph. Each process is linked to its associated definition page to learn more about it and the algorithms it uses.

strict digraph "unnamed" { clusterrank=local; subgraph "cluster_draw" { color=lightgray; "draw_main" [label=<<u>draw<br/>:: draw_detected_object_boxes</u>>,shape=ellipse,rank=same,fontcolor=blue,fontsize=16,href="../sprokit/processes/draw_detected_object_boxes.html"]; "draw_input_detected_object_set" [label="detected_object_set\n:: kwiver:detected_object_set",shape=none,height=0,width=0,fontsize=12]; "draw_input_detected_object_set" -> "draw_main" [arrowhead=none,color=black]; "draw_input_image" [label="image\n:: kwiver:image",shape=none,height=0,width=0,fontsize=12]; "draw_input_image" -> "draw_main" [arrowhead=none,color=black]; "draw_output__heartbeat" [label="_heartbeat\n:: _none",shape=none,height=0,width=0,fontsize=12]; "draw_main" -> "draw_output__heartbeat" [arrowhead=none,color=black]; "draw_output_image" [label="image\n:: kwiver:image",shape=none,height=0,width=0,fontsize=12]; "draw_main" -> "draw_output_image" [arrowhead=none,color=black]; } subgraph "cluster_input" { color=lightgray; "input_main" [label=<<u>input<br/>:: video_input</u>>,shape=ellipse,rank=same,fontcolor=blue,fontsize=16,href="../sprokit/processes/video_input.html"]; "input_output__heartbeat" [label="_heartbeat\n:: _none",shape=none,height=0,width=0,fontsize=12]; "input_main" -> "input_output__heartbeat" [arrowhead=none,color=black]; "input_output_image" [label="image\n:: kwiver:image",shape=none,height=0,width=0,fontsize=12]; "input_main" -> "input_output_image" [arrowhead=none,color=black]; "input_output_timestamp" [label="timestamp\n:: kwiver:timestamp",shape=none,height=0,width=0,fontsize=12]; "input_main" -> "input_output_timestamp" [arrowhead=none,color=black]; "input_output_video_metadata" [label="video_metadata\n:: kwiver:video_metadata",shape=none,height=0,width=0,fontsize=12]; "input_main" -> "input_output_video_metadata" [arrowhead=none,color=black]; } subgraph "cluster_write" { color=lightgray; "write_main" [label=<<u>write<br/>:: image_writer</u>>,shape=ellipse,rank=same,fontcolor=blue,fontsize=16,href="../sprokit/processes/image_writer.html"]; "write_input_image" [label="image\n:: kwiver:image",shape=none,height=0,width=0,fontsize=12]; "write_input_image" -> "write_main" [arrowhead=none,color=black]; "write_input_timestamp" [label="timestamp\n:: kwiver:timestamp",shape=none,height=0,width=0,fontsize=12]; "write_input_timestamp" -> "write_main" [arrowhead=none,color=black]; "write_output__heartbeat" [label="_heartbeat\n:: _none",shape=none,height=0,width=0,fontsize=12]; "write_main" -> "write_output__heartbeat" [arrowhead=none,color=black]; } subgraph "cluster_yolo_v2" { color=lightgray; "yolo_v2_main" [label=<<u>yolo_v2<br/>:: image_object_detector</u>>,shape=ellipse,rank=same,fontcolor=blue,fontsize=16,href="../sprokit/processes/image_object_detector.html"]; "yolo_v2_input_image" [label="image\n:: kwiver:image",shape=none,height=0,width=0,fontsize=12]; "yolo_v2_input_image" -> "yolo_v2_main" [arrowhead=none,color=black]; "yolo_v2_output__heartbeat" [label="_heartbeat\n:: _none",shape=none,height=0,width=0,fontsize=12]; "yolo_v2_main" -> "yolo_v2_output__heartbeat" [arrowhead=none,color=black]; "yolo_v2_output_detected_object_set" [label="detected_object_set\n:: kwiver:detected_object_set",shape=none,height=0,width=0,fontsize=12]; "yolo_v2_main" -> "yolo_v2_output_detected_object_set" [arrowhead=none,color=black]; } subgraph "cluster_yolo_v2_csv_writer" { color=lightgray; "yolo_v2_csv_writer_main" [label=<<u>yolo_v2_csv_writer<br/>:: detected_object_output</u>>,shape=ellipse,rank=same,fontcolor=blue,fontsize=16,href="../sprokit/processes/detected_object_output.html"]; "yolo_v2_csv_writer_input_detected_object_set" [label="detected_object_set\n:: kwiver:detected_object_set",shape=none,height=0,width=0,fontsize=12]; "yolo_v2_csv_writer_input_detected_object_set" -> "yolo_v2_csv_writer_main" [arrowhead=none,color=black]; "yolo_v2_csv_writer_input_image_file_name" [label="image_file_name\n:: kwiver:image_file_name",shape=none,height=0,width=0,fontsize=12]; "yolo_v2_csv_writer_input_image_file_name" -> "yolo_v2_csv_writer_main" [arrowhead=none,color=black]; "yolo_v2_csv_writer_output__heartbeat" [label="_heartbeat\n:: _none",shape=none,height=0,width=0,fontsize=12]; "yolo_v2_csv_writer_main" -> "yolo_v2_csv_writer_output__heartbeat" [arrowhead=none,color=black]; } subgraph "cluster_yolo_v2_kw18_writer" { color=lightgray; "yolo_v2_kw18_writer_main" [label=<<u>yolo_v2_kw18_writer<br/>:: detected_object_output</u>>,shape=ellipse,rank=same,fontcolor=blue,fontsize=16,href="../sprokit/processes/detected_object_output.html"]; "yolo_v2_kw18_writer_input_detected_object_set" [label="detected_object_set\n:: kwiver:detected_object_set",shape=none,height=0,width=0,fontsize=12]; "yolo_v2_kw18_writer_input_detected_object_set" -> "yolo_v2_kw18_writer_main" [arrowhead=none,color=black]; "yolo_v2_kw18_writer_input_image_file_name" [label="image_file_name\n:: kwiver:image_file_name",shape=none,height=0,width=0,fontsize=12]; "yolo_v2_kw18_writer_input_image_file_name" -> "yolo_v2_kw18_writer_main" [arrowhead=none,color=black]; "yolo_v2_kw18_writer_output__heartbeat" [label="_heartbeat\n:: _none",shape=none,height=0,width=0,fontsize=12]; "yolo_v2_kw18_writer_main" -> "yolo_v2_kw18_writer_output__heartbeat" [arrowhead=none,color=black]; } "draw_output_image" -> "write_input_image" [minlen=1,color=black,weight=1]; "input_output_image" -> "yolo_v2_input_image" [minlen=1,color=black,weight=1]; "input_output_image" -> "draw_input_image" [minlen=1,color=black,weight=1]; "yolo_v2_output_detected_object_set" -> "draw_input_detected_object_set" [minlen=1,color=black,weight=1]; "yolo_v2_output_detected_object_set" -> "yolo_v2_kw18_writer_input_detected_object_set" [minlen=1,color=black,weight=1]; "yolo_v2_output_detected_object_set" -> "yolo_v2_csv_writer_input_detected_object_set" [minlen=1,color=black,weight=1]; }