Parse ObjectDetectionOutput from TensorProtos.
(features, positions, params)
| 97 | |
| 98 | |
| 99 | def parse_object_features(features, positions, params): |
| 100 | """Parse ObjectDetectionOutput from TensorProtos.""" |
| 101 | features = tf.io.parse_tensor(features, tf.float32) |
| 102 | positions = tf.io.parse_tensor(positions, tf.int64) |
| 103 | positions = tf.cast(positions, tf.int32) |
| 104 | features = features[:params["num_image_regions"]] |
| 105 | num_objects = tensor_utils.shape(features, 0) |
| 106 | padding = tf.maximum(0, params["num_image_regions"] - num_objects) |
| 107 | features = tf.pad(features, [[0, padding], [0, 0]]) |
| 108 | positions = tf.pad(positions, [[0, padding]]) |
| 109 | features = tf.ensure_shape( |
| 110 | features, [params["num_image_regions"], params["image_feature_size"]]) |
| 111 | positions = tf.ensure_shape(positions, [params["num_image_regions"]]) |
| 112 | mask = tf.pad(tf.ones(num_objects, dtype=tf.int32), [[0, padding]]) |
| 113 | mask = tf.ensure_shape(mask, [params["num_image_regions"]]) |
| 114 | output = ObjectDetectionOutput( |
| 115 | features=features, positions=positions, mask=mask) |
| 116 | return output |
nothing calls this directly
no test coverage detected
searching dependent graphs…