當前位置: 首頁>>代碼示例>>Python>>正文


Python box_predictor.MaskRCNNBoxPredictor方法代碼示例

本文整理匯總了Python中object_detection.core.box_predictor.MaskRCNNBoxPredictor方法的典型用法代碼示例。如果您正苦於以下問題:Python box_predictor.MaskRCNNBoxPredictor方法的具體用法?Python box_predictor.MaskRCNNBoxPredictor怎麽用?Python box_predictor.MaskRCNNBoxPredictor使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在object_detection.core.box_predictor的用法示例。


在下文中一共展示了box_predictor.MaskRCNNBoxPredictor方法的8個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。

示例1: test_get_boxes_with_five_classes

# 需要導入模塊: from object_detection.core import box_predictor [as 別名]
# 或者: from object_detection.core.box_predictor import MaskRCNNBoxPredictor [as 別名]
def test_get_boxes_with_five_classes(self):
    image_features = tf.random_uniform([2, 7, 7, 3], dtype=tf.float32)
    mask_box_predictor = box_predictor.MaskRCNNBoxPredictor(
        is_training=False,
        num_classes=5,
        fc_hyperparams=self._build_arg_scope_with_hyperparams(),
        use_dropout=False,
        dropout_keep_prob=0.5,
        box_code_size=4,
    )
    box_predictions = mask_box_predictor.predict(
        image_features, num_predictions_per_location=1, scope='BoxPredictor')
    box_encodings = box_predictions[box_predictor.BOX_ENCODINGS]
    class_predictions_with_background = box_predictions[
        box_predictor.CLASS_PREDICTIONS_WITH_BACKGROUND]
    init_op = tf.global_variables_initializer()
    with self.test_session() as sess:
      sess.run(init_op)
      (box_encodings_shape,
       class_predictions_with_background_shape) = sess.run(
           [tf.shape(box_encodings),
            tf.shape(class_predictions_with_background)])
      self.assertAllEqual(box_encodings_shape, [2, 1, 5, 4])
      self.assertAllEqual(class_predictions_with_background_shape, [2, 1, 6]) 
開發者ID:ringringyi,項目名稱:DOTA_models,代碼行數:26,代碼來源:box_predictor_test.py

示例2: test_get_instance_masks

# 需要導入模塊: from object_detection.core import box_predictor [as 別名]
# 或者: from object_detection.core.box_predictor import MaskRCNNBoxPredictor [as 別名]
def test_get_instance_masks(self):
    image_features = tf.random_uniform([2, 7, 7, 3], dtype=tf.float32)
    mask_box_predictor = box_predictor.MaskRCNNBoxPredictor(
        is_training=False,
        num_classes=5,
        fc_hyperparams=self._build_arg_scope_with_hyperparams(),
        use_dropout=False,
        dropout_keep_prob=0.5,
        box_code_size=4,
        conv_hyperparams=self._build_arg_scope_with_hyperparams(
            op_type=hyperparams_pb2.Hyperparams.CONV),
        predict_instance_masks=True)
    box_predictions = mask_box_predictor.predict(
        image_features, num_predictions_per_location=1, scope='BoxPredictor')
    mask_predictions = box_predictions[box_predictor.MASK_PREDICTIONS]
    self.assertListEqual([2, 1, 5, 14, 14],
                         mask_predictions.get_shape().as_list()) 
開發者ID:ringringyi,項目名稱:DOTA_models,代碼行數:19,代碼來源:box_predictor_test.py

示例3: test_get_boxes_with_five_classes

# 需要導入模塊: from object_detection.core import box_predictor [as 別名]
# 或者: from object_detection.core.box_predictor import MaskRCNNBoxPredictor [as 別名]
def test_get_boxes_with_five_classes(self):
    image_features = tf.random_uniform([2, 7, 7, 3], dtype=tf.float32)
    mask_box_predictor = box_predictor.MaskRCNNBoxPredictor(
        is_training=False,
        num_classes=5,
        fc_hyperparams=self._build_arg_scope_with_hyperparams(),
        use_dropout=False,
        dropout_keep_prob=0.5,
        box_code_size=4,
    )
    box_predictions = mask_box_predictor.predict(
        [image_features], num_predictions_per_location=[1],
        scope='BoxPredictor')
    box_encodings = box_predictions[box_predictor.BOX_ENCODINGS]
    class_predictions_with_background = box_predictions[
        box_predictor.CLASS_PREDICTIONS_WITH_BACKGROUND]
    init_op = tf.global_variables_initializer()
    with self.test_session() as sess:
      sess.run(init_op)
      (box_encodings_shape,
       class_predictions_with_background_shape) = sess.run(
           [tf.shape(box_encodings),
            tf.shape(class_predictions_with_background)])
      self.assertAllEqual(box_encodings_shape, [2, 1, 5, 4])
      self.assertAllEqual(class_predictions_with_background_shape, [2, 1, 6]) 
開發者ID:cagbal,項目名稱:ros_people_object_detection_tensorflow,代碼行數:27,代碼來源:box_predictor_test.py

示例4: test_get_instance_masks

# 需要導入模塊: from object_detection.core import box_predictor [as 別名]
# 或者: from object_detection.core.box_predictor import MaskRCNNBoxPredictor [as 別名]
def test_get_instance_masks(self):
    image_features = tf.random_uniform([2, 7, 7, 3], dtype=tf.float32)
    mask_box_predictor = box_predictor.MaskRCNNBoxPredictor(
        is_training=False,
        num_classes=5,
        fc_hyperparams=self._build_arg_scope_with_hyperparams(),
        use_dropout=False,
        dropout_keep_prob=0.5,
        box_code_size=4,
        conv_hyperparams=self._build_arg_scope_with_hyperparams(
            op_type=hyperparams_pb2.Hyperparams.CONV),
        predict_instance_masks=True)
    box_predictions = mask_box_predictor.predict(
        [image_features],
        num_predictions_per_location=[1],
        scope='BoxPredictor',
        predict_boxes_and_classes=True,
        predict_auxiliary_outputs=True)
    mask_predictions = box_predictions[box_predictor.MASK_PREDICTIONS]
    self.assertListEqual([2, 1, 5, 14, 14],
                         mask_predictions.get_shape().as_list()) 
開發者ID:cagbal,項目名稱:ros_people_object_detection_tensorflow,代碼行數:23,代碼來源:box_predictor_test.py

示例5: test_do_not_return_instance_masks_without_request

# 需要導入模塊: from object_detection.core import box_predictor [as 別名]
# 或者: from object_detection.core.box_predictor import MaskRCNNBoxPredictor [as 別名]
def test_do_not_return_instance_masks_without_request(self):
    image_features = tf.random_uniform([2, 7, 7, 3], dtype=tf.float32)
    mask_box_predictor = box_predictor.MaskRCNNBoxPredictor(
        is_training=False,
        num_classes=5,
        fc_hyperparams=self._build_arg_scope_with_hyperparams(),
        use_dropout=False,
        dropout_keep_prob=0.5,
        box_code_size=4)
    box_predictions = mask_box_predictor.predict(
        [image_features], num_predictions_per_location=[1],
        scope='BoxPredictor')
    self.assertEqual(len(box_predictions), 2)
    self.assertTrue(box_predictor.BOX_ENCODINGS in box_predictions)
    self.assertTrue(box_predictor.CLASS_PREDICTIONS_WITH_BACKGROUND
                    in box_predictions) 
開發者ID:cagbal,項目名稱:ros_people_object_detection_tensorflow,代碼行數:18,代碼來源:box_predictor_test.py

示例6: test_get_boxes_with_five_classes

# 需要導入模塊: from object_detection.core import box_predictor [as 別名]
# 或者: from object_detection.core.box_predictor import MaskRCNNBoxPredictor [as 別名]
def test_get_boxes_with_five_classes(self):
    image_features = tf.random_uniform([2, 7, 7, 3], dtype=tf.float32)
    mask_box_predictor = box_predictor.MaskRCNNBoxPredictor(
        is_training=False,
        num_classes=5,
        fc_hyperparams_fn=self._build_arg_scope_with_hyperparams(),
        use_dropout=False,
        dropout_keep_prob=0.5,
        box_code_size=4,
    )
    box_predictions = mask_box_predictor.predict(
        [image_features], num_predictions_per_location=[1],
        scope='BoxPredictor')
    box_encodings = box_predictions[box_predictor.BOX_ENCODINGS]
    class_predictions_with_background = box_predictions[
        box_predictor.CLASS_PREDICTIONS_WITH_BACKGROUND]
    init_op = tf.global_variables_initializer()
    with self.test_session() as sess:
      sess.run(init_op)
      (box_encodings_shape,
       class_predictions_with_background_shape) = sess.run(
           [tf.shape(box_encodings),
            tf.shape(class_predictions_with_background)])
      self.assertAllEqual(box_encodings_shape, [2, 1, 5, 4])
      self.assertAllEqual(class_predictions_with_background_shape, [2, 1, 6]) 
開發者ID:ambakick,項目名稱:Person-Detection-and-Tracking,代碼行數:27,代碼來源:box_predictor_test.py

示例7: test_get_instance_masks

# 需要導入模塊: from object_detection.core import box_predictor [as 別名]
# 或者: from object_detection.core.box_predictor import MaskRCNNBoxPredictor [as 別名]
def test_get_instance_masks(self):
    image_features = tf.random_uniform([2, 7, 7, 3], dtype=tf.float32)
    mask_box_predictor = box_predictor.MaskRCNNBoxPredictor(
        is_training=False,
        num_classes=5,
        fc_hyperparams_fn=self._build_arg_scope_with_hyperparams(),
        use_dropout=False,
        dropout_keep_prob=0.5,
        box_code_size=4,
        conv_hyperparams_fn=self._build_arg_scope_with_hyperparams(
            op_type=hyperparams_pb2.Hyperparams.CONV),
        predict_instance_masks=True)
    box_predictions = mask_box_predictor.predict(
        [image_features],
        num_predictions_per_location=[1],
        scope='BoxPredictor',
        predict_boxes_and_classes=True,
        predict_auxiliary_outputs=True)
    mask_predictions = box_predictions[box_predictor.MASK_PREDICTIONS]
    self.assertListEqual([2, 1, 5, 14, 14],
                         mask_predictions.get_shape().as_list()) 
開發者ID:ambakick,項目名稱:Person-Detection-and-Tracking,代碼行數:23,代碼來源:box_predictor_test.py

示例8: test_do_not_return_instance_masks_without_request

# 需要導入模塊: from object_detection.core import box_predictor [as 別名]
# 或者: from object_detection.core.box_predictor import MaskRCNNBoxPredictor [as 別名]
def test_do_not_return_instance_masks_without_request(self):
    image_features = tf.random_uniform([2, 7, 7, 3], dtype=tf.float32)
    mask_box_predictor = box_predictor.MaskRCNNBoxPredictor(
        is_training=False,
        num_classes=5,
        fc_hyperparams_fn=self._build_arg_scope_with_hyperparams(),
        use_dropout=False,
        dropout_keep_prob=0.5,
        box_code_size=4)
    box_predictions = mask_box_predictor.predict(
        [image_features], num_predictions_per_location=[1],
        scope='BoxPredictor')
    self.assertEqual(len(box_predictions), 2)
    self.assertTrue(box_predictor.BOX_ENCODINGS in box_predictions)
    self.assertTrue(box_predictor.CLASS_PREDICTIONS_WITH_BACKGROUND
                    in box_predictions) 
開發者ID:ambakick,項目名稱:Person-Detection-and-Tracking,代碼行數:18,代碼來源:box_predictor_test.py


注:本文中的object_detection.core.box_predictor.MaskRCNNBoxPredictor方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。