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)
The OpticalExpansion class provides core functionality for this module.
This code is licensed under the MIT License.
class OpticalExpansion()
use_local
boolean
default:"True"
If True, inference call is run on the local VM, else offloaded onto GRID-Cortex. Defaults to False.
def run()
rgbimage
np.ndarray
required
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.
Returns
np.ndarray
The predicted output.
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)