dlpy.layers.Detection

class dlpy.layers.Detection(name=None, act='AUTO', detection_model_type=None, anchors=None, softmax_for_class_prob=None, coord_type=None, class_number=None, grid_number=None, predictions_per_grid=None, do_sqrt=None, coord_scale=None, object_scale=None, prediction_not_a_object_scale=None, class_scale=None, detection_threshold=None, iou_threshold=None, random_boxes=None, src_layers=None, max_boxes=None, max_label_per_image=None, match_anchor_size=None, num_to_force_coord=None, force_coord_scale=None, **kwargs)

Bases: dlpy.layers.Layer

Detection layer

Parameters:
name : string, optional

Specifies the name of the layer.

act : string, optional

Specifies the activation function.
Valid Values: AUTO, IDENTITY, LOGISTIC, SIGMOID, TANH, RECTIFIER, RELU, SOFPLUS, ELU, LEAKY, FCMP
Default: AUTO

detection_model_type : int, optional

Specifies the type of the object detection model.
Valid Values: YOLOV1, YOLOV2
Default: YOLOV2

anchors : iter-of-floats, optional

Specifies the anchor box values. Anchor box values are a list of scalar value pairs that represent the normalized box sizes in X and Y direction for objects to be detected. The normalized box sizes are calculated by dividing the box size in pixels by the grid size.

softmax_for_class_prob : bool, optional

Specifies whether to perform Softmax on class probability per predicted object.
Default: True

coord_type : int, optional

Specifies the coordinates format type in the input label and detection result.
Valid Values: RECT, COCO, YOLO
Default: RECT

class_number : int

Specifies the number of classes to detection in the detection layer.

grid_number : int

Specifies the number of grids per side in the detection layer.

predictions_per_grid : int

Specifies the number of predictions to generate in the detection layer.

do_sqrt : bool, optional

Specifies whether to apply the SQRT function to width and height of the object for the cost function.
Default: True

coord_scale : float, optional

Specifies the weight for the cost function in the detection layer, when objects exist in the grid.

object_scale : float, optional

Specifies the weight for object detected for the cost function in the detection layer.

prediction_not_a_object_scale : float, optional

Specifies the weight for the cost function in the detection layer, when objects do not exist in the grid.

class_scale : float, optional

Specifies the weight for the class of object detected for the cost function in the detection layer.

detection_threshold : float, optional

Specifies the threshold for object detection.

iou_threshold : float, optional

Specifies the IOU Threshold of maximum suppression in object detection.

random_boxes : bool, optional

Randomizing boxes when loading the bounding box information.
Default: False

src_layers : iter-of-Layers, optional

Specifies the layers directed to this layer.

max_boxes : int, optional

Specifies the maximum number of overall predictions allowed in the detection layer.

max_label_per_image : int, optional

The maximum number of labels per image

match_anchor_size : bool, optional

Whether to force the predicted box match the anchor boxes in sizes for all predictions

num_to_force_coord : int, optional

The number of leading chunk of images in training when the algorithm forces predicted objects in each grid to be equal to the anchor box sizes, and located at the grid center

force_coord_scale : float, optional

The scale for location error during the training period while forcing the predicted boxes to have default sizes/locations

Returns:
Detection
__init__(name=None, act='AUTO', detection_model_type=None, anchors=None, softmax_for_class_prob=None, coord_type=None, class_number=None, grid_number=None, predictions_per_grid=None, do_sqrt=None, coord_scale=None, object_scale=None, prediction_not_a_object_scale=None, class_scale=None, detection_threshold=None, iou_threshold=None, random_boxes=None, src_layers=None, max_boxes=None, max_label_per_image=None, match_anchor_size=None, num_to_force_coord=None, force_coord_scale=None, **kwargs)

Initialize self. See help(type(self)) for accurate signature.

Methods

__init__([name, act, detection_model_type, …]) Initialize self.
count_instances()
format_name([block_num, local_count]) Format the name of the layer
get_number_of_instances()
to_model_params() Convert the model configuration to CAS action parameters