Python object_detection.utils.ops.retain_groundtruth() Examples
The following are 30
code examples of object_detection.utils.ops.retain_groundtruth().
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.utils.ops
, or try the search function
.
Example #1
Source File: ops_test.py From monopsr with MIT License | 5 votes |
def test_filter_with_missing_fields(self): input_boxes = tf.placeholder(tf.float32, shape=(None, 4)) input_classes = tf.placeholder(tf.int32, shape=(None,)) input_tensors = { fields.InputDataFields.groundtruth_boxes: input_boxes, fields.InputDataFields.groundtruth_classes: input_classes } valid_indices = tf.placeholder(tf.int32, shape=(None,)) feed_dict = { input_boxes: np.array([[0.2, 0.4, 0.1, 0.8], [0.2, 0.4, 1.0, 0.8]], dtype=np.float), input_classes: np.array([1, 2], dtype=np.int32), valid_indices: np.array([0], dtype=np.int32) } expected_tensors = { fields.InputDataFields.groundtruth_boxes: [[0.2, 0.4, 0.1, 0.8]], fields.InputDataFields.groundtruth_classes: [1] } output_tensors = ops.retain_groundtruth(input_tensors, valid_indices) with self.test_session() as sess: output_tensors = sess.run(output_tensors, feed_dict=feed_dict) for key in [fields.InputDataFields.groundtruth_boxes]: self.assertAllClose(expected_tensors[key], output_tensors[key]) for key in [fields.InputDataFields.groundtruth_classes]: self.assertAllEqual(expected_tensors[key], output_tensors[key])
Example #2
Source File: ops_test.py From Person-Detection-and-Tracking with MIT License | 5 votes |
def test_filter_with_missing_fields(self): input_boxes = tf.placeholder(tf.float32, shape=(None, 4)) input_classes = tf.placeholder(tf.int32, shape=(None,)) input_tensors = { fields.InputDataFields.groundtruth_boxes: input_boxes, fields.InputDataFields.groundtruth_classes: input_classes } valid_indices = tf.placeholder(tf.int32, shape=(None,)) feed_dict = { input_boxes: np.array([[0.2, 0.4, 0.1, 0.8], [0.2, 0.4, 1.0, 0.8]], dtype=np.float), input_classes: np.array([1, 2], dtype=np.int32), valid_indices: np.array([0], dtype=np.int32) } expected_tensors = { fields.InputDataFields.groundtruth_boxes: [[0.2, 0.4, 0.1, 0.8]], fields.InputDataFields.groundtruth_classes: [1] } output_tensors = ops.retain_groundtruth(input_tensors, valid_indices) with self.test_session() as sess: output_tensors = sess.run(output_tensors, feed_dict=feed_dict) for key in [fields.InputDataFields.groundtruth_boxes]: self.assertAllClose(expected_tensors[key], output_tensors[key]) for key in [fields.InputDataFields.groundtruth_classes]: self.assertAllEqual(expected_tensors[key], output_tensors[key])
Example #3
Source File: ops_test.py From ros_people_object_detection_tensorflow with Apache License 2.0 | 5 votes |
def test_filter_with_empty_groundtruth_boxes(self): input_boxes = tf.placeholder(tf.float32, shape=(None, 4)) input_classes = tf.placeholder(tf.int32, shape=(None,)) input_is_crowd = tf.placeholder(tf.bool, shape=(None,)) input_area = tf.placeholder(tf.float32, shape=(None,)) input_difficult = tf.placeholder(tf.float32, shape=(None,)) valid_indices = tf.placeholder(tf.int32, shape=(None,)) input_tensors = { fields.InputDataFields.groundtruth_boxes: input_boxes, fields.InputDataFields.groundtruth_classes: input_classes, fields.InputDataFields.groundtruth_is_crowd: input_is_crowd, fields.InputDataFields.groundtruth_area: input_area, fields.InputDataFields.groundtruth_difficult: input_difficult } output_tensors = ops.retain_groundtruth(input_tensors, valid_indices) feed_dict = { input_boxes: np.array([], dtype=np.float).reshape(0, 4), input_classes: np.array([], dtype=np.int32), input_is_crowd: np.array([], dtype=np.bool), input_area: np.array([], dtype=np.float32), input_difficult: np.array([], dtype=np.float32), valid_indices: np.array([], dtype=np.int32) } with self.test_session() as sess: output_tensors = sess.run(output_tensors, feed_dict=feed_dict) for key in input_tensors: if key == fields.InputDataFields.groundtruth_boxes: self.assertAllEqual([0, 4], output_tensors[key].shape) else: self.assertAllEqual([0], output_tensors[key].shape)
Example #4
Source File: ops_test.py From Hands-On-Machine-Learning-with-OpenCV-4 with MIT License | 5 votes |
def test_filter_with_empty_groundtruth_boxes(self): input_boxes = tf.placeholder(tf.float32, shape=(None, 4)) input_classes = tf.placeholder(tf.int32, shape=(None,)) input_is_crowd = tf.placeholder(tf.bool, shape=(None,)) input_area = tf.placeholder(tf.float32, shape=(None,)) input_difficult = tf.placeholder(tf.float32, shape=(None,)) valid_indices = tf.placeholder(tf.int32, shape=(None,)) input_tensors = { fields.InputDataFields.groundtruth_boxes: input_boxes, fields.InputDataFields.groundtruth_classes: input_classes, fields.InputDataFields.groundtruth_is_crowd: input_is_crowd, fields.InputDataFields.groundtruth_area: input_area, fields.InputDataFields.groundtruth_difficult: input_difficult } output_tensors = ops.retain_groundtruth(input_tensors, valid_indices) feed_dict = { input_boxes: np.array([], dtype=np.float).reshape(0, 4), input_classes: np.array([], dtype=np.int32), input_is_crowd: np.array([], dtype=np.bool), input_area: np.array([], dtype=np.float32), input_difficult: np.array([], dtype=np.float32), valid_indices: np.array([], dtype=np.int32) } with self.test_session() as sess: output_tensors = sess.run(output_tensors, feed_dict=feed_dict) for key in input_tensors: if key == fields.InputDataFields.groundtruth_boxes: self.assertAllEqual([0, 4], output_tensors[key].shape) else: self.assertAllEqual([0], output_tensors[key].shape)
Example #5
Source File: ops_test.py From AniSeg with Apache License 2.0 | 5 votes |
def test_filter_with_missing_fields(self): input_boxes = tf.placeholder(tf.float32, shape=(None, 4)) input_classes = tf.placeholder(tf.int32, shape=(None,)) input_tensors = { fields.InputDataFields.groundtruth_boxes: input_boxes, fields.InputDataFields.groundtruth_classes: input_classes } valid_indices = tf.placeholder(tf.int32, shape=(None,)) feed_dict = { input_boxes: np.array([[0.2, 0.4, 0.1, 0.8], [0.2, 0.4, 1.0, 0.8]], dtype=np.float), input_classes: np.array([1, 2], dtype=np.int32), valid_indices: np.array([0], dtype=np.int32) } expected_tensors = { fields.InputDataFields.groundtruth_boxes: [[0.2, 0.4, 0.1, 0.8]], fields.InputDataFields.groundtruth_classes: [1] } output_tensors = ops.retain_groundtruth(input_tensors, valid_indices) with self.test_session() as sess: output_tensors = sess.run(output_tensors, feed_dict=feed_dict) for key in [fields.InputDataFields.groundtruth_boxes]: self.assertAllClose(expected_tensors[key], output_tensors[key]) for key in [fields.InputDataFields.groundtruth_classes]: self.assertAllEqual(expected_tensors[key], output_tensors[key])
Example #6
Source File: ops_test.py From tensorflow with BSD 2-Clause "Simplified" License | 5 votes |
def test_filter_with_empty_groundtruth_boxes(self): input_boxes = tf.placeholder(tf.float32, shape=(None, 4)) input_classes = tf.placeholder(tf.int32, shape=(None,)) input_is_crowd = tf.placeholder(tf.bool, shape=(None,)) input_area = tf.placeholder(tf.float32, shape=(None,)) input_difficult = tf.placeholder(tf.float32, shape=(None,)) valid_indices = tf.placeholder(tf.int32, shape=(None,)) input_tensors = { fields.InputDataFields.groundtruth_boxes: input_boxes, fields.InputDataFields.groundtruth_classes: input_classes, fields.InputDataFields.groundtruth_is_crowd: input_is_crowd, fields.InputDataFields.groundtruth_area: input_area, fields.InputDataFields.groundtruth_difficult: input_difficult } output_tensors = ops.retain_groundtruth(input_tensors, valid_indices) feed_dict = { input_boxes: np.array([], dtype=np.float).reshape(0, 4), input_classes: np.array([], dtype=np.int32), input_is_crowd: np.array([], dtype=np.bool), input_area: np.array([], dtype=np.float32), input_difficult: np.array([], dtype=np.float32), valid_indices: np.array([], dtype=np.int32) } with self.test_session() as sess: output_tensors = sess.run(output_tensors, feed_dict=feed_dict) for key in input_tensors: if key == fields.InputDataFields.groundtruth_boxes: self.assertAllEqual([0, 4], output_tensors[key].shape) else: self.assertAllEqual([0], output_tensors[key].shape)
Example #7
Source File: ops_test.py From Gun-Detector with Apache License 2.0 | 5 votes |
def test_filter_with_missing_fields(self): input_boxes = tf.placeholder(tf.float32, shape=(None, 4)) input_classes = tf.placeholder(tf.int32, shape=(None,)) input_tensors = { fields.InputDataFields.groundtruth_boxes: input_boxes, fields.InputDataFields.groundtruth_classes: input_classes } valid_indices = tf.placeholder(tf.int32, shape=(None,)) feed_dict = { input_boxes: np.array([[0.2, 0.4, 0.1, 0.8], [0.2, 0.4, 1.0, 0.8]], dtype=np.float), input_classes: np.array([1, 2], dtype=np.int32), valid_indices: np.array([0], dtype=np.int32) } expected_tensors = { fields.InputDataFields.groundtruth_boxes: [[0.2, 0.4, 0.1, 0.8]], fields.InputDataFields.groundtruth_classes: [1] } output_tensors = ops.retain_groundtruth(input_tensors, valid_indices) with self.test_session() as sess: output_tensors = sess.run(output_tensors, feed_dict=feed_dict) for key in [fields.InputDataFields.groundtruth_boxes]: self.assertAllClose(expected_tensors[key], output_tensors[key]) for key in [fields.InputDataFields.groundtruth_classes]: self.assertAllEqual(expected_tensors[key], output_tensors[key])
Example #8
Source File: ops_test.py From monopsr with MIT License | 5 votes |
def test_filter_with_empty_groundtruth_boxes(self): input_boxes = tf.placeholder(tf.float32, shape=(None, 4)) input_classes = tf.placeholder(tf.int32, shape=(None,)) input_is_crowd = tf.placeholder(tf.bool, shape=(None,)) input_area = tf.placeholder(tf.float32, shape=(None,)) input_difficult = tf.placeholder(tf.float32, shape=(None,)) valid_indices = tf.placeholder(tf.int32, shape=(None,)) input_tensors = { fields.InputDataFields.groundtruth_boxes: input_boxes, fields.InputDataFields.groundtruth_classes: input_classes, fields.InputDataFields.groundtruth_is_crowd: input_is_crowd, fields.InputDataFields.groundtruth_area: input_area, fields.InputDataFields.groundtruth_difficult: input_difficult } output_tensors = ops.retain_groundtruth(input_tensors, valid_indices) feed_dict = { input_boxes: np.array([], dtype=np.float).reshape(0, 4), input_classes: np.array([], dtype=np.int32), input_is_crowd: np.array([], dtype=np.bool), input_area: np.array([], dtype=np.float32), input_difficult: np.array([], dtype=np.float32), valid_indices: np.array([], dtype=np.int32) } with self.test_session() as sess: output_tensors = sess.run(output_tensors, feed_dict=feed_dict) for key in input_tensors: if key == fields.InputDataFields.groundtruth_boxes: self.assertAllEqual([0, 4], output_tensors[key].shape) else: self.assertAllEqual([0], output_tensors[key].shape)
Example #9
Source File: ops_test.py From Gun-Detector with Apache License 2.0 | 5 votes |
def test_filter_with_empty_groundtruth_boxes(self): input_boxes = tf.placeholder(tf.float32, shape=(None, 4)) input_classes = tf.placeholder(tf.int32, shape=(None,)) input_is_crowd = tf.placeholder(tf.bool, shape=(None,)) input_area = tf.placeholder(tf.float32, shape=(None,)) input_difficult = tf.placeholder(tf.float32, shape=(None,)) valid_indices = tf.placeholder(tf.int32, shape=(None,)) input_tensors = { fields.InputDataFields.groundtruth_boxes: input_boxes, fields.InputDataFields.groundtruth_classes: input_classes, fields.InputDataFields.groundtruth_is_crowd: input_is_crowd, fields.InputDataFields.groundtruth_area: input_area, fields.InputDataFields.groundtruth_difficult: input_difficult } output_tensors = ops.retain_groundtruth(input_tensors, valid_indices) feed_dict = { input_boxes: np.array([], dtype=np.float).reshape(0, 4), input_classes: np.array([], dtype=np.int32), input_is_crowd: np.array([], dtype=np.bool), input_area: np.array([], dtype=np.float32), input_difficult: np.array([], dtype=np.float32), valid_indices: np.array([], dtype=np.int32) } with self.test_session() as sess: output_tensors = sess.run(output_tensors, feed_dict=feed_dict) for key in input_tensors: if key == fields.InputDataFields.groundtruth_boxes: self.assertAllEqual([0, 4], output_tensors[key].shape) else: self.assertAllEqual([0], output_tensors[key].shape)
Example #10
Source File: ops_test.py From ros_tensorflow with Apache License 2.0 | 5 votes |
def test_filter_with_missing_fields(self): input_boxes = tf.placeholder(tf.float32, shape=(None, 4)) input_classes = tf.placeholder(tf.int32, shape=(None,)) input_tensors = { fields.InputDataFields.groundtruth_boxes: input_boxes, fields.InputDataFields.groundtruth_classes: input_classes } valid_indices = tf.placeholder(tf.int32, shape=(None,)) feed_dict = { input_boxes: np.array([[0.2, 0.4, 0.1, 0.8], [0.2, 0.4, 1.0, 0.8]], dtype=np.float), input_classes: np.array([1, 2], dtype=np.int32), valid_indices: np.array([0], dtype=np.int32) } expected_tensors = { fields.InputDataFields.groundtruth_boxes: [[0.2, 0.4, 0.1, 0.8]], fields.InputDataFields.groundtruth_classes: [1] } output_tensors = ops.retain_groundtruth(input_tensors, valid_indices) with self.test_session() as sess: output_tensors = sess.run(output_tensors, feed_dict=feed_dict) for key in [fields.InputDataFields.groundtruth_boxes]: self.assertAllClose(expected_tensors[key], output_tensors[key]) for key in [fields.InputDataFields.groundtruth_classes]: self.assertAllEqual(expected_tensors[key], output_tensors[key])
Example #11
Source File: ops_test.py From ros_tensorflow with Apache License 2.0 | 5 votes |
def test_filter_with_empty_groundtruth_boxes(self): input_boxes = tf.placeholder(tf.float32, shape=(None, 4)) input_classes = tf.placeholder(tf.int32, shape=(None,)) input_is_crowd = tf.placeholder(tf.bool, shape=(None,)) input_area = tf.placeholder(tf.float32, shape=(None,)) input_difficult = tf.placeholder(tf.float32, shape=(None,)) valid_indices = tf.placeholder(tf.int32, shape=(None,)) input_tensors = { fields.InputDataFields.groundtruth_boxes: input_boxes, fields.InputDataFields.groundtruth_classes: input_classes, fields.InputDataFields.groundtruth_is_crowd: input_is_crowd, fields.InputDataFields.groundtruth_area: input_area, fields.InputDataFields.groundtruth_difficult: input_difficult } output_tensors = ops.retain_groundtruth(input_tensors, valid_indices) feed_dict = { input_boxes: np.array([], dtype=np.float).reshape(0, 4), input_classes: np.array([], dtype=np.int32), input_is_crowd: np.array([], dtype=np.bool), input_area: np.array([], dtype=np.float32), input_difficult: np.array([], dtype=np.float32), valid_indices: np.array([], dtype=np.int32) } with self.test_session() as sess: output_tensors = sess.run(output_tensors, feed_dict=feed_dict) for key in input_tensors: if key == fields.InputDataFields.groundtruth_boxes: self.assertAllEqual([0, 4], output_tensors[key].shape) else: self.assertAllEqual([0], output_tensors[key].shape)
Example #12
Source File: ops_test.py From BMW-TensorFlow-Training-GUI with Apache License 2.0 | 5 votes |
def test_filter_with_missing_fields(self): input_boxes = tf.placeholder(tf.float32, shape=(None, 4)) input_classes = tf.placeholder(tf.int32, shape=(None,)) input_tensors = { fields.InputDataFields.groundtruth_boxes: input_boxes, fields.InputDataFields.groundtruth_classes: input_classes } valid_indices = tf.placeholder(tf.int32, shape=(None,)) feed_dict = { input_boxes: np.array([[0.2, 0.4, 0.1, 0.8], [0.2, 0.4, 1.0, 0.8]], dtype=np.float), input_classes: np.array([1, 2], dtype=np.int32), valid_indices: np.array([0], dtype=np.int32) } expected_tensors = { fields.InputDataFields.groundtruth_boxes: [[0.2, 0.4, 0.1, 0.8]], fields.InputDataFields.groundtruth_classes: [1] } output_tensors = ops.retain_groundtruth(input_tensors, valid_indices) with self.test_session() as sess: output_tensors = sess.run(output_tensors, feed_dict=feed_dict) for key in [fields.InputDataFields.groundtruth_boxes]: self.assertAllClose(expected_tensors[key], output_tensors[key]) for key in [fields.InputDataFields.groundtruth_classes]: self.assertAllEqual(expected_tensors[key], output_tensors[key])
Example #13
Source File: ops_test.py From DOTA_models with Apache License 2.0 | 5 votes |
def test_filter_with_missing_fields(self): input_boxes = tf.placeholder(tf.float32, shape=(None, 4)) input_classes = tf.placeholder(tf.int32, shape=(None,)) input_tensors = { fields.InputDataFields.groundtruth_boxes: input_boxes, fields.InputDataFields.groundtruth_classes: input_classes } valid_indices = tf.placeholder(tf.int32, shape=(None,)) feed_dict = { input_boxes: np.array([[0.2, 0.4, 0.1, 0.8], [0.2, 0.4, 1.0, 0.8]], dtype=np.float), input_classes: np.array([1, 2], dtype=np.int32), valid_indices: np.array([0], dtype=np.int32) } expected_tensors = { fields.InputDataFields.groundtruth_boxes: [[0.2, 0.4, 0.1, 0.8]], fields.InputDataFields.groundtruth_classes: [1] } output_tensors = ops.retain_groundtruth(input_tensors, valid_indices) with self.test_session() as sess: output_tensors = sess.run(output_tensors, feed_dict=feed_dict) for key in [fields.InputDataFields.groundtruth_boxes]: self.assertAllClose(expected_tensors[key], output_tensors[key]) for key in [fields.InputDataFields.groundtruth_classes]: self.assertAllEqual(expected_tensors[key], output_tensors[key])
Example #14
Source File: ops_test.py From BMW-TensorFlow-Training-GUI with Apache License 2.0 | 5 votes |
def test_filter_with_empty_groundtruth_boxes(self): input_boxes = tf.placeholder(tf.float32, shape=(None, 4)) input_classes = tf.placeholder(tf.int32, shape=(None,)) input_is_crowd = tf.placeholder(tf.bool, shape=(None,)) input_area = tf.placeholder(tf.float32, shape=(None,)) input_difficult = tf.placeholder(tf.float32, shape=(None,)) valid_indices = tf.placeholder(tf.int32, shape=(None,)) input_tensors = { fields.InputDataFields.groundtruth_boxes: input_boxes, fields.InputDataFields.groundtruth_classes: input_classes, fields.InputDataFields.groundtruth_is_crowd: input_is_crowd, fields.InputDataFields.groundtruth_area: input_area, fields.InputDataFields.groundtruth_difficult: input_difficult } output_tensors = ops.retain_groundtruth(input_tensors, valid_indices) feed_dict = { input_boxes: np.array([], dtype=np.float).reshape(0, 4), input_classes: np.array([], dtype=np.int32), input_is_crowd: np.array([], dtype=np.bool), input_area: np.array([], dtype=np.float32), input_difficult: np.array([], dtype=np.float32), valid_indices: np.array([], dtype=np.int32) } with self.test_session() as sess: output_tensors = sess.run(output_tensors, feed_dict=feed_dict) for key in input_tensors: if key == fields.InputDataFields.groundtruth_boxes: self.assertAllEqual([0, 4], output_tensors[key].shape) else: self.assertAllEqual([0], output_tensors[key].shape)
Example #15
Source File: ops_test.py From moveo_ros with MIT License | 5 votes |
def test_filter_with_missing_fields(self): input_boxes = tf.placeholder(tf.float32, shape=(None, 4)) input_classes = tf.placeholder(tf.int32, shape=(None,)) input_tensors = { fields.InputDataFields.groundtruth_boxes: input_boxes, fields.InputDataFields.groundtruth_classes: input_classes } valid_indices = tf.placeholder(tf.int32, shape=(None,)) feed_dict = { input_boxes: np.array([[0.2, 0.4, 0.1, 0.8], [0.2, 0.4, 1.0, 0.8]], dtype=np.float), input_classes: np.array([1, 2], dtype=np.int32), valid_indices: np.array([0], dtype=np.int32) } expected_tensors = { fields.InputDataFields.groundtruth_boxes: [[0.2, 0.4, 0.1, 0.8]], fields.InputDataFields.groundtruth_classes: [1] } output_tensors = ops.retain_groundtruth(input_tensors, valid_indices) with self.test_session() as sess: output_tensors = sess.run(output_tensors, feed_dict=feed_dict) for key in [fields.InputDataFields.groundtruth_boxes]: self.assertAllClose(expected_tensors[key], output_tensors[key]) for key in [fields.InputDataFields.groundtruth_classes]: self.assertAllEqual(expected_tensors[key], output_tensors[key])
Example #16
Source File: ops_test.py From tensorflow with BSD 2-Clause "Simplified" License | 5 votes |
def test_filter_with_missing_fields(self): input_boxes = tf.placeholder(tf.float32, shape=(None, 4)) input_classes = tf.placeholder(tf.int32, shape=(None,)) input_tensors = { fields.InputDataFields.groundtruth_boxes: input_boxes, fields.InputDataFields.groundtruth_classes: input_classes } valid_indices = tf.placeholder(tf.int32, shape=(None,)) feed_dict = { input_boxes: np.array([[0.2, 0.4, 0.1, 0.8], [0.2, 0.4, 1.0, 0.8]], dtype=np.float), input_classes: np.array([1, 2], dtype=np.int32), valid_indices: np.array([0], dtype=np.int32) } expected_tensors = { fields.InputDataFields.groundtruth_boxes: [[0.2, 0.4, 0.1, 0.8]], fields.InputDataFields.groundtruth_classes: [1] } output_tensors = ops.retain_groundtruth(input_tensors, valid_indices) with self.test_session() as sess: output_tensors = sess.run(output_tensors, feed_dict=feed_dict) for key in [fields.InputDataFields.groundtruth_boxes]: self.assertAllClose(expected_tensors[key], output_tensors[key]) for key in [fields.InputDataFields.groundtruth_classes]: self.assertAllEqual(expected_tensors[key], output_tensors[key])
Example #17
Source File: ops_test.py From moveo_ros with MIT License | 5 votes |
def test_filter_with_empty_groundtruth_boxes(self): input_boxes = tf.placeholder(tf.float32, shape=(None, 4)) input_classes = tf.placeholder(tf.int32, shape=(None,)) input_is_crowd = tf.placeholder(tf.bool, shape=(None,)) input_area = tf.placeholder(tf.float32, shape=(None,)) input_difficult = tf.placeholder(tf.float32, shape=(None,)) valid_indices = tf.placeholder(tf.int32, shape=(None,)) input_tensors = { fields.InputDataFields.groundtruth_boxes: input_boxes, fields.InputDataFields.groundtruth_classes: input_classes, fields.InputDataFields.groundtruth_is_crowd: input_is_crowd, fields.InputDataFields.groundtruth_area: input_area, fields.InputDataFields.groundtruth_difficult: input_difficult } output_tensors = ops.retain_groundtruth(input_tensors, valid_indices) feed_dict = { input_boxes: np.array([], dtype=np.float).reshape(0, 4), input_classes: np.array([], dtype=np.int32), input_is_crowd: np.array([], dtype=np.bool), input_area: np.array([], dtype=np.float32), input_difficult: np.array([], dtype=np.float32), valid_indices: np.array([], dtype=np.int32) } with self.test_session() as sess: output_tensors = sess.run(output_tensors, feed_dict=feed_dict) for key in input_tensors: if key == fields.InputDataFields.groundtruth_boxes: self.assertAllEqual([0, 4], output_tensors[key].shape) else: self.assertAllEqual([0], output_tensors[key].shape)
Example #18
Source File: ops_test.py From hands-detection with MIT License | 5 votes |
def test_filter_with_missing_fields(self): input_boxes = tf.placeholder(tf.float32, shape=(None, 4)) input_classes = tf.placeholder(tf.int32, shape=(None,)) input_tensors = { fields.InputDataFields.groundtruth_boxes: input_boxes, fields.InputDataFields.groundtruth_classes: input_classes } valid_indices = tf.placeholder(tf.int32, shape=(None,)) feed_dict = { input_boxes: np.array([[0.2, 0.4, 0.1, 0.8], [0.2, 0.4, 1.0, 0.8]], dtype=np.float), input_classes: np.array([1, 2], dtype=np.int32), valid_indices: np.array([0], dtype=np.int32) } expected_tensors = { fields.InputDataFields.groundtruth_boxes: [[0.2, 0.4, 0.1, 0.8]], fields.InputDataFields.groundtruth_classes: [1] } output_tensors = ops.retain_groundtruth(input_tensors, valid_indices) with self.test_session() as sess: output_tensors = sess.run(output_tensors, feed_dict=feed_dict) for key in [fields.InputDataFields.groundtruth_boxes]: self.assertAllClose(expected_tensors[key], output_tensors[key]) for key in [fields.InputDataFields.groundtruth_classes]: self.assertAllEqual(expected_tensors[key], output_tensors[key])
Example #19
Source File: ops_test.py From hands-detection with MIT License | 5 votes |
def test_filter_with_empty_groundtruth_boxes(self): input_boxes = tf.placeholder(tf.float32, shape=(None, 4)) input_classes = tf.placeholder(tf.int32, shape=(None,)) input_is_crowd = tf.placeholder(tf.bool, shape=(None,)) input_area = tf.placeholder(tf.float32, shape=(None,)) input_difficult = tf.placeholder(tf.float32, shape=(None,)) valid_indices = tf.placeholder(tf.int32, shape=(None,)) input_tensors = { fields.InputDataFields.groundtruth_boxes: input_boxes, fields.InputDataFields.groundtruth_classes: input_classes, fields.InputDataFields.groundtruth_is_crowd: input_is_crowd, fields.InputDataFields.groundtruth_area: input_area, fields.InputDataFields.groundtruth_difficult: input_difficult } output_tensors = ops.retain_groundtruth(input_tensors, valid_indices) feed_dict = { input_boxes: np.array([], dtype=np.float).reshape(0, 4), input_classes: np.array([], dtype=np.int32), input_is_crowd: np.array([], dtype=np.bool), input_area: np.array([], dtype=np.float32), input_difficult: np.array([], dtype=np.float32), valid_indices: np.array([], dtype=np.int32) } with self.test_session() as sess: output_tensors = sess.run(output_tensors, feed_dict=feed_dict) for key in input_tensors: if key == fields.InputDataFields.groundtruth_boxes: self.assertAllEqual([0, 4], output_tensors[key].shape) else: self.assertAllEqual([0], output_tensors[key].shape)
Example #20
Source File: ops_test.py From object_detection_with_tensorflow with MIT License | 5 votes |
def test_filter_with_missing_fields(self): input_boxes = tf.placeholder(tf.float32, shape=(None, 4)) input_classes = tf.placeholder(tf.int32, shape=(None,)) input_tensors = { fields.InputDataFields.groundtruth_boxes: input_boxes, fields.InputDataFields.groundtruth_classes: input_classes } valid_indices = tf.placeholder(tf.int32, shape=(None,)) feed_dict = { input_boxes: np.array([[0.2, 0.4, 0.1, 0.8], [0.2, 0.4, 1.0, 0.8]], dtype=np.float), input_classes: np.array([1, 2], dtype=np.int32), valid_indices: np.array([0], dtype=np.int32) } expected_tensors = { fields.InputDataFields.groundtruth_boxes: [[0.2, 0.4, 0.1, 0.8]], fields.InputDataFields.groundtruth_classes: [1] } output_tensors = ops.retain_groundtruth(input_tensors, valid_indices) with self.test_session() as sess: output_tensors = sess.run(output_tensors, feed_dict=feed_dict) for key in [fields.InputDataFields.groundtruth_boxes]: self.assertAllClose(expected_tensors[key], output_tensors[key]) for key in [fields.InputDataFields.groundtruth_classes]: self.assertAllEqual(expected_tensors[key], output_tensors[key])
Example #21
Source File: ops_test.py From Live-feed-object-device-identification-using-Tensorflow-and-OpenCV with Apache License 2.0 | 5 votes |
def test_filter_with_missing_fields(self): input_boxes = tf.placeholder(tf.float32, shape=(None, 4)) input_classes = tf.placeholder(tf.int32, shape=(None,)) input_tensors = { fields.InputDataFields.groundtruth_boxes: input_boxes, fields.InputDataFields.groundtruth_classes: input_classes } valid_indices = tf.placeholder(tf.int32, shape=(None,)) feed_dict = { input_boxes: np.array([[0.2, 0.4, 0.1, 0.8], [0.2, 0.4, 1.0, 0.8]], dtype=np.float), input_classes: np.array([1, 2], dtype=np.int32), valid_indices: np.array([0], dtype=np.int32) } expected_tensors = { fields.InputDataFields.groundtruth_boxes: [[0.2, 0.4, 0.1, 0.8]], fields.InputDataFields.groundtruth_classes: [1] } output_tensors = ops.retain_groundtruth(input_tensors, valid_indices) with self.test_session() as sess: output_tensors = sess.run(output_tensors, feed_dict=feed_dict) for key in [fields.InputDataFields.groundtruth_boxes]: self.assertAllClose(expected_tensors[key], output_tensors[key]) for key in [fields.InputDataFields.groundtruth_classes]: self.assertAllEqual(expected_tensors[key], output_tensors[key])
Example #22
Source File: ops_test.py From object_detection_with_tensorflow with MIT License | 5 votes |
def test_filter_with_empty_groundtruth_boxes(self): input_boxes = tf.placeholder(tf.float32, shape=(None, 4)) input_classes = tf.placeholder(tf.int32, shape=(None,)) input_is_crowd = tf.placeholder(tf.bool, shape=(None,)) input_area = tf.placeholder(tf.float32, shape=(None,)) input_difficult = tf.placeholder(tf.float32, shape=(None,)) valid_indices = tf.placeholder(tf.int32, shape=(None,)) input_tensors = { fields.InputDataFields.groundtruth_boxes: input_boxes, fields.InputDataFields.groundtruth_classes: input_classes, fields.InputDataFields.groundtruth_is_crowd: input_is_crowd, fields.InputDataFields.groundtruth_area: input_area, fields.InputDataFields.groundtruth_difficult: input_difficult } output_tensors = ops.retain_groundtruth(input_tensors, valid_indices) feed_dict = { input_boxes: np.array([], dtype=np.float).reshape(0, 4), input_classes: np.array([], dtype=np.int32), input_is_crowd: np.array([], dtype=np.bool), input_area: np.array([], dtype=np.float32), input_difficult: np.array([], dtype=np.float32), valid_indices: np.array([], dtype=np.int32) } with self.test_session() as sess: output_tensors = sess.run(output_tensors, feed_dict=feed_dict) for key in input_tensors: if key == fields.InputDataFields.groundtruth_boxes: self.assertAllEqual([0, 4], output_tensors[key].shape) else: self.assertAllEqual([0], output_tensors[key].shape)
Example #23
Source File: ops_test.py From Live-feed-object-device-identification-using-Tensorflow-and-OpenCV with Apache License 2.0 | 5 votes |
def test_filter_with_empty_groundtruth_boxes(self): input_boxes = tf.placeholder(tf.float32, shape=(None, 4)) input_classes = tf.placeholder(tf.int32, shape=(None,)) input_is_crowd = tf.placeholder(tf.bool, shape=(None,)) input_area = tf.placeholder(tf.float32, shape=(None,)) input_difficult = tf.placeholder(tf.float32, shape=(None,)) input_confidences = tf.placeholder(tf.float32, shape=(None,)) valid_indices = tf.placeholder(tf.int32, shape=(None,)) input_tensors = { fields.InputDataFields.groundtruth_boxes: input_boxes, fields.InputDataFields.groundtruth_classes: input_classes, fields.InputDataFields.groundtruth_is_crowd: input_is_crowd, fields.InputDataFields.groundtruth_area: input_area, fields.InputDataFields.groundtruth_difficult: input_difficult, fields.InputDataFields.groundtruth_confidences: input_confidences, } output_tensors = ops.retain_groundtruth(input_tensors, valid_indices) feed_dict = { input_boxes: np.array([], dtype=np.float).reshape(0, 4), input_classes: np.array([], dtype=np.int32), input_is_crowd: np.array([], dtype=np.bool), input_area: np.array([], dtype=np.float32), input_difficult: np.array([], dtype=np.float32), input_confidences: np.array([], dtype=np.float32), valid_indices: np.array([], dtype=np.int32), } with self.test_session() as sess: output_tensors = sess.run(output_tensors, feed_dict=feed_dict) for key in input_tensors: if key == fields.InputDataFields.groundtruth_boxes: self.assertAllEqual([0, 4], output_tensors[key].shape) else: self.assertAllEqual([0], output_tensors[key].shape)
Example #24
Source File: ops_test.py From object_detection_kitti with Apache License 2.0 | 5 votes |
def test_filter_with_missing_fields(self): input_boxes = tf.placeholder(tf.float32, shape=(None, 4)) input_classes = tf.placeholder(tf.int32, shape=(None,)) input_tensors = { fields.InputDataFields.groundtruth_boxes: input_boxes, fields.InputDataFields.groundtruth_classes: input_classes } valid_indices = tf.placeholder(tf.int32, shape=(None,)) feed_dict = { input_boxes: np.array([[0.2, 0.4, 0.1, 0.8], [0.2, 0.4, 1.0, 0.8]], dtype=np.float), input_classes: np.array([1, 2], dtype=np.int32), valid_indices: np.array([0], dtype=np.int32) } expected_tensors = { fields.InputDataFields.groundtruth_boxes: [[0.2, 0.4, 0.1, 0.8]], fields.InputDataFields.groundtruth_classes: [1] } output_tensors = ops.retain_groundtruth(input_tensors, valid_indices) with self.test_session() as sess: output_tensors = sess.run(output_tensors, feed_dict=feed_dict) for key in [fields.InputDataFields.groundtruth_boxes]: self.assertAllClose(expected_tensors[key], output_tensors[key]) for key in [fields.InputDataFields.groundtruth_classes]: self.assertAllEqual(expected_tensors[key], output_tensors[key])
Example #25
Source File: ops_test.py From object_detection_kitti with Apache License 2.0 | 5 votes |
def test_filter_with_empty_groundtruth_boxes(self): input_boxes = tf.placeholder(tf.float32, shape=(None, 4)) input_classes = tf.placeholder(tf.int32, shape=(None,)) input_is_crowd = tf.placeholder(tf.bool, shape=(None,)) input_area = tf.placeholder(tf.float32, shape=(None,)) input_difficult = tf.placeholder(tf.float32, shape=(None,)) valid_indices = tf.placeholder(tf.int32, shape=(None,)) input_tensors = { fields.InputDataFields.groundtruth_boxes: input_boxes, fields.InputDataFields.groundtruth_classes: input_classes, fields.InputDataFields.groundtruth_is_crowd: input_is_crowd, fields.InputDataFields.groundtruth_area: input_area, fields.InputDataFields.groundtruth_difficult: input_difficult } output_tensors = ops.retain_groundtruth(input_tensors, valid_indices) feed_dict = { input_boxes: np.array([], dtype=np.float).reshape(0, 4), input_classes: np.array([], dtype=np.int32), input_is_crowd: np.array([], dtype=np.bool), input_area: np.array([], dtype=np.float32), input_difficult: np.array([], dtype=np.float32), valid_indices: np.array([], dtype=np.int32) } with self.test_session() as sess: output_tensors = sess.run(output_tensors, feed_dict=feed_dict) for key in input_tensors: if key == fields.InputDataFields.groundtruth_boxes: self.assertAllEqual([0, 4], output_tensors[key].shape) else: self.assertAllEqual([0], output_tensors[key].shape)
Example #26
Source File: ops_test.py From MBMD with MIT License | 5 votes |
def test_filter_with_missing_fields(self): input_boxes = tf.placeholder(tf.float32, shape=(None, 4)) input_classes = tf.placeholder(tf.int32, shape=(None,)) input_tensors = { fields.InputDataFields.groundtruth_boxes: input_boxes, fields.InputDataFields.groundtruth_classes: input_classes } valid_indices = tf.placeholder(tf.int32, shape=(None,)) feed_dict = { input_boxes: np.array([[0.2, 0.4, 0.1, 0.8], [0.2, 0.4, 1.0, 0.8]], dtype=np.float), input_classes: np.array([1, 2], dtype=np.int32), valid_indices: np.array([0], dtype=np.int32) } expected_tensors = { fields.InputDataFields.groundtruth_boxes: [[0.2, 0.4, 0.1, 0.8]], fields.InputDataFields.groundtruth_classes: [1] } output_tensors = ops.retain_groundtruth(input_tensors, valid_indices) with self.test_session() as sess: output_tensors = sess.run(output_tensors, feed_dict=feed_dict) for key in [fields.InputDataFields.groundtruth_boxes]: self.assertAllClose(expected_tensors[key], output_tensors[key]) for key in [fields.InputDataFields.groundtruth_classes]: self.assertAllEqual(expected_tensors[key], output_tensors[key])
Example #27
Source File: ops_test.py From object_detection_with_tensorflow with MIT License | 5 votes |
def test_filter_with_missing_fields(self): input_boxes = tf.placeholder(tf.float32, shape=(None, 4)) input_classes = tf.placeholder(tf.int32, shape=(None,)) input_tensors = { fields.InputDataFields.groundtruth_boxes: input_boxes, fields.InputDataFields.groundtruth_classes: input_classes } valid_indices = tf.placeholder(tf.int32, shape=(None,)) feed_dict = { input_boxes: np.array([[0.2, 0.4, 0.1, 0.8], [0.2, 0.4, 1.0, 0.8]], dtype=np.float), input_classes: np.array([1, 2], dtype=np.int32), valid_indices: np.array([0], dtype=np.int32) } expected_tensors = { fields.InputDataFields.groundtruth_boxes: [[0.2, 0.4, 0.1, 0.8]], fields.InputDataFields.groundtruth_classes: [1] } output_tensors = ops.retain_groundtruth(input_tensors, valid_indices) with self.test_session() as sess: output_tensors = sess.run(output_tensors, feed_dict=feed_dict) for key in [fields.InputDataFields.groundtruth_boxes]: self.assertAllClose(expected_tensors[key], output_tensors[key]) for key in [fields.InputDataFields.groundtruth_classes]: self.assertAllEqual(expected_tensors[key], output_tensors[key])
Example #28
Source File: ops_test.py From MBMD with MIT License | 5 votes |
def test_filter_with_empty_groundtruth_boxes(self): input_boxes = tf.placeholder(tf.float32, shape=(None, 4)) input_classes = tf.placeholder(tf.int32, shape=(None,)) input_is_crowd = tf.placeholder(tf.bool, shape=(None,)) input_area = tf.placeholder(tf.float32, shape=(None,)) input_difficult = tf.placeholder(tf.float32, shape=(None,)) valid_indices = tf.placeholder(tf.int32, shape=(None,)) input_tensors = { fields.InputDataFields.groundtruth_boxes: input_boxes, fields.InputDataFields.groundtruth_classes: input_classes, fields.InputDataFields.groundtruth_is_crowd: input_is_crowd, fields.InputDataFields.groundtruth_area: input_area, fields.InputDataFields.groundtruth_difficult: input_difficult } output_tensors = ops.retain_groundtruth(input_tensors, valid_indices) feed_dict = { input_boxes: np.array([], dtype=np.float).reshape(0, 4), input_classes: np.array([], dtype=np.int32), input_is_crowd: np.array([], dtype=np.bool), input_area: np.array([], dtype=np.float32), input_difficult: np.array([], dtype=np.float32), valid_indices: np.array([], dtype=np.int32) } with self.test_session() as sess: output_tensors = sess.run(output_tensors, feed_dict=feed_dict) for key in input_tensors: if key == fields.InputDataFields.groundtruth_boxes: self.assertAllEqual([0, 4], output_tensors[key].shape) else: self.assertAllEqual([0], output_tensors[key].shape)
Example #29
Source File: ops_test.py From Elphas with Apache License 2.0 | 5 votes |
def test_filter_with_missing_fields(self): input_boxes = tf.placeholder(tf.float32, shape=(None, 4)) input_classes = tf.placeholder(tf.int32, shape=(None,)) input_tensors = { fields.InputDataFields.groundtruth_boxes: input_boxes, fields.InputDataFields.groundtruth_classes: input_classes } valid_indices = tf.placeholder(tf.int32, shape=(None,)) feed_dict = { input_boxes: np.array([[0.2, 0.4, 0.1, 0.8], [0.2, 0.4, 1.0, 0.8]], dtype=np.float), input_classes: np.array([1, 2], dtype=np.int32), valid_indices: np.array([0], dtype=np.int32) } expected_tensors = { fields.InputDataFields.groundtruth_boxes: [[0.2, 0.4, 0.1, 0.8]], fields.InputDataFields.groundtruth_classes: [1] } output_tensors = ops.retain_groundtruth(input_tensors, valid_indices) with self.test_session() as sess: output_tensors = sess.run(output_tensors, feed_dict=feed_dict) for key in [fields.InputDataFields.groundtruth_boxes]: self.assertAllClose(expected_tensors[key], output_tensors[key]) for key in [fields.InputDataFields.groundtruth_classes]: self.assertAllEqual(expected_tensors[key], output_tensors[key])
Example #30
Source File: ops_test.py From Elphas with Apache License 2.0 | 5 votes |
def test_filter_with_empty_groundtruth_boxes(self): input_boxes = tf.placeholder(tf.float32, shape=(None, 4)) input_classes = tf.placeholder(tf.int32, shape=(None,)) input_is_crowd = tf.placeholder(tf.bool, shape=(None,)) input_area = tf.placeholder(tf.float32, shape=(None,)) input_difficult = tf.placeholder(tf.float32, shape=(None,)) valid_indices = tf.placeholder(tf.int32, shape=(None,)) input_tensors = { fields.InputDataFields.groundtruth_boxes: input_boxes, fields.InputDataFields.groundtruth_classes: input_classes, fields.InputDataFields.groundtruth_is_crowd: input_is_crowd, fields.InputDataFields.groundtruth_area: input_area, fields.InputDataFields.groundtruth_difficult: input_difficult } output_tensors = ops.retain_groundtruth(input_tensors, valid_indices) feed_dict = { input_boxes: np.array([], dtype=np.float).reshape(0, 4), input_classes: np.array([], dtype=np.int32), input_is_crowd: np.array([], dtype=np.bool), input_area: np.array([], dtype=np.float32), input_difficult: np.array([], dtype=np.float32), valid_indices: np.array([], dtype=np.int32) } with self.test_session() as sess: output_tensors = sess.run(output_tensors, feed_dict=feed_dict) for key in input_tensors: if key == fields.InputDataFields.groundtruth_boxes: self.assertAllEqual([0, 4], output_tensors[key].shape) else: self.assertAllEqual([0], output_tensors[key].shape)