Unified ML Inference in Autoware - A proposal
State of ML in Autoware
Node | Model | File Format | Inference Engine |
---|---|---|---|
lidar_apollo_cnn_seg_detect | Unkown | caffe | caffe |
lidar_point_pillars | PointsPillars | onnx | TensorRT |
trafficlight_recognizer/region_tlr_mxnet | Unkown | MxNet | MxNet |
trafficlight_recognizer/region_tlr_ssd | SSD-unkown | caffee | ssdcaffe |
vision_darknet_detect | Yolov2/3 | darknet | darknet |
vision_segment_enet_detect | ENet | caffe | caffe for ENet |
vision_ssd_detect | SSD | caffe | ssdcaffe |
Problem with current approach
- Use a varied range of formats and frameworks.
- For deployment this presents challenges
- Varied degree of hardware acceleration support
- Lock into one acceleration hardware, difficult to port 7 frameworks to a different ML accelerator hardware.
- For deployment this presents challenges
- Use of frameworks that are forks or no longer actively maintained.
- This presents challenges in the long term support and future update of these nodes
- Use of frameworks that are proprietary and require special licenses and sign-ups to use.
- Documentation and trained weights lacking
- Makes it difficult to even compile the nodes. For example.
- Difficult to re-train the model on custom data-sets. For example.
Solution Proposal
Unify all ML workload deployment in Autoware with a single workflow and a single ML inference framework. Organize and document all pre-trained models used in Autoware in a Model Zoo.
TVM
TVM is an compiler based inference framework that compiles models into machine code ahead of time. TVM has a number of advantages:
- Single framework that supports virtually all model file formats.
- The framework supports a wide range of hardware backends.
- Open source governance with active contribution from many companies in the Autoware foundation.
- Able to achieve state-of-the-art performance figures when compared to other frameworks.
- Compile and optimise models ahead of time so runtime requirements are reduced.
Autoware Model Zoo
Model Zoo proposal was presented to the TSC. Here is a summary:
- A place for organizing, documenting and sharing neural networks that are used in Autoware
- Organize neural networks by AD tasks.
- The model zoo would have benefits to a variety of audiences, including new users, benchmarkers,
prototypers, and contributors. - The model zoo would allow us to track the provenance of models, follow the state-of-the-art, and
provide a peer review process for bringing in new or improved models.
Unified Workflow
- Clone model zoo repo without the large files
- Pull in specific model binary from the model zoo
- Compile model using TVM CLI script
- TVM CLI tool generates config file for inference pipeline
- Include config file in the build process of the inference node and build the node
- Install all relevant files into install folder
How to get started
Arm would like to propose to modify the lidar_point_pillars node in autoware.ai to use TVM as a way to explore the workflow. With this learning, we hope to build an improved ML facility in autoware.auto as a second step.
To that end. We propose the following work to be carried out:
- A CLI tool for TVM (Arm)
- Python cli tool for compiling models with TVM
- Support multiple input format and output architectures
- Generate macro file to be used in C++ inference
- Contribute to Model Zoo
- TVM runtime library installed in the system (Arm)
- Add TVM as part of the build environment for Autoware
- TVM run time and TVM python bindings
- Need to build from source similar to how Eigen is added to autoware.
- Update wiki documentation
- Update docker images on docker hub
- Add TVM as part of the build environment for Autoware
- Generic TVM Pipeline Utilities (Arm)
- A set of utility functions that will be re-used in building TVM pipelines in multiple nodes
Similar to lanelet2 extension library
- A set of utility functions that will be re-used in building TVM pipelines in multiple nodes
- Use TVM inference in lidar_point_pillars node (Arm)
- Contribute PointPillars to Model Zoo (Need help from TierIV)
- Add metadata and documentation about how to recreate, train, transfer learn and infer.
- Does not block the critical path but is still essential to the whole story
Collaboration
Arm is committed to deliver the initial contribution. We would love to collaborate with people and companies who have aspirations in this space. Please comment below with any feedback to this proposal and any ways you would like to contribute.