Required:
- Ubuntu 20.04
- Python-3 with Pip (
apt install python3 python3-pip
) - CUDA >= 10 if using GPU
-
Confirm that you are currently in the
gem/
directory -
Navigate to the empty data directory
cd data
where we will store our lane detection training set -
Download TuSimple lane detection dataset (around 10 GB) by running the following commands (this will take some time...)
wget https://s3.us-east-2.amazonaws.com/benchmark-frontend/datasets/1/train_set.zip unzip train_set.zip python ../tusimple_transform.py --src_dir .
-
All configurations for the training job can be found in
train_lanenet.yaml
. Edit this file to your needs. -
Start training by running the following command
python train_lanenet.py --checkpoint [path to checkpoint to resume training from] [config_file] [config_name]
[config_file] - path to configuration file
[config_name] - name of configuration to run, either the config
train-lanenet
orprune-lanenet-iter
Example
python train_lanenet.py train_lanenet.yaml train-lanenet
LaneNet will be run as a ROS node which feeds into the GEM simulator. As ROS installs its python binding packages into the system-wide Python, we are required to also do so (instead of using a virtual env).
-
Exit all virtual environment you're currently in. Confirm your
python3
is the system-wide one (e.g., usingwhich python3
). -
Install
Cython
andscikit-build
so that any packages we install next can be compiled if needed to:pip3 install Cython scikit-build
-
Install packages required for inference:
pip3 install -r ./infer_req.txt
-
Install an inference engine depending on your device:
-
[gpu] If using a device with GPU, make sure that
nvcc
is in your PATH, and installonnxruntime-gpu
bypip install onnxruntime-gpu
; -
[cpu] If using CPU for inference, install
onnxruntime
bypip install onnxruntime
.
-
GEM simulator only works with ROS Noetic which can be easily installed on Ubuntu 20. Other Linux distros are unsupported unless you install ROS Noetic from source (not recommended).
-
Follow this instruction to add ROS repo to your system.
-
Install the bare minimum for ROS:
sudo apt install ros-noetic-ros-base ros-noetic-gazebo-ros-pkgs
ros-noetic-gazebo-ros-pkgs
is required for camera to work in Gazebo.
-
Install utils and initialize
rosdep
.sudo apt install python3-rosdep python3-rosinstall python3-rosinstall-generator python3-wstool build-essential sudo rosdep init rosdep update
-
Add setup script to your bashrc:
echo "source /opt/ros/noetic/setup.bash" >> ~/.bashrc source ~/.bashrc
-
Create a
./catkin_ws/
folder here for the workspace and set up components to use fromgemsim/
:mkdir catkin_ws/ cd catkin_ws mkdir src/ ln -s (realpath ../gemsim/polaris_gem_simulator/*) src/ ln -s (realpath ../gemsim/polaris_gem_drivers_sim/*) src/
-
Use
rosdep
to discover and install dependencies for this project, and installjsk-rviz-plugins
(whichrosdep
cannot detect), then compile:rosdep install --from-paths src --ignore-src --rosdistro=noetic -y sudo apt install ros-noetic-jsk-rviz-plugins catkin_make
-
Source the workspace setup script:
source devel/setup.bash
(or add it to your bashrc) -
Run
roslaunch gem_gazebo gem_gazebo_rviz.launch
for the simulator with race track (default world)It should display an RViz window and a Gazebo window (may take a while).
-
Obtain pretrained LaneNet model here and save as
./baseline.onnx
. -
In another 2 windows, run
python3 lanenet_node.py
(for the DNN) andpython3 stanley.py
(for the controller) respectively. This will drive the cart around on the race track.