Skip to content

Commit 622604f

Browse files
No public description
PiperOrigin-RevId: 676475897
1 parent 41f7c1f commit 622604f

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

official/vision/utils/object_detection/visualization_utils.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -438,6 +438,11 @@ def _denormalize_images(images: tf.Tensor) -> tf.Tensor:
438438
)
439439
return tf.cast(images, dtype=tf.uint8)
440440

441+
if images.shape[3] > 3:
442+
images = images[:, :, :, 0:3]
443+
elif images.shape[3] == 1:
444+
images = tf.image.grayscale_to_rgb(images)
445+
441446
images = tf.nest.map_structure(
442447
tf.identity,
443448
tf.map_fn(

0 commit comments

Comments
 (0)