Darknet

Darknet Detector Algorithm

class darknet_detector : public kwiver::vital::algorithm_impl<darknet_detector, vital::algo::image_object_detector>

Public Functions

vital::config_block_sptr get_configuration() const

Get this algorithm’s configuration block .

Get this alg’s configuration block .

This method returns the required configuration for the algorithm. The implementation of this method should be light-weight and only create and fill in the config block.

This base virtual function implementation returns an empty configuration.

Return

config_block containing the configuration for this algorithm and any nested components.

void set_configuration(vital::config_block_sptr config)

Set this algorithm’s properties via a config block.

This method is called to pass a configuration to the algorithm. The implementation of this method should be light-weight and only save the necessary config values. Defer any substantial processing in another method.

Exceptions
  • no_such_configuration_value_exception: Thrown if an expected configuration value is not present.

  • algorithm_configuration_exception: Thrown when the algorithm is given an invalid config_block or is otherwise unable to configure itself.

Parameters
  • config: The config_block instance containing the configuration parameters for this algorithm

bool check_configuration(vital::config_block_sptr config) const

Check that the algorithm’s configuration config_block is valid.

This checks solely within the provided config_block and not against the current state of the instance. This isn’t static for inheritance reasons.

Return

true if the configuration check passed and false if it didn’t.

Parameters
  • config: The config block to check configuration of.

vital::detected_object_set_sptr detect(vital::image_container_sptr image_data) const

Find all objects on the provided image.

This method analyzes the supplied image and along with any saved context, returns a vector of detected image objects.

Return

vector of image objects found

Parameters
  • image_data: the image pixels

Darknet Trainer Algorithm

class darknet_trainer : public kwiver::vital::algorithm_impl<darknet_trainer, vital::algo::train_detector>

Darknet Training Utility Class.

Public Functions

vital::config_block_sptr get_configuration() const

Get this algorithm’s configuration block .

Get this alg’s configuration block .

This method returns the required configuration for the algorithm. The implementation of this method should be light-weight and only create and fill in the config block.

This base virtual function implementation returns an empty configuration.

Return

config_block containing the configuration for this algorithm and any nested components.

void set_configuration(vital::config_block_sptr config)

Set this algorithm’s properties via a config block.

This method is called to pass a configuration to the algorithm. The implementation of this method should be light-weight and only save the necessary config values. Defer any substantial processing in another method.

Exceptions
  • no_such_configuration_value_exception: Thrown if an expected configuration value is not present.

  • algorithm_configuration_exception: Thrown when the algorithm is given an invalid config_block or is otherwise unable to configure itself.

Parameters
  • config: The config_block instance containing the configuration parameters for this algorithm

bool check_configuration(vital::config_block_sptr config) const

Check that the algorithm’s configuration config_block is valid.

This checks solely within the provided config_block and not against the current state of the instance. This isn’t static for inheritance reasons.

Return

true if the configuration check passed and false if it didn’t.

Parameters
  • config: The config block to check configuration of.

void train_from_disk(vital::category_hierarchy_sptr object_labels, std::vector<std::string> train_image_names, std::vector<kwiver::vital::detected_object_set_sptr> train_groundtruth, std::vector<std::string> test_image_names, std::vector<kwiver::vital::detected_object_set_sptr> test_groundtruth)

Train a detection model given a list of images and detections.

This varient is geared towards offline training.

Parameters
  • object_labels: object category labels for training

  • train_image_list: list of train image filenames

  • train_groundtruth: annotations loaded for each image

  • test_image_list: list of test image filenames

  • test_groundtruth: annotations loaded for each image

FAQ

I am running out of memory in CUDA…

Try one or both of these suggestions: - Change the darknet/models/virat.cfg variables height,weight to smaller powers of 32 - Change the darknet/models/virat.cfg variables batch and subdivisions (make sure they are still the same)