Python metrics.sequence_accuracy() Examples

The following are 18 code examples of metrics.sequence_accuracy(). 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 metrics , or try the search function .
Example #1
Source File: metrics_test.py    From object_detection_kitti with Apache License 2.0 5 votes vote down vote up
def test_sequence_accuracy_one_char_difference(self):
    ground_truth_np = self._fake_labels()
    ground_truth_tf = tf.convert_to_tensor(ground_truth_np)
    prediction_tf = tf.convert_to_tensor(
        self._incorrect_copy(ground_truth_np, bad_indexes=((0, 0))))

    accuracy_tf = metrics.sequence_accuracy(prediction_tf, ground_truth_tf,
                                            self.rej_char)
    with self.initialized_session() as sess:
      accuracy_np = sess.run(accuracy_tf)

    # 1 of 4 sequences is incorrect.
    self.assertAlmostEqual(accuracy_np, 1.0 - 1.0 / self.batch_size) 
Example #2
Source File: metrics_test.py    From multilabel-image-classification-tensorflow with MIT License 5 votes vote down vote up
def test_sequence_accuracy_one_char_difference(self):
    ground_truth_np = self._fake_labels()
    ground_truth_tf = tf.convert_to_tensor(ground_truth_np)
    prediction_tf = tf.convert_to_tensor(
        self._incorrect_copy(ground_truth_np, bad_indexes=((0, 0))))

    accuracy_tf = metrics.sequence_accuracy(prediction_tf, ground_truth_tf,
                                            self.rej_char)
    with self.initialized_session() as sess:
      accuracy_np = sess.run(accuracy_tf)

    # 1 of 4 sequences is incorrect.
    self.assertAlmostEqual(accuracy_np, 1.0 - 1.0 / self.batch_size) 
Example #3
Source File: metrics_test.py    From multilabel-image-classification-tensorflow with MIT License 5 votes vote down vote up
def test_sequence_accuracy_identical_samples(self):
    labels_tf = tf.convert_to_tensor(self._fake_labels())

    accuracy_tf = metrics.sequence_accuracy(labels_tf, labels_tf,
                                            self.rej_char)
    with self.initialized_session() as sess:
      accuracy_np = sess.run(accuracy_tf)

    self.assertAlmostEqual(accuracy_np, 1.0) 
Example #4
Source File: metrics_test.py    From models with Apache License 2.0 5 votes vote down vote up
def test_sequence_accuracy_one_char_difference(self):
    ground_truth_np = self._fake_labels()
    ground_truth_tf = tf.convert_to_tensor(ground_truth_np)
    prediction_tf = tf.convert_to_tensor(
        self._incorrect_copy(ground_truth_np, bad_indexes=((0, 0))))

    accuracy_tf = metrics.sequence_accuracy(prediction_tf, ground_truth_tf,
                                            self.rej_char)
    with self.initialized_session() as sess:
      accuracy_np = sess.run(accuracy_tf)

    # 1 of 4 sequences is incorrect.
    self.assertAlmostEqual(accuracy_np, 1.0 - 1.0 / self.batch_size) 
Example #5
Source File: metrics_test.py    From models with Apache License 2.0 5 votes vote down vote up
def test_sequence_accuracy_identical_samples(self):
    labels_tf = tf.convert_to_tensor(self._fake_labels())

    accuracy_tf = metrics.sequence_accuracy(labels_tf, labels_tf,
                                            self.rej_char)
    with self.initialized_session() as sess:
      accuracy_np = sess.run(accuracy_tf)

    self.assertAlmostEqual(accuracy_np, 1.0) 
Example #6
Source File: metrics_test.py    From g-tensorflow-models with Apache License 2.0 5 votes vote down vote up
def test_sequence_accuracy_one_char_difference(self):
    ground_truth_np = self._fake_labels()
    ground_truth_tf = tf.convert_to_tensor(ground_truth_np)
    prediction_tf = tf.convert_to_tensor(
        self._incorrect_copy(ground_truth_np, bad_indexes=((0, 0))))

    accuracy_tf = metrics.sequence_accuracy(prediction_tf, ground_truth_tf,
                                            self.rej_char)
    with self.initialized_session() as sess:
      accuracy_np = sess.run(accuracy_tf)

    # 1 of 4 sequences is incorrect.
    self.assertAlmostEqual(accuracy_np, 1.0 - 1.0 / self.batch_size) 
Example #7
Source File: metrics_test.py    From g-tensorflow-models with Apache License 2.0 5 votes vote down vote up
def test_sequence_accuracy_identical_samples(self):
    labels_tf = tf.convert_to_tensor(self._fake_labels())

    accuracy_tf = metrics.sequence_accuracy(labels_tf, labels_tf,
                                            self.rej_char)
    with self.initialized_session() as sess:
      accuracy_np = sess.run(accuracy_tf)

    self.assertAlmostEqual(accuracy_np, 1.0) 
Example #8
Source File: metrics_test.py    From object_detection_with_tensorflow with MIT License 5 votes vote down vote up
def test_sequence_accuracy_one_char_difference(self):
    ground_truth_np = self._fake_labels()
    ground_truth_tf = tf.convert_to_tensor(ground_truth_np)
    prediction_tf = tf.convert_to_tensor(
        self._incorrect_copy(ground_truth_np, bad_indexes=((0, 0))))

    accuracy_tf = metrics.sequence_accuracy(prediction_tf, ground_truth_tf,
                                            self.rej_char)
    with self.initialized_session() as sess:
      accuracy_np = sess.run(accuracy_tf)

    # 1 of 4 sequences is incorrect.
    self.assertAlmostEqual(accuracy_np, 1.0 - 1.0 / self.batch_size) 
Example #9
Source File: metrics_test.py    From object_detection_with_tensorflow with MIT License 5 votes vote down vote up
def test_sequence_accuracy_identical_samples(self):
    labels_tf = tf.convert_to_tensor(self._fake_labels())

    accuracy_tf = metrics.sequence_accuracy(labels_tf, labels_tf,
                                            self.rej_char)
    with self.initialized_session() as sess:
      accuracy_np = sess.run(accuracy_tf)

    self.assertAlmostEqual(accuracy_np, 1.0) 
Example #10
Source File: metrics_test.py    From DOTA_models with Apache License 2.0 5 votes vote down vote up
def test_sequence_accuracy_identical_samples(self):
    labels_tf = tf.convert_to_tensor(self._fake_labels())

    accuracy_tf = metrics.sequence_accuracy(labels_tf, labels_tf,
                                            self.rej_char)
    with self.initialized_session() as sess:
      accuracy_np = sess.run(accuracy_tf)

    self.assertAlmostEqual(accuracy_np, 1.0) 
Example #11
Source File: metrics_test.py    From object_detection_kitti with Apache License 2.0 5 votes vote down vote up
def test_sequence_accuracy_identical_samples(self):
    labels_tf = tf.convert_to_tensor(self._fake_labels())

    accuracy_tf = metrics.sequence_accuracy(labels_tf, labels_tf,
                                            self.rej_char)
    with self.initialized_session() as sess:
      accuracy_np = sess.run(accuracy_tf)

    self.assertAlmostEqual(accuracy_np, 1.0) 
Example #12
Source File: metrics_test.py    From hands-detection with MIT License 5 votes vote down vote up
def test_sequence_accuracy_one_char_difference(self):
    ground_truth_np = self._fake_labels()
    ground_truth_tf = tf.convert_to_tensor(ground_truth_np)
    prediction_tf = tf.convert_to_tensor(
        self._incorrect_copy(ground_truth_np, bad_indexes=((0, 0))))

    accuracy_tf = metrics.sequence_accuracy(prediction_tf, ground_truth_tf,
                                            self.rej_char)
    with self.initialized_session() as sess:
      accuracy_np = sess.run(accuracy_tf)

    # 1 of 4 sequences is incorrect.
    self.assertAlmostEqual(accuracy_np, 1.0 - 1.0 / self.batch_size) 
Example #13
Source File: metrics_test.py    From hands-detection with MIT License 5 votes vote down vote up
def test_sequence_accuracy_identical_samples(self):
    labels_tf = tf.convert_to_tensor(self._fake_labels())

    accuracy_tf = metrics.sequence_accuracy(labels_tf, labels_tf,
                                            self.rej_char)
    with self.initialized_session() as sess:
      accuracy_np = sess.run(accuracy_tf)

    self.assertAlmostEqual(accuracy_np, 1.0) 
Example #14
Source File: metrics_test.py    From Gun-Detector with Apache License 2.0 5 votes vote down vote up
def test_sequence_accuracy_one_char_difference(self):
    ground_truth_np = self._fake_labels()
    ground_truth_tf = tf.convert_to_tensor(ground_truth_np)
    prediction_tf = tf.convert_to_tensor(
        self._incorrect_copy(ground_truth_np, bad_indexes=((0, 0))))

    accuracy_tf = metrics.sequence_accuracy(prediction_tf, ground_truth_tf,
                                            self.rej_char)
    with self.initialized_session() as sess:
      accuracy_np = sess.run(accuracy_tf)

    # 1 of 4 sequences is incorrect.
    self.assertAlmostEqual(accuracy_np, 1.0 - 1.0 / self.batch_size) 
Example #15
Source File: metrics_test.py    From Gun-Detector with Apache License 2.0 5 votes vote down vote up
def test_sequence_accuracy_identical_samples(self):
    labels_tf = tf.convert_to_tensor(self._fake_labels())

    accuracy_tf = metrics.sequence_accuracy(labels_tf, labels_tf,
                                            self.rej_char)
    with self.initialized_session() as sess:
      accuracy_np = sess.run(accuracy_tf)

    self.assertAlmostEqual(accuracy_np, 1.0) 
Example #16
Source File: metrics_test.py    From yolo_v2 with Apache License 2.0 5 votes vote down vote up
def test_sequence_accuracy_one_char_difference(self):
    ground_truth_np = self._fake_labels()
    ground_truth_tf = tf.convert_to_tensor(ground_truth_np)
    prediction_tf = tf.convert_to_tensor(
        self._incorrect_copy(ground_truth_np, bad_indexes=((0, 0))))

    accuracy_tf = metrics.sequence_accuracy(prediction_tf, ground_truth_tf,
                                            self.rej_char)
    with self.initialized_session() as sess:
      accuracy_np = sess.run(accuracy_tf)

    # 1 of 4 sequences is incorrect.
    self.assertAlmostEqual(accuracy_np, 1.0 - 1.0 / self.batch_size) 
Example #17
Source File: metrics_test.py    From yolo_v2 with Apache License 2.0 5 votes vote down vote up
def test_sequence_accuracy_identical_samples(self):
    labels_tf = tf.convert_to_tensor(self._fake_labels())

    accuracy_tf = metrics.sequence_accuracy(labels_tf, labels_tf,
                                            self.rej_char)
    with self.initialized_session() as sess:
      accuracy_np = sess.run(accuracy_tf)

    self.assertAlmostEqual(accuracy_np, 1.0) 
Example #18
Source File: metrics_test.py    From DOTA_models with Apache License 2.0 5 votes vote down vote up
def test_sequence_accuracy_one_char_difference(self):
    ground_truth_np = self._fake_labels()
    ground_truth_tf = tf.convert_to_tensor(ground_truth_np)
    prediction_tf = tf.convert_to_tensor(
        self._incorrect_copy(ground_truth_np, bad_indexes=((0, 0))))

    accuracy_tf = metrics.sequence_accuracy(prediction_tf, ground_truth_tf,
                                            self.rej_char)
    with self.initialized_session() as sess:
      accuracy_np = sess.run(accuracy_tf)

    # 1 of 4 sequences is incorrect.
    self.assertAlmostEqual(accuracy_np, 1.0 - 1.0 / self.batch_size)