The OpticalExpansion class provides core functionality for this module.
This code is licensed under the MIT License.
If True, inference call is run on the local VM, else offloaded onto GRID-Cortex. Defaults to False.
Routes inference to GRID-Cortex if available; otherwise, uses local inference.Args:
rgbimage (np.ndarray): The input RGB image.Returns:
dict: The output containing TTC, occupancy, logarithmic motion in depth, and optical flow.
from grid.model.perception.ttc.optexp import OpticalExpansion
car = AirGenCar()
# We will be capturing an image from the AirGen simulator
# and run model inference on it.
img = car.getImage("front_center", "rgb").data
model = OpticalExpansion(use_local = False)
result = model.run(rgbimage=img)
print(result.shape)