Python object_detection.core.preprocessor.convert_class_logits_to_softmax() Examples

The following are 15 code examples of object_detection.core.preprocessor.convert_class_logits_to_softmax(). 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.preprocessor , or try the search function .
Example #1
Source File: preprocessor_test.py    From vehicle_counting_tensorflow with MIT License 6 votes vote down vote up
def testConvertClassLogitsToSoftmax(self):
    multiclass_scores = tf.constant(
        [[1.0, 0.0], [0.5, 0.5], [1000, 1]], dtype=tf.float32)
    temperature = 2.0

    converted_multiclass_scores = (
        preprocessor.convert_class_logits_to_softmax(
            multiclass_scores=multiclass_scores, temperature=temperature))

    expected_converted_multiclass_scores = [[[0.62245935, 0.37754068],
                                             [0.5, 0.5], [1, 0]]]

    with self.test_session() as sess:
      (converted_multiclass_scores_) = sess.run([converted_multiclass_scores])

      self.assertAllClose(converted_multiclass_scores_,
                          expected_converted_multiclass_scores) 
Example #2
Source File: preprocessor_test.py    From BMW-TensorFlow-Training-GUI with Apache License 2.0 6 votes vote down vote up
def testConvertClassLogitsToSoftmax(self):
    multiclass_scores = tf.constant(
        [[1.0, 0.0], [0.5, 0.5], [1000, 1]], dtype=tf.float32)
    temperature = 2.0

    converted_multiclass_scores = (
        preprocessor.convert_class_logits_to_softmax(
            multiclass_scores=multiclass_scores, temperature=temperature))

    expected_converted_multiclass_scores = [[[0.62245935, 0.37754068],
                                             [0.5, 0.5], [1, 0]]]

    with self.test_session() as sess:
      (converted_multiclass_scores_) = sess.run([converted_multiclass_scores])

      self.assertAllClose(converted_multiclass_scores_,
                          expected_converted_multiclass_scores) 
Example #3
Source File: preprocessor_test.py    From MAX-Object-Detector with Apache License 2.0 6 votes vote down vote up
def testConvertClassLogitsToSoftmax(self):
    multiclass_scores = tf.constant(
        [[1.0, 0.0], [0.5, 0.5], [1000, 1]], dtype=tf.float32)
    temperature = 2.0

    converted_multiclass_scores = (
        preprocessor.convert_class_logits_to_softmax(
            multiclass_scores=multiclass_scores, temperature=temperature))

    expected_converted_multiclass_scores = [[[0.62245935, 0.37754068],
                                             [0.5, 0.5], [1, 0]]]

    with self.test_session() as sess:
      (converted_multiclass_scores_) = sess.run([converted_multiclass_scores])

      self.assertAllClose(converted_multiclass_scores_,
                          expected_converted_multiclass_scores) 
Example #4
Source File: preprocessor_test.py    From Accident-Detection-on-Indian-Roads with GNU Affero General Public License v3.0 6 votes vote down vote up
def testConvertClassLogitsToSoftmax(self):
    multiclass_scores = tf.constant(
        [[1.0, 0.0], [0.5, 0.5], [1000, 1]], dtype=tf.float32)
    temperature = 2.0

    converted_multiclass_scores = (
        preprocessor.convert_class_logits_to_softmax(
            multiclass_scores=multiclass_scores, temperature=temperature))

    expected_converted_multiclass_scores = [[[0.62245935, 0.37754068],
                                             [0.5, 0.5], [1, 0]]]

    with self.test_session() as sess:
      (converted_multiclass_scores_) = sess.run([converted_multiclass_scores])

      self.assertAllClose(converted_multiclass_scores_,
                          expected_converted_multiclass_scores) 
Example #5
Source File: preprocessor_test.py    From g-tensorflow-models with Apache License 2.0 6 votes vote down vote up
def testConvertClassLogitsToSoftmax(self):
    multiclass_scores = tf.constant(
        [[1.0, 0.0], [0.5, 0.5], [1000, 1]], dtype=tf.float32)
    temperature = 2.0

    converted_multiclass_scores = (
        preprocessor.convert_class_logits_to_softmax(
            multiclass_scores=multiclass_scores, temperature=temperature))

    expected_converted_multiclass_scores = [[[0.62245935, 0.37754068],
                                             [0.5, 0.5], [1, 0]]]

    with self.test_session() as sess:
      (converted_multiclass_scores_) = sess.run([converted_multiclass_scores])

      self.assertAllClose(converted_multiclass_scores_,
                          expected_converted_multiclass_scores) 
Example #6
Source File: preprocessor_test.py    From models with Apache License 2.0 6 votes vote down vote up
def testConvertClassLogitsToSoftmax(self):
    def graph_fn():
      multiclass_scores = tf.constant(
          [[1.0, 0.0], [0.5, 0.5], [1000, 1]], dtype=tf.float32)
      temperature = 2.0

      converted_multiclass_scores = (
          preprocessor.convert_class_logits_to_softmax(
              multiclass_scores=multiclass_scores, temperature=temperature))
      return converted_multiclass_scores
    converted_multiclass_scores_ = self.execute_cpu(graph_fn, [])
    expected_converted_multiclass_scores = [[0.62245935, 0.37754068],
                                            [0.5, 0.5],
                                            [1, 0]]
    self.assertAllClose(converted_multiclass_scores_,
                        expected_converted_multiclass_scores) 
Example #7
Source File: preprocessor_test.py    From multilabel-image-classification-tensorflow with MIT License 6 votes vote down vote up
def testConvertClassLogitsToSoftmax(self):
    multiclass_scores = tf.constant(
        [[1.0, 0.0], [0.5, 0.5], [1000, 1]], dtype=tf.float32)
    temperature = 2.0

    converted_multiclass_scores = (
        preprocessor.convert_class_logits_to_softmax(
            multiclass_scores=multiclass_scores, temperature=temperature))

    expected_converted_multiclass_scores = [[[0.62245935, 0.37754068],
                                             [0.5, 0.5], [1, 0]]]

    with self.test_session() as sess:
      (converted_multiclass_scores_) = sess.run([converted_multiclass_scores])

      self.assertAllClose(converted_multiclass_scores_,
                          expected_converted_multiclass_scores) 
Example #8
Source File: preprocessor_builder_test.py    From vehicle_counting_tensorflow with MIT License 5 votes vote down vote up
def test_build_normalize_image_convert_class_logits_to_softmax(self):
    preprocessor_text_proto = """
    convert_class_logits_to_softmax {
        temperature: 2
    }
    """
    preprocessor_proto = preprocessor_pb2.PreprocessingStep()
    text_format.Merge(preprocessor_text_proto, preprocessor_proto)
    function, args = preprocessor_builder.build(preprocessor_proto)
    self.assertEqual(function, preprocessor.convert_class_logits_to_softmax)
    self.assertEqual(args, {'temperature': 2}) 
Example #9
Source File: preprocessor_builder_test.py    From BMW-TensorFlow-Training-GUI with Apache License 2.0 5 votes vote down vote up
def test_build_normalize_image_convert_class_logits_to_softmax(self):
    preprocessor_text_proto = """
    convert_class_logits_to_softmax {
        temperature: 2
    }
    """
    preprocessor_proto = preprocessor_pb2.PreprocessingStep()
    text_format.Merge(preprocessor_text_proto, preprocessor_proto)
    function, args = preprocessor_builder.build(preprocessor_proto)
    self.assertEqual(function, preprocessor.convert_class_logits_to_softmax)
    self.assertEqual(args, {'temperature': 2}) 
Example #10
Source File: preprocessor_builder_test.py    From Live-feed-object-device-identification-using-Tensorflow-and-OpenCV with Apache License 2.0 5 votes vote down vote up
def test_build_normalize_image_convert_class_logits_to_softmax(self):
    preprocessor_text_proto = """
    convert_class_logits_to_softmax {
        temperature: 2
    }
    """
    preprocessor_proto = preprocessor_pb2.PreprocessingStep()
    text_format.Merge(preprocessor_text_proto, preprocessor_proto)
    function, args = preprocessor_builder.build(preprocessor_proto)
    self.assertEqual(function, preprocessor.convert_class_logits_to_softmax)
    self.assertEqual(args, {'temperature': 2}) 
Example #11
Source File: preprocessor_builder_test.py    From Live-feed-object-device-identification-using-Tensorflow-and-OpenCV with Apache License 2.0 5 votes vote down vote up
def test_build_normalize_image_convert_class_logits_to_softmax(self):
    preprocessor_text_proto = """
    convert_class_logits_to_softmax {
        temperature: 2
    }
    """
    preprocessor_proto = preprocessor_pb2.PreprocessingStep()
    text_format.Merge(preprocessor_text_proto, preprocessor_proto)
    function, args = preprocessor_builder.build(preprocessor_proto)
    self.assertEqual(function, preprocessor.convert_class_logits_to_softmax)
    self.assertEqual(args, {'temperature': 2}) 
Example #12
Source File: preprocessor_builder_test.py    From MAX-Object-Detector with Apache License 2.0 5 votes vote down vote up
def test_build_normalize_image_convert_class_logits_to_softmax(self):
    preprocessor_text_proto = """
    convert_class_logits_to_softmax {
        temperature: 2
    }
    """
    preprocessor_proto = preprocessor_pb2.PreprocessingStep()
    text_format.Merge(preprocessor_text_proto, preprocessor_proto)
    function, args = preprocessor_builder.build(preprocessor_proto)
    self.assertEqual(function, preprocessor.convert_class_logits_to_softmax)
    self.assertEqual(args, {'temperature': 2}) 
Example #13
Source File: preprocessor_builder_test.py    From g-tensorflow-models with Apache License 2.0 5 votes vote down vote up
def test_build_normalize_image_convert_class_logits_to_softmax(self):
    preprocessor_text_proto = """
    convert_class_logits_to_softmax {
        temperature: 2
    }
    """
    preprocessor_proto = preprocessor_pb2.PreprocessingStep()
    text_format.Merge(preprocessor_text_proto, preprocessor_proto)
    function, args = preprocessor_builder.build(preprocessor_proto)
    self.assertEqual(function, preprocessor.convert_class_logits_to_softmax)
    self.assertEqual(args, {'temperature': 2}) 
Example #14
Source File: preprocessor_builder_test.py    From models with Apache License 2.0 5 votes vote down vote up
def test_build_normalize_image_convert_class_logits_to_softmax(self):
    preprocessor_text_proto = """
    convert_class_logits_to_softmax {
        temperature: 2
    }
    """
    preprocessor_proto = preprocessor_pb2.PreprocessingStep()
    text_format.Merge(preprocessor_text_proto, preprocessor_proto)
    function, args = preprocessor_builder.build(preprocessor_proto)
    self.assertEqual(function, preprocessor.convert_class_logits_to_softmax)
    self.assertEqual(args, {'temperature': 2}) 
Example #15
Source File: preprocessor_builder_test.py    From multilabel-image-classification-tensorflow with MIT License 5 votes vote down vote up
def test_build_normalize_image_convert_class_logits_to_softmax(self):
    preprocessor_text_proto = """
    convert_class_logits_to_softmax {
        temperature: 2
    }
    """
    preprocessor_proto = preprocessor_pb2.PreprocessingStep()
    text_format.Merge(preprocessor_text_proto, preprocessor_proto)
    function, args = preprocessor_builder.build(preprocessor_proto)
    self.assertEqual(function, preprocessor.convert_class_logits_to_softmax)
    self.assertEqual(args, {'temperature': 2})