Python object_detection.core.keypoint_ops.scale() Examples
The following are 30
code examples of object_detection.core.keypoint_ops.scale().
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.keypoint_ops
, or try the search function
.
Example #1
Source File: keypoint_ops_test.py From MBMD with MIT License | 6 votes |
def test_scale(self): keypoints = tf.constant([ [[0.0, 0.0], [100.0, 200.0]], [[50.0, 120.0], [100.0, 140.0]] ]) y_scale = tf.constant(1.0 / 100) x_scale = tf.constant(1.0 / 200) expected_keypoints = tf.constant([ [[0., 0.], [1.0, 1.0]], [[0.5, 0.6], [1.0, 0.7]] ]) output = keypoint_ops.scale(keypoints, y_scale, x_scale) with self.test_session() as sess: output_, expected_keypoints_ = sess.run([output, expected_keypoints]) self.assertAllClose(output_, expected_keypoints_)
Example #2
Source File: keypoint_ops_test.py From vehicle_counting_tensorflow with MIT License | 6 votes |
def test_scale(self): keypoints = tf.constant([ [[0.0, 0.0], [100.0, 200.0]], [[50.0, 120.0], [100.0, 140.0]] ]) y_scale = tf.constant(1.0 / 100) x_scale = tf.constant(1.0 / 200) expected_keypoints = tf.constant([ [[0., 0.], [1.0, 1.0]], [[0.5, 0.6], [1.0, 0.7]] ]) output = keypoint_ops.scale(keypoints, y_scale, x_scale) with self.test_session() as sess: output_, expected_keypoints_ = sess.run([output, expected_keypoints]) self.assertAllClose(output_, expected_keypoints_)
Example #3
Source File: keypoint_ops_test.py From garbage-object-detection-tensorflow with MIT License | 6 votes |
def test_scale(self): keypoints = tf.constant([ [[0.0, 0.0], [100.0, 200.0]], [[50.0, 120.0], [100.0, 140.0]] ]) y_scale = tf.constant(1.0 / 100) x_scale = tf.constant(1.0 / 200) expected_keypoints = tf.constant([ [[0., 0.], [1.0, 1.0]], [[0.5, 0.6], [1.0, 0.7]] ]) output = keypoint_ops.scale(keypoints, y_scale, x_scale) with self.test_session() as sess: output_, expected_keypoints_ = sess.run([output, expected_keypoints]) self.assertAllClose(output_, expected_keypoints_)
Example #4
Source File: keypoint_ops_test.py From HereIsWally with MIT License | 6 votes |
def test_scale(self): keypoints = tf.constant([ [[0.0, 0.0], [100.0, 200.0]], [[50.0, 120.0], [100.0, 140.0]] ]) y_scale = tf.constant(1.0 / 100) x_scale = tf.constant(1.0 / 200) expected_keypoints = tf.constant([ [[0., 0.], [1.0, 1.0]], [[0.5, 0.6], [1.0, 0.7]] ]) output = keypoint_ops.scale(keypoints, y_scale, x_scale) with self.test_session() as sess: output_, expected_keypoints_ = sess.run([output, expected_keypoints]) self.assertAllClose(output_, expected_keypoints_)
Example #5
Source File: keypoint_ops_test.py From object_detector_app with MIT License | 6 votes |
def test_scale(self): keypoints = tf.constant([ [[0.0, 0.0], [100.0, 200.0]], [[50.0, 120.0], [100.0, 140.0]] ]) y_scale = tf.constant(1.0 / 100) x_scale = tf.constant(1.0 / 200) expected_keypoints = tf.constant([ [[0., 0.], [1.0, 1.0]], [[0.5, 0.6], [1.0, 0.7]] ]) output = keypoint_ops.scale(keypoints, y_scale, x_scale) with self.test_session() as sess: output_, expected_keypoints_ = sess.run([output, expected_keypoints]) self.assertAllClose(output_, expected_keypoints_)
Example #6
Source File: keypoint_ops_test.py From mtl-ssl with Apache License 2.0 | 6 votes |
def test_scale(self): keypoints = tf.constant([ [[0.0, 0.0], [100.0, 200.0]], [[50.0, 120.0], [100.0, 140.0]] ]) y_scale = tf.constant(1.0 / 100) x_scale = tf.constant(1.0 / 200) expected_keypoints = tf.constant([ [[0., 0.], [1.0, 1.0]], [[0.5, 0.6], [1.0, 0.7]] ]) output = keypoint_ops.scale(keypoints, y_scale, x_scale) with self.test_session() as sess: output_, expected_keypoints_ = sess.run([output, expected_keypoints]) self.assertAllClose(output_, expected_keypoints_)
Example #7
Source File: keypoint_ops_test.py From models with Apache License 2.0 | 6 votes |
def test_scale(self): def graph_fn(): keypoints = tf.constant([ [[0.0, 0.0], [100.0, 200.0]], [[50.0, 120.0], [100.0, 140.0]] ]) y_scale = tf.constant(1.0 / 100) x_scale = tf.constant(1.0 / 200) expected_keypoints = tf.constant([ [[0., 0.], [1.0, 1.0]], [[0.5, 0.6], [1.0, 0.7]] ]) output = keypoint_ops.scale(keypoints, y_scale, x_scale) return output, expected_keypoints output, expected_keypoints = self.execute(graph_fn, []) self.assertAllClose(output, expected_keypoints)
Example #8
Source File: keypoint_ops_test.py From Person-Detection-and-Tracking with MIT License | 6 votes |
def test_scale(self): keypoints = tf.constant([ [[0.0, 0.0], [100.0, 200.0]], [[50.0, 120.0], [100.0, 140.0]] ]) y_scale = tf.constant(1.0 / 100) x_scale = tf.constant(1.0 / 200) expected_keypoints = tf.constant([ [[0., 0.], [1.0, 1.0]], [[0.5, 0.6], [1.0, 0.7]] ]) output = keypoint_ops.scale(keypoints, y_scale, x_scale) with self.test_session() as sess: output_, expected_keypoints_ = sess.run([output, expected_keypoints]) self.assertAllClose(output_, expected_keypoints_)
Example #9
Source File: keypoint_ops_test.py From g-tensorflow-models with Apache License 2.0 | 6 votes |
def test_scale(self): keypoints = tf.constant([ [[0.0, 0.0], [100.0, 200.0]], [[50.0, 120.0], [100.0, 140.0]] ]) y_scale = tf.constant(1.0 / 100) x_scale = tf.constant(1.0 / 200) expected_keypoints = tf.constant([ [[0., 0.], [1.0, 1.0]], [[0.5, 0.6], [1.0, 0.7]] ]) output = keypoint_ops.scale(keypoints, y_scale, x_scale) with self.test_session() as sess: output_, expected_keypoints_ = sess.run([output, expected_keypoints]) self.assertAllClose(output_, expected_keypoints_)
Example #10
Source File: keypoint_ops_test.py From motion-rcnn with MIT License | 6 votes |
def test_scale(self): keypoints = tf.constant([ [[0.0, 0.0], [100.0, 200.0]], [[50.0, 120.0], [100.0, 140.0]] ]) y_scale = tf.constant(1.0 / 100) x_scale = tf.constant(1.0 / 200) expected_keypoints = tf.constant([ [[0., 0.], [1.0, 1.0]], [[0.5, 0.6], [1.0, 0.7]] ]) output = keypoint_ops.scale(keypoints, y_scale, x_scale) with self.test_session() as sess: output_, expected_keypoints_ = sess.run([output, expected_keypoints]) self.assertAllClose(output_, expected_keypoints_)
Example #11
Source File: keypoint_ops_test.py From ros_people_object_detection_tensorflow with Apache License 2.0 | 6 votes |
def test_scale(self): keypoints = tf.constant([ [[0.0, 0.0], [100.0, 200.0]], [[50.0, 120.0], [100.0, 140.0]] ]) y_scale = tf.constant(1.0 / 100) x_scale = tf.constant(1.0 / 200) expected_keypoints = tf.constant([ [[0., 0.], [1.0, 1.0]], [[0.5, 0.6], [1.0, 0.7]] ]) output = keypoint_ops.scale(keypoints, y_scale, x_scale) with self.test_session() as sess: output_, expected_keypoints_ = sess.run([output, expected_keypoints]) self.assertAllClose(output_, expected_keypoints_)
Example #12
Source File: keypoint_ops_test.py From multilabel-image-classification-tensorflow with MIT License | 6 votes |
def test_scale(self): keypoints = tf.constant([ [[0.0, 0.0], [100.0, 200.0]], [[50.0, 120.0], [100.0, 140.0]] ]) y_scale = tf.constant(1.0 / 100) x_scale = tf.constant(1.0 / 200) expected_keypoints = tf.constant([ [[0., 0.], [1.0, 1.0]], [[0.5, 0.6], [1.0, 0.7]] ]) output = keypoint_ops.scale(keypoints, y_scale, x_scale) with self.test_session() as sess: output_, expected_keypoints_ = sess.run([output, expected_keypoints]) self.assertAllClose(output_, expected_keypoints_)
Example #13
Source File: keypoint_ops_test.py From yolo_v2 with Apache License 2.0 | 6 votes |
def test_scale(self): keypoints = tf.constant([ [[0.0, 0.0], [100.0, 200.0]], [[50.0, 120.0], [100.0, 140.0]] ]) y_scale = tf.constant(1.0 / 100) x_scale = tf.constant(1.0 / 200) expected_keypoints = tf.constant([ [[0., 0.], [1.0, 1.0]], [[0.5, 0.6], [1.0, 0.7]] ]) output = keypoint_ops.scale(keypoints, y_scale, x_scale) with self.test_session() as sess: output_, expected_keypoints_ = sess.run([output, expected_keypoints]) self.assertAllClose(output_, expected_keypoints_)
Example #14
Source File: keypoint_ops_test.py From Traffic-Rule-Violation-Detection-System with MIT License | 6 votes |
def test_scale(self): keypoints = tf.constant([ [[0.0, 0.0], [100.0, 200.0]], [[50.0, 120.0], [100.0, 140.0]] ]) y_scale = tf.constant(1.0 / 100) x_scale = tf.constant(1.0 / 200) expected_keypoints = tf.constant([ [[0., 0.], [1.0, 1.0]], [[0.5, 0.6], [1.0, 0.7]] ]) output = keypoint_ops.scale(keypoints, y_scale, x_scale) with self.test_session() as sess: output_, expected_keypoints_ = sess.run([output, expected_keypoints]) self.assertAllClose(output_, expected_keypoints_)
Example #15
Source File: keypoint_ops_test.py From Hands-On-Machine-Learning-with-OpenCV-4 with MIT License | 6 votes |
def test_scale(self): keypoints = tf.constant([ [[0.0, 0.0], [100.0, 200.0]], [[50.0, 120.0], [100.0, 140.0]] ]) y_scale = tf.constant(1.0 / 100) x_scale = tf.constant(1.0 / 200) expected_keypoints = tf.constant([ [[0., 0.], [1.0, 1.0]], [[0.5, 0.6], [1.0, 0.7]] ]) output = keypoint_ops.scale(keypoints, y_scale, x_scale) with self.test_session() as sess: output_, expected_keypoints_ = sess.run([output, expected_keypoints]) self.assertAllClose(output_, expected_keypoints_)
Example #16
Source File: keypoint_ops_test.py From MAX-Object-Detector with Apache License 2.0 | 6 votes |
def test_scale(self): keypoints = tf.constant([ [[0.0, 0.0], [100.0, 200.0]], [[50.0, 120.0], [100.0, 140.0]] ]) y_scale = tf.constant(1.0 / 100) x_scale = tf.constant(1.0 / 200) expected_keypoints = tf.constant([ [[0., 0.], [1.0, 1.0]], [[0.5, 0.6], [1.0, 0.7]] ]) output = keypoint_ops.scale(keypoints, y_scale, x_scale) with self.test_session() as sess: output_, expected_keypoints_ = sess.run([output, expected_keypoints]) self.assertAllClose(output_, expected_keypoints_)
Example #17
Source File: keypoint_ops_test.py From tensorflow with BSD 2-Clause "Simplified" License | 6 votes |
def test_scale(self): keypoints = tf.constant([ [[0.0, 0.0], [100.0, 200.0]], [[50.0, 120.0], [100.0, 140.0]] ]) y_scale = tf.constant(1.0 / 100) x_scale = tf.constant(1.0 / 200) expected_keypoints = tf.constant([ [[0., 0.], [1.0, 1.0]], [[0.5, 0.6], [1.0, 0.7]] ]) output = keypoint_ops.scale(keypoints, y_scale, x_scale) with self.test_session() as sess: output_, expected_keypoints_ = sess.run([output, expected_keypoints]) self.assertAllClose(output_, expected_keypoints_)
Example #18
Source File: keypoint_ops_test.py From Gun-Detector with Apache License 2.0 | 6 votes |
def test_scale(self): keypoints = tf.constant([ [[0.0, 0.0], [100.0, 200.0]], [[50.0, 120.0], [100.0, 140.0]] ]) y_scale = tf.constant(1.0 / 100) x_scale = tf.constant(1.0 / 200) expected_keypoints = tf.constant([ [[0., 0.], [1.0, 1.0]], [[0.5, 0.6], [1.0, 0.7]] ]) output = keypoint_ops.scale(keypoints, y_scale, x_scale) with self.test_session() as sess: output_, expected_keypoints_ = sess.run([output, expected_keypoints]) self.assertAllClose(output_, expected_keypoints_)
Example #19
Source File: keypoint_ops_test.py From AniSeg with Apache License 2.0 | 6 votes |
def test_scale(self): keypoints = tf.constant([ [[0.0, 0.0], [100.0, 200.0]], [[50.0, 120.0], [100.0, 140.0]] ]) y_scale = tf.constant(1.0 / 100) x_scale = tf.constant(1.0 / 200) expected_keypoints = tf.constant([ [[0., 0.], [1.0, 1.0]], [[0.5, 0.6], [1.0, 0.7]] ]) output = keypoint_ops.scale(keypoints, y_scale, x_scale) with self.test_session() as sess: output_, expected_keypoints_ = sess.run([output, expected_keypoints]) self.assertAllClose(output_, expected_keypoints_)
Example #20
Source File: keypoint_ops_test.py From ros_tensorflow with Apache License 2.0 | 6 votes |
def test_scale(self): keypoints = tf.constant([ [[0.0, 0.0], [100.0, 200.0]], [[50.0, 120.0], [100.0, 140.0]] ]) y_scale = tf.constant(1.0 / 100) x_scale = tf.constant(1.0 / 200) expected_keypoints = tf.constant([ [[0., 0.], [1.0, 1.0]], [[0.5, 0.6], [1.0, 0.7]] ]) output = keypoint_ops.scale(keypoints, y_scale, x_scale) with self.test_session() as sess: output_, expected_keypoints_ = sess.run([output, expected_keypoints]) self.assertAllClose(output_, expected_keypoints_)
Example #21
Source File: keypoint_ops_test.py From object_detection_with_tensorflow with MIT License | 6 votes |
def test_scale(self): keypoints = tf.constant([ [[0.0, 0.0], [100.0, 200.0]], [[50.0, 120.0], [100.0, 140.0]] ]) y_scale = tf.constant(1.0 / 100) x_scale = tf.constant(1.0 / 200) expected_keypoints = tf.constant([ [[0., 0.], [1.0, 1.0]], [[0.5, 0.6], [1.0, 0.7]] ]) output = keypoint_ops.scale(keypoints, y_scale, x_scale) with self.test_session() as sess: output_, expected_keypoints_ = sess.run([output, expected_keypoints]) self.assertAllClose(output_, expected_keypoints_)
Example #22
Source File: keypoint_ops_test.py From BMW-TensorFlow-Training-GUI with Apache License 2.0 | 6 votes |
def test_scale(self): keypoints = tf.constant([ [[0.0, 0.0], [100.0, 200.0]], [[50.0, 120.0], [100.0, 140.0]] ]) y_scale = tf.constant(1.0 / 100) x_scale = tf.constant(1.0 / 200) expected_keypoints = tf.constant([ [[0., 0.], [1.0, 1.0]], [[0.5, 0.6], [1.0, 0.7]] ]) output = keypoint_ops.scale(keypoints, y_scale, x_scale) with self.test_session() as sess: output_, expected_keypoints_ = sess.run([output, expected_keypoints]) self.assertAllClose(output_, expected_keypoints_)
Example #23
Source File: keypoint_ops_test.py From object_detection_with_tensorflow with MIT License | 6 votes |
def test_scale(self): keypoints = tf.constant([ [[0.0, 0.0], [100.0, 200.0]], [[50.0, 120.0], [100.0, 140.0]] ]) y_scale = tf.constant(1.0 / 100) x_scale = tf.constant(1.0 / 200) expected_keypoints = tf.constant([ [[0., 0.], [1.0, 1.0]], [[0.5, 0.6], [1.0, 0.7]] ]) output = keypoint_ops.scale(keypoints, y_scale, x_scale) with self.test_session() as sess: output_, expected_keypoints_ = sess.run([output, expected_keypoints]) self.assertAllClose(output_, expected_keypoints_)
Example #24
Source File: keypoint_ops_test.py From moveo_ros with MIT License | 6 votes |
def test_scale(self): keypoints = tf.constant([ [[0.0, 0.0], [100.0, 200.0]], [[50.0, 120.0], [100.0, 140.0]] ]) y_scale = tf.constant(1.0 / 100) x_scale = tf.constant(1.0 / 200) expected_keypoints = tf.constant([ [[0., 0.], [1.0, 1.0]], [[0.5, 0.6], [1.0, 0.7]] ]) output = keypoint_ops.scale(keypoints, y_scale, x_scale) with self.test_session() as sess: output_, expected_keypoints_ = sess.run([output, expected_keypoints]) self.assertAllClose(output_, expected_keypoints_)
Example #25
Source File: keypoint_ops_test.py From hands-detection with MIT License | 6 votes |
def test_scale(self): keypoints = tf.constant([ [[0.0, 0.0], [100.0, 200.0]], [[50.0, 120.0], [100.0, 140.0]] ]) y_scale = tf.constant(1.0 / 100) x_scale = tf.constant(1.0 / 200) expected_keypoints = tf.constant([ [[0., 0.], [1.0, 1.0]], [[0.5, 0.6], [1.0, 0.7]] ]) output = keypoint_ops.scale(keypoints, y_scale, x_scale) with self.test_session() as sess: output_, expected_keypoints_ = sess.run([output, expected_keypoints]) self.assertAllClose(output_, expected_keypoints_)
Example #26
Source File: keypoint_ops_test.py From DOTA_models with Apache License 2.0 | 6 votes |
def test_scale(self): keypoints = tf.constant([ [[0.0, 0.0], [100.0, 200.0]], [[50.0, 120.0], [100.0, 140.0]] ]) y_scale = tf.constant(1.0 / 100) x_scale = tf.constant(1.0 / 200) expected_keypoints = tf.constant([ [[0., 0.], [1.0, 1.0]], [[0.5, 0.6], [1.0, 0.7]] ]) output = keypoint_ops.scale(keypoints, y_scale, x_scale) with self.test_session() as sess: output_, expected_keypoints_ = sess.run([output, expected_keypoints]) self.assertAllClose(output_, expected_keypoints_)
Example #27
Source File: keypoint_ops_test.py From object_detection_kitti with Apache License 2.0 | 6 votes |
def test_scale(self): keypoints = tf.constant([ [[0.0, 0.0], [100.0, 200.0]], [[50.0, 120.0], [100.0, 140.0]] ]) y_scale = tf.constant(1.0 / 100) x_scale = tf.constant(1.0 / 200) expected_keypoints = tf.constant([ [[0., 0.], [1.0, 1.0]], [[0.5, 0.6], [1.0, 0.7]] ]) output = keypoint_ops.scale(keypoints, y_scale, x_scale) with self.test_session() as sess: output_, expected_keypoints_ = sess.run([output, expected_keypoints]) self.assertAllClose(output_, expected_keypoints_)
Example #28
Source File: keypoint_ops_test.py From Elphas with Apache License 2.0 | 6 votes |
def test_scale(self): keypoints = tf.constant([ [[0.0, 0.0], [100.0, 200.0]], [[50.0, 120.0], [100.0, 140.0]] ]) y_scale = tf.constant(1.0 / 100) x_scale = tf.constant(1.0 / 200) expected_keypoints = tf.constant([ [[0., 0.], [1.0, 1.0]], [[0.5, 0.6], [1.0, 0.7]] ]) output = keypoint_ops.scale(keypoints, y_scale, x_scale) with self.test_session() as sess: output_, expected_keypoints_ = sess.run([output, expected_keypoints]) self.assertAllClose(output_, expected_keypoints_)
Example #29
Source File: keypoint_ops_test.py From Accident-Detection-on-Indian-Roads with GNU Affero General Public License v3.0 | 6 votes |
def test_scale(self): keypoints = tf.constant([ [[0.0, 0.0], [100.0, 200.0]], [[50.0, 120.0], [100.0, 140.0]] ]) y_scale = tf.constant(1.0 / 100) x_scale = tf.constant(1.0 / 200) expected_keypoints = tf.constant([ [[0., 0.], [1.0, 1.0]], [[0.5, 0.6], [1.0, 0.7]] ]) output = keypoint_ops.scale(keypoints, y_scale, x_scale) with self.test_session() as sess: output_, expected_keypoints_ = sess.run([output, expected_keypoints]) self.assertAllClose(output_, expected_keypoints_)
Example #30
Source File: preprocessor.py From models with Apache License 2.0 | 5 votes |
def scale_boxes_to_pixel_coordinates(image, boxes, keypoints=None): """Scales boxes from normalized to pixel coordinates. Args: image: A 3D float32 tensor of shape [height, width, channels]. boxes: A 2D float32 tensor of shape [num_boxes, 4] containing the bounding boxes in normalized coordinates. Each row is of the form [ymin, xmin, ymax, xmax]. keypoints: (optional) rank 3 float32 tensor with shape [num_instances, num_keypoints, 2]. The keypoints are in y-x normalized coordinates. Returns: image: unchanged input image. scaled_boxes: a 2D float32 tensor of shape [num_boxes, 4] containing the bounding boxes in pixel coordinates. scaled_keypoints: a 3D float32 tensor with shape [num_instances, num_keypoints, 2] containing the keypoints in pixel coordinates. """ boxlist = box_list.BoxList(boxes) image_height = tf.shape(image)[0] image_width = tf.shape(image)[1] scaled_boxes = box_list_ops.scale(boxlist, image_height, image_width).get() result = [image, scaled_boxes] if keypoints is not None: scaled_keypoints = keypoint_ops.scale(keypoints, image_height, image_width) result.append(scaled_keypoints) return tuple(result) # TODO(alirezafathi): Investigate if instead the function should return None if # masks is None. # pylint: disable=g-doc-return-or-yield