DnnAttribute - Extended-Object-Detection-ROS/wiki_english GitHub Wiki

DNN Attribute

An attribute that recognizes images using the dnn module from OpenCV. Minimum OpenCV version: 3.4.1 (while ROS Melodic comes with 3.2.0, Noetic is recommended) To use networks from other frameworks in this module, you do not need to install them.

Modes Accuracy assessment 3D-translation 3D-rotation Contour extraction Additional info
D D Optional <Attribute_name>:class_id, <Attribute_name>:class_label

1. Modes

1.1. Detect

Returns areas with objects recognized by CNN and having a probability not lower than Probability.

1.2. Check

Not implemented

1.3. Extract

Not implemented

2. XML-description

2.1. Common parameters

  • Name (string, must be set) attribute unique name
  • Type (string, must be "Dnn") attribute type
  • Weight (double, default: 1) attribute weight
  • Probability (double, default: 0.75) acceptable detection accuracy, used in Detect mode.
  • Contour (bool, default: true) Returns the contour of the attribute if true.

2.2. Special parameters

  • framework (string, must be set) Framework options available: darknet, tensorflow.
  • weights (string, must be set) The path to the scale file. See the table below for more information.
  • config (string, must be set) The path to the configuration file. See the table below for more information.
  • labels (string, default: "") The path to the file with the names of the labels. Optional parameter, needed only if you need to fix the name of the object on the network.
  • forceCuda (int, default: 0) For some computers (for example, the Jetson series), you need to set 1 to enable network acceleration using CUDA and cuDNN.
  • inputWidth (int, default: 300) The width of the input image to the network. TODO: extract automatically from config
  • inputHeight (int, default: 300) The height of the input image to the network. TODO: extract automatically from config
  • additional_layers (string, default "") Names of additional layers added to output of the net. Basic only the last layer is proceed. Names must be separated with spaces.
  • maskProbability (double, default: 0.75) Separated probability for mask nets.

2.3. Example

<?xml version="1.0" ?>

<AttributeLib>

    <Attribute Name="COCO_Dnn" Type="Dnn" framework="tensorflow" weights="ssd_mobilenet_v1_coco_2017_11_17/frozen_inference_graph.pb" config="ssd_mobilenet_v1_coco_2017_11_17/config.pbtxt" labels="ssd_mobilenet_v1_coco_2017_11_17/mscoco_label_map.pbtxt" inputWidth="300" inputHeight="300" Probability="0.75"/>

</AttributeLib>

<SimpleObjectBase>  
    
    <SimpleObject Name="COCO_dnn_object" ID="60">              
        <Attribute Type="Detect">COCO_Dnn</Attribute>                    
    </SimpleObject>
    
</SimpleObjectBase>

dnn example

How to use net with mask extraction

<Attribute Name="MRCNN" Type="Dnn" framework="tensorflow" weights="mask_rcnn_inception_v2_coco_2018_01_28/frozen_inference_graph.pb" config="mask_rcnn_inception_v2_coco_2018_01_28/mask_rcnn_inception_v2_coco_2018_01_28.pbtxt" labels="mask_rcnn_inception_v2_coco_2018_01_28/mscoco_label_map.pbtxt" inputWidth="300" inputHeight="300" Probability="0.3" forceCuda="1" additional_layers="detection_out_final" maskProbability="0.75"/>

3. Supported frameworks

Framework Weight File Config File Label File
DarkNet .weight file .cfg file
TensorFlow frozen_inference_graph.pb files generated .pbtxt file .pbtxt file
⚠️ **GitHub.com Fallback** ⚠️