class_docstr: Base class for image ops that require a random seed.
class_docstr_tok: ["Base","class","for","image","ops","that","require","a","random","seed","."]
code: def __call__(self, features: Features) -> Features:
      # Copy input features to ensure that they are not accidentally modified in
      # place:
      features = dict(features)
  
      if SEED_KEY not in features:
          raise ValueError(
              f"Random image preprocess op {type(self)} requires a random seed."
          )
      image_size = transforms.get_dynamic_size(features[self.image_key])
      rngs = tf.random.experimental.stateless_split(features[SEED_KEY])
      features[SEED_KEY] = rngs[0]
      op_seed = rngs[1]
      features[self.image_key] = self.apply(
          features[self.image_key], op_seed
      )
      if self.boxes_key in features:
          features[self.boxes_key] = self.apply_boxes(
              features[self.boxes_key],
              image_size=image_size,
              seed=op_seed,
          )
      return features
  
imports: import abc
  import dataclasses
  from typing import Optional, Sequence, Tuple, Union
  from clu import preprocess_spec
  from scenic.projects.owl_vit.preprocessing import modalities
  from scenic.projects.owl_vit.preprocessing import transforms
  import tensorflow
label_desc: Use image node_id 1 for calling the RandomImagePreprocessOp obj's underlying member method code with example usage: obj.__call__(features) and returns: features