DarkHelp  v1.4.27-1
C++ API for the neural network framework Darknet
Looking for a C++ dev who knows OpenCV?
I'm looking for work. Hire me!
DarkHelp CLI Tool

The DarkHelp library also comes with a command-line tool that uses the DarkHelp C++ API to show the results on the screen, or outputs the findings in JSON format.

Note
The CLI tool can also be used in a non-interactive mode, where it returns results as a JSON structure. This can be useful in bash scripts, and is explained in Shell Scripting.

You can load a neural network and browse through a large set of images as you examine the results of calling DarkHelp::NN::predict() and DarkHelp::NN::annotate() on each image. Images can be resized, apply different thresholds to the predictions, and get details on the predicted results.

Here is an example of how to use it:

DarkHelp barcodetest.cfg barcodetest_final.weights barcodetest.names test_image_1.jpg test_image_2.jpg

Note the parameters:

  • The .cfg file used to originally train the neural network.
  • The .weights file that was created as part of the neural network training.
  • The .names file which contains the names of the various classes in the network.
  • One or more image file (typically .jpg, but could be any type of image) against which you want to run the network. This can be left out if you instead use the -l parameter to read in a list of image filenames from a text file.

There are at least a dozen possible command-line arguments. run DarkHelp --help for the full list or see Parameters. Some examples:

# -b means resize the "before" input image prior to calling DarkHelp::predict()
# -t sets the new lower bound threshold to 25%
DarkHelp -b 800x800 -t 0.25 barcodetest.cfg barcodetest_best.weights barcodetest.names *.jpg
# -a resizes the "after" output image once DarkHelp::annotate() has been called
# -s starts the viewer in slideshow mode, where a new image is loaded every second
DarkHelp -a 640x480 -s barcodetest.cfg barcodetest_final.weights barcodetest.names *.jpg
# -j outputs the results as JSON text instead of showing an annotated image.
DarkHelp -j -t 0.5 barcodetest.cfg barcodetest_best.weights barcodetest.names *.jpg

In addition to command-line arguments, there are several keys you can use in the viewer. Some of which are:

  • q or ESC to exit from the viewer.
  • t to toggle image tiling (see Image Tiling)
  • w to write the current image to disk in the current working directory (see "output.png")
  • HOME to return to the first image in the data set
  • END to skip to the last image in the data set
  • LEFT go to the previous image
  • UP increase the rate at which images are processed during the slideshow
  • DOWN decrease the rate at which images are processed during the slideshow
  • PAGE-UP increase the threshold
  • PAGE-DOWN decrease the threshold
  • g to toggle greyscale images
  • p to pause or play the slideshow

Press h in DarkHelp to show the help page with all the keyboard shortcuts.

Also see: