class_docstr: `FeatureConnector` for a normalized bounding box.
  
  Note: If you have multiple bounding boxes, you may want to wrap the feature
  inside a `tfds.features.Sequence`.
  
  Input:
    * `tfds.features.BBox` tuple or 4-dim `np.ndarray`.
  
  Output:
    bbox: tf.Tensor of type `tf.float32` and shape `[4,]` which contains the
      normalized coordinates of the bounding box `[ymin, xmin, ymax, xmax]`
  
  Example:
    * In the DatasetInfo object:
  
    ```
    features=features.FeatureDict({
        'bbox': tfds.features.BBox(),
    })
    ```
  
    * During generation:
  
    ```
    yield {
        'input': tfds.features.BBox(ymin=0.3, xmin=0.8, ymax=0.5, xmax=1.0),
    }
    ```
class_docstr_tok: ["`","FeatureConnector","`","for","a","normalized","bounding","box",".","Note",":","If","you","have","multiple","bounding","boxes",",","you","may","want","to","wrap","the","feature","inside","a","`","tfds.features.Sequence","`",".","Input",":","*","`","tfds.features.BBox","`","tuple","or","4-dim","`","np.ndarray","`",".","Output",":","bbox",":","tf.Tensor","of","type","`","tf.float32","`","and","shape","`","[","4",",","]","`","which","contains","the","normalized","coordinates","of","the","bounding","box","`","[","ymin",",","xmin",",","ymax",",","xmax","]","`","Example",":","*","In","the","DatasetInfo","object",":","``","`","features=features.FeatureDict","(","{","'bbox","'",":","tfds.features.BBox","(",")",",","}",")","``","`","*","During","generation",":","``","`","yield","{","'input","'",":","tfds.features.BBox","(","ymin=0.3",",","xmin=0.8",",","ymax=0.5",",","xmax=1.0",")",",","}","``","`"]
docstr: See base class for details.
docstr_tok: ["See","base","class","for","details","."]
code: def encode_example(self, bbox: Union[bb_utils.BBox, np.ndarray]):
      """See base class for details."""
  
      if isinstance(bbox, np.ndarray):
          if bbox.shape != (4,):
              raise ValueError(
                  "array representing BBox should have exactly 4 floats. "
                  f"Instead, it has {bbox.shape}."
              )
          bbox = bbox.astype(np.float64)
          bbox = bb_utils.BBox(
              ymin=bbox[0], xmin=bbox[1], ymax=bbox[2], xmax=bbox[3]
          )
  
      # Validate the coordinates
      for coordinate in bbox:
          if not isinstance(coordinate, float):
              raise ValueError(
                  "BBox coordinates should be float. Got {}.".format(
                      bbox
                  )
              )
          if not 0.0 <= coordinate <= 1.0:
              raise ValueError(
                  "BBox coordinates should be between 0 and 1. Got {}.".format(
                      bbox
                  )
              )
          if bbox.xmax < bbox.xmin or bbox.ymax < bbox.ymin:
              raise ValueError(
                  "BBox coordinates should have min <= max. Got {}.".format(
                      bbox
                  )
              )
  
      return super(BBoxFeature, self).encode_example(
          [bbox.ymin, bbox.xmin, bbox.ymax, bbox.xmax]
      )
  
imports: from __future__ import annotations
  from typing import Any, Union
  import numpy
  from tensorflow_datasets.core import lazy_imports_lib
  from tensorflow_datasets.core import utils
  from tensorflow_datasets.core.features import bounding_boxes_utils
  from tensorflow_datasets.core.features import feature
  from tensorflow_datasets.core.features import image_feature
  from tensorflow_datasets.core.features import tensor_feature
  from tensorflow_datasets.core.proto import feature_pb2
  from tensorflow_datasets.core.utils import type_utils
label_desc: Use image node_id 2 for calling the BBoxFeature obj's underlying member method code with example usage: obj.encode_example(bbox) and returns: super