A simple guide to training your own AI car, using Unity ML Agents and built-in Wheel Collider

Car AI - Unity ML

A simple guide to training your own AI car, using Unity ML Agents and built-in Wheel Collider

Demo

car-ai-demo

Training

car-ai-training

General

Install Unity 2023.2 or higher & Python 3.10.12

Create Virtual Environment

Training AI on Mac OS

Activate Virtual Environment

source [PATH TO VIRTUAL ENV]/bin/activate

Resume training

cd [PATH TO UNITY PROJECT]
mlagents-learn config/car_config.yaml --run-id=Car --resume

Force training from beginning

cd [PATH TO UNITY PROJECT]
mlagents-learn config/car_config.yaml --run-id=Car --force

Training AI on Windows

Activate Virtual Environment

[PATH TO VIRTUAL ENV]\Scripts\activate

Resume training

cd [PATH TO UNITY PROJECT]
mlagents-learn config/car_config.yaml --run-id=Car --resume --torch-device=cuda 

Force training from beginning

cd [PATH TO UNITY PROJECT]
mlagents-learn config/car_config.yaml --run-id=Car --force --torch-device=cuda

Using new AI Training Model

Copy file from [PATH TO UNITY PROJECT]/results/Car/Car.onnx to [PATH TO UNITY PROJECT]/Assets/Models/Car.onnx

Github URL

3 Likes

To be honest, the deployment of ML Agents is a big problem…