Python object_detection.core.box_predictor.MaskRCNNBoxPredictor() Examples
The following are 30
code examples of object_detection.core.box_predictor.MaskRCNNBoxPredictor().
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example.
You may also want to check out all available functions/classes of the module
object_detection.core.box_predictor
, or try the search function
.
Example #1
Source File: box_predictor_test.py From hands-detection with MIT License | 6 votes |
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())
Example #2
Source File: box_predictor_test.py From object_detector_app with MIT License | 6 votes |
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])
Example #3
Source File: box_predictor_test.py From Gun-Detector with Apache License 2.0 | 6 votes |
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)
Example #4
Source File: box_predictor_test.py From DOTA_models with Apache License 2.0 | 6 votes |
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())
Example #5
Source File: box_predictor_test.py From DOTA_models with Apache License 2.0 | 6 votes |
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])
Example #6
Source File: box_predictor_test.py From MBMD with MIT License | 6 votes |
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())
Example #7
Source File: box_predictor_test.py From object_detector_app with MIT License | 6 votes |
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())
Example #8
Source File: box_predictor_test.py From MBMD with MIT License | 6 votes |
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])
Example #9
Source File: box_predictor_test.py From Gun-Detector with Apache License 2.0 | 6 votes |
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())
Example #10
Source File: box_predictor_test.py From ros_people_object_detection_tensorflow with Apache License 2.0 | 6 votes |
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])
Example #11
Source File: box_predictor_test.py From Person-Detection-and-Tracking with MIT License | 6 votes |
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)
Example #12
Source File: box_predictor_test.py From Gun-Detector with Apache License 2.0 | 6 votes |
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])
Example #13
Source File: box_predictor_test.py From ros_tensorflow with Apache License 2.0 | 6 votes |
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])
Example #14
Source File: box_predictor_test.py From garbage-object-detection-tensorflow with MIT License | 6 votes |
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())
Example #15
Source File: box_predictor_test.py From tensorflow with BSD 2-Clause "Simplified" License | 6 votes |
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])
Example #16
Source File: box_predictor_test.py From garbage-object-detection-tensorflow with MIT License | 6 votes |
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])
Example #17
Source File: box_predictor_test.py From HereIsWally with MIT License | 6 votes |
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])
Example #18
Source File: box_predictor_test.py From HereIsWally with MIT License | 6 votes |
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())
Example #19
Source File: box_predictor_test.py From hands-detection with MIT License | 6 votes |
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])
Example #20
Source File: box_predictor_test.py From yolo_v2 with Apache License 2.0 | 6 votes |
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])
Example #21
Source File: box_predictor_test.py From Hands-On-Machine-Learning-with-OpenCV-4 with MIT License | 6 votes |
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())
Example #22
Source File: box_predictor_test.py From yolo_v2 with Apache License 2.0 | 6 votes |
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())
Example #23
Source File: box_predictor_test.py From moveo_ros with MIT License | 6 votes |
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())
Example #24
Source File: box_predictor_test.py From ros_tensorflow with Apache License 2.0 | 6 votes |
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())
Example #25
Source File: box_predictor_test.py From Traffic-Rule-Violation-Detection-System with MIT License | 6 votes |
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])
Example #26
Source File: box_predictor_test.py From moveo_ros with MIT License | 6 votes |
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])
Example #27
Source File: box_predictor_test.py From Traffic-Rule-Violation-Detection-System with MIT License | 6 votes |
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())
Example #28
Source File: box_predictor_test.py From Traffic-Rule-Violation-Detection-System with MIT License | 6 votes |
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)
Example #29
Source File: box_predictor_test.py From ros_tensorflow with Apache License 2.0 | 6 votes |
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)
Example #30
Source File: box_predictor_test.py From Hands-On-Machine-Learning-with-OpenCV-4 with MIT License | 6 votes |
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])