Construct a bird's eye view from sensors mounted on a vehicle
Simple-Bev is a machine learning model for generating a bird's eye view representation from the sensors (cameras) mounted on a vehicle. It uses ResNet-101 as the backbone and segnet as a segmentation model for specific use cases.
This model is an implementation of Simple-Bev found here.
This repository provides scripts to run Simple-Bev on Qualcomm® devices.
More details on model performance across various devices, can be found
here.
This export script
leverages Qualcomm® AI Hub to optimize, validate, and deploy this model
on-device. Lets go through each step below in detail:
Step 1: Compile model for on-device deployment
To compile a PyTorch model for on-device deployment, we first trace the model
in memory using the jit.trace and then call the submit_compile_job API.
python
1import torch
23import qai_hub as hub
4from qai_hub_models.models.simple_bev_cam import Model
56# Load the model7torch_model = Model.from_pretrained()89# Device10device = hub.Device("Samsung Galaxy S24")1112# Trace model13input_shape = torch_model.get_input_spec()14sample_inputs = torch_model.sample_inputs()1516pt_model = torch.jit.trace(torch_model,[torch.tensor(data[0])for _, data in sample_inputs.items()])1718# Compile model on a specific device19compile_job = hub.submit_compile_job(20 model=pt_model,21 device=device,22 input_specs=torch_model.get_input_spec(),23)2425# Get target model to run on-device26target_model = compile_job.get_target_model()27
Step 2: Performance profiling on cloud-hosted device
After compiling models from step 1. Models can be profiled model on-device using the
target_model. Note that this scripts runs the model on a device automatically
provisioned in the cloud. Once the job is submitted, you can navigate to a
provided job URL to view a variety of on-device performance metrics.