MCPcopy Create free account
hub / github.com/google-research/language / parse_object_features

Function parse_object_features

language/capwap/utils/image_utils.py:99–116  ·  view source on GitHub ↗

Parse ObjectDetectionOutput from TensorProtos.

(features, positions, params)

Source from the content-addressed store, hash-verified

97
98
99def 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

Callers

nothing calls this directly

Calls 1

padMethod · 0.80

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…