Project - Mask R-CNN with OpenCV for Object Detection

4 / 8

Getting the Model, Weights and Configs of the Network

The DNN module from CV2 supports reading of tensorflow trained object detection models. We need to load the weight and config for this. For more on this topic refer to https://github.com/opencv/opencv/wiki/TensorFlow-Object-Detection-API

Note:

  • cv2.dnn.readNetFromTensorflow(weights, config) : Reads a network model stored in TensorFlow framework's format.

    • weights : path to the .pb file with binary protobuf description of the network architecture
    • config : path to the .pbtxt file that contains text graph definition in protobuf format. Resulting "Net" object is built by text graph using weights from a binary one that let us make it more flexible.
INSTRUCTIONS
  • Set weights to the path of the model weights file /cxldata/dlcourse/mask_rcnn_model_data/mask_rcnn_frozen_inference_graph.pb.

    << your code comes here >> = "/cxldata/dlcourse/mask_rcnn_model_data/mask_rcnn_frozen_inference_graph.pb"
    
  • Set config to the path of the model configurations file /cxldata/dlcourse/mask_rcnn_model_data/mask_rcnn_inception_v2_coco_2018_01_28.pbtxt.

    << your code comes here >> = "/cxldata/dlcourse/mask_rcnn_model_data/mask_rcnn_inception_v2_coco_2018_01_28.pbtxt"
    
  • Read the network model stored in TensorFlow framework’s format by using cv2.dnn.readNetFromTensorflowand passing the weights and configs, the file paths of weights and configurations of the model.

    net = << your code comes here >>(weights, config)
    
Get Hint See Answer


Note - Having trouble with the assessment engine? Follow the steps listed here

Loading comments...