class_docstr: Test visualization functions.
class_docstr_tok: ["Test","visualization","functions","."]
docstr: Returns fake inputs for visualization tests.
docstr_tok: ["Returns","fake","inputs","for","visualization","tests","."]
code: def _generate_visualization_inputs(self):
      """Returns fake inputs for visualization tests."""
      batchsize = 4
      num_classes = 81
      max_num_boxes = 3
      num_preds = 5
  
      key = jax.random.PRNGKey(0)
  
      # Create fake predictions and targets
      key, subkey = jax.random.split(key)
      # set probabilities for class 0 higher than others
      p_logits = jnp.ones(num_classes).at[0].set(5.0)
      p = jax.nn.softmax(p_logits)
      tgt_labels = jax.random.choice(
          subkey,
          num_classes,
          shape=(batchsize, max_num_boxes),
          replace=True,
          p=p,
      )
      # Ensure last target is dummy empty target.
      tgt_labels = tgt_labels.at[:, -1].set(0)
  
      key, subkey = jax.random.split(key)
      pred_logits = jax.random.normal(
          subkey, shape=(batchsize, num_preds, num_classes)
      )
  
      key, subkey = jax.random.split(key)
      pred_bbox = self._sample_cxcywh_bbox(
          subkey, batch_shape=(batchsize, num_preds)
      )
  
      key, subkey = jax.random.split(key)
      tgt_bbox = self._sample_cxcywh_bbox(
          subkey, batch_shape=(batchsize, max_num_boxes)
      )
      key, subkey = jax.random.split(key)
      iscrowd = (
          jax.random.uniform(subkey, shape=(batchsize, max_num_boxes))
          > 0.5
      )
  
      pred = {"pred_logits": pred_logits, "pred_boxes": pred_bbox}
      tgt = {
          "labels": tgt_labels,
          "boxes": tgt_bbox,
          "is_crowd": iscrowd,
          "size": jnp.array(
              [[128, 256], [256, 128], [224, 224], [256, 256]]
          ),
      }
  
      mean_rgb = np.reshape(
          np.array([0.48, 0.456, 0.406]), [1, 1, 1, 3]
      )
      std_rgb = np.reshape(
          np.array([0.229, 0.224, 0.225]), [1, 1, 1, 3]
      )
  
      imgs = np.zeros((batchsize, 256, 256, 3))
      for i, sz in enumerate(tgt["size"]):
          img = np.random.uniform(size=(sz[0], sz[1], 3))
          imgs[i, : sz[0], : sz[1], :] = img
  
      imgs = (imgs - mean_rgb) / std_rgb
      batch = {
          "inputs": jnp.array(imgs),
          "label": tgt,
      }
  
      return jax.device_get(pred), jax.device_get(batch)
  
file_path: scenic/scenic/projects/baselines/detr/tests/test_train_utils.py
imports: import collections
  import os
  from absl.testing import absltest
  from absl.testing import parameterized
  import jax
  import jax.numpy
  import numpy
  from scenic.projects.baselines.detr import train_utils
label_desc: Use image node_id 2 for calling the DETRVisualizationsTest obj's underlying member method code with example usage: obj._generate_visualization_inputs() and returns: jax,  jax