Lane assist for ETS2, built with the ultra-fast-lane-detection model.

Overview

Euro-Truck-Simulator-2-Lane-Assist

Lane assist for ETS2, built with the ultra-fast-lane-detection model.

This project was made possible by the amazing people behind the original Ultra Fast Lane Detection paper. In addition to ibaiGorordo for his example scripts for Pytorch and rdbender for his sun valley theme for ttk.

Example Video

It is important to note that in the video I overlayed the laneAssist window on top of ETS2, unfortunately I do not yet know how to get it on top without messing with the screen capture.

Installation

Copy the repository ( Code -> Download zip ) and unpack it to a folder. Now install all the requirements.

Requirements

You must have at least python 3.7 installed for pytorch to work. To install pytorch go to their website and select the appropriate options. If you have an nvidia graphics card then select cuda, otherwise go for cpu. If you download cuda then you also have to download the cuda api from NVIDIA.

Other requirements can be installed with pip like this (if you have > python 3.10, then use pip3.10):

pip3 install -r requirements.txt

Lane Detection models

In addition to the normal requirements this application requires a lane detection model to work. This is a new deeper model from Adorable Jiang. So far from the very little testing all the models work. These models will likely run slower but work better, I have added support for these so choose if you want these or the defaults.

To download a pretrained model go to the Ultra Fast Lane Detection github page and scroll down until you see Trained models.

There are two different models to choose from. CUlane is a more stable model, but might not work in more difficult situations (like the road being white). On the other hand Tusimple is a more sporadic model that will almost certainly work in any situation. It is also worth noting that Tusimple in some cases requires some of the top of the dashboard and steering wheel to show, while CUlane doesn't. There is a tradeoff to both but I have included a way to switch between them while running the app, so downloading both of them is no issue. After you have downloaded a model, make a models folder in the root folder of the app (the folder where MainFile.py is) and move the model there.

Preparations

Before even starting the app make sure your ETS2 or any other game is in borderless mode. It is not required for the app to work, but for setting it up it is highly recommended. Also disable automatic indicators in game. To start the app, open a command prompt or terminal in the app's folder ( on windows this can be done by holding alt and right clicking ). Once the terminal is open type:

python3 MainFile.py

This will start the application and you should see two windows. One is the main window where you can start the program and change the settings. The other is the preview to show you what the program sees. Don't worry if it's black, that doesn't mean that it isn't working.

Before pressing Toggle Enable it is important to head over to the settings to configure a couple of important options.

The first is to change the position of the video capture from the general tab. I recommend starting up ETS 2 and setting the game on pause. Then move the window around by changing the position values (I recommend setting them to 0x0 and then going from there) so that the app sees the road, but preferably not the steering wheel as this can throw off the lane detection. Even though it's not recommended you might also need to change the dimensions of the screen capture. This might have to be done on 1080 or 4k monitors for example. Just if you do try to keep the aspect ratio the same (16:9)

The second important option is your input device. Even if you play on a keyboard you must have a controller selected otherwise the app will crash. The default selection is for my G29. If you also have one then be sure to make sure the controller is correct, after that you can head over to the next step.

If you do not play on a G29 then select your controller and additionally select the steering axis ( the blue slider will move with the axis ) and the button to toggle the Lane Assist ( this can usually be found by searching on google for controller button numbers ). In addition you will have to select your indicator buttons.

After that go to the final tab, and if you do have a nvidia gpu then you can enable Use GPU, after that you can hit Change Model.

Finally if you want to save your settings, most of them can be easily changed by editing MainFile.py

Usage

Once all the preparations are done let's actually use the lane assist. When you start the program it will make a virtual xbox 360 controller. You have to set the ingame steering axis to this controller, it will not recognize the controller unless put it as a secondary device. Under the main device (Should be Keyboard + controller) there are a multitude of slots, one of these slots must be the 360. This controller follows your own wheel/gamepad so managing to set it in the settings can be hard. Unfortunately this virtual controller means you will lose all force feedback from your main wheel.

Once the controller is setup in game it's time to use the app. To start the lane assist you can either press the set button on your controller or manually toggle it with Toggle Enable. You should see the lane show up on the preview and after that, Happy Trucking!

You might also like...
Implementation of our paper 'RESA: Recurrent Feature-Shift Aggregator for Lane Detection' in AAAI2021.
Implementation of our paper 'RESA: Recurrent Feature-Shift Aggregator for Lane Detection' in AAAI2021.

RESA PyTorch implementation of the paper "RESA: Recurrent Feature-Shift Aggregator for Lane Detection". Our paper has been accepted by AAAI2021. Intro

LaneAF: Robust Multi-Lane Detection with Affinity Fields

LaneAF: Robust Multi-Lane Detection with Affinity Fields This repository contains Pytorch code for training and testing LaneAF lane detection models i

 CondLaneNet: a Top-to-down Lane Detection Framework Based on Conditional Convolution
CondLaneNet: a Top-to-down Lane Detection Framework Based on Conditional Convolution

CondLaneNet: a Top-to-down Lane Detection Framework Based on Conditional Convolution This is the official implementation code of the paper "CondLaneNe

Code for the IJCAI 2021 paper
Code for the IJCAI 2021 paper "Structure Guided Lane Detection"

SGNet Project for the IJCAI 2021 paper "Structure Guided Lane Detection" Abstract Recently, lane detection has made great progress with the rapid deve

PyTorch implementation of 'Gen-LaneNet: a generalized and scalable approach for 3D lane detection'
PyTorch implementation of 'Gen-LaneNet: a generalized and scalable approach for 3D lane detection'

(pytorch) Gen-LaneNet: a generalized and scalable approach for 3D lane detection Introduction This is a pytorch implementation of Gen-LaneNet, which p

Use tensorflow to implement a Deep Neural Network for real time lane detection
Use tensorflow to implement a Deep Neural Network for real time lane detection

LaneNet-Lane-Detection Use tensorflow to implement a Deep Neural Network for real time lane detection mainly based on the IEEE IV conference paper "To

A lane detection integrated Real-time Instance Segmentation based on YOLACT (You Only Look At CoefficienTs)
A lane detection integrated Real-time Instance Segmentation based on YOLACT (You Only Look At CoefficienTs)

Real-time Instance Segmentation and Lane Detection This is a lane detection integrated Real-time Instance Segmentation based on YOLACT (You Only Look

BitPack is a practical tool to efficiently save ultra-low precision/mixed-precision quantized models.
BitPack is a practical tool to efficiently save ultra-low precision/mixed-precision quantized models.

BitPack is a practical tool that can efficiently save quantized neural network models with mixed bitwidth.

Ultra-Data-Efficient GAN Training: Drawing A Lottery Ticket First, Then Training It Toughly
Ultra-Data-Efficient GAN Training: Drawing A Lottery Ticket First, Then Training It Toughly

Ultra-Data-Efficient GAN Training: Drawing A Lottery Ticket First, Then Training It Toughly Code for this paper Ultra-Data-Efficient GAN Tra

Comments
  • "Use GPU" not functioning properly

    Hi there, I believe that "Use GPU" isn't working properly, I'm running Python 3.8.5 & OpenCV compiled with CUDA enabled as well as the Drivers and Toolkits needed.

    Clicking "Use GPU" does not save the checkmark (is that intended?), and the FPS remains the same, so I believe that it has no effect.

    Any tips to get it running with the GPU? It's unusable with 1.6 FPS so I'd love to get this working at a higher frame rate, thank you!

    PS: My GPU is a RTX 2060 so it should fit the specs.

    opened by ceddose 7
  • Software crashes upon pressing

    Software crashes upon pressing "settings"

    I followed the installation video, step by step and got the software installed. Upon launch, I press settings where the whole software crashes. I get the message "NameError: name 'wheel' is not defined. Screenshot_1

    opened by shambala12 3
  • V0.1.4

    V0.1.4

    V0.1.4 - 20.8.2022

    Minor Update

    Fixed

    • Removed a debug print.
    • Removed reduntant width and height from MainFile.py
    • Set default screencapture position to 0x0 to avoid confusion.
    opened by Tumppi066 0
Releases(v.1.0.0)
  • v.1.0.0(Aug 8, 2022)

    It seems that there is a problem with python 3.11 and 3.10 during installation of pyarrow, to fix this downgrade your python version to 3.9

    (This is fixed with the experimental version, as pyarrow is no longer a requirement.)

    Either download updater.exe or updater.py

    • They are both the same application, but I got some requests for an exe so it is now included. The exe will not detect the current installed version, so the .py is superior.
    • The installation script will always download the most up to date version of the app (optionally even development versions). It will also handle updates and show the current version change log.

    Current installer version is 0.5 (18.11.2022):

    • Added full support for the experimental branch, to see the current features head to my Trello.

    This is the only "release" the app will get (for the foreseeable future atleast) as the installation script always downloads the newest source.

    Source code(tar.gz)
    Source code(zip)
    updater.exe(9.25 MB)
    updater.py(13.36 KB)
Owner
null
Example scripts for the detection of lanes using the ultra fast lane detection model in Tensorflow Lite.

TFlite Ultra Fast Lane Detection Inference Example scripts for the detection of lanes using the ultra fast lane detection model in Tensorflow Lite. So

Ibai Gorordo 12 Aug 27, 2022
LaneDet is an open source lane detection toolbox based on PyTorch that aims to pull together a wide variety of state-of-the-art lane detection models

LaneDet is an open source lane detection toolbox based on PyTorch that aims to pull together a wide variety of state-of-the-art lane detection models. Developers can reproduce these SOTA methods and build their own methods.

TuZheng 405 Jan 4, 2023
LaneDetectionAndLaneKeeping - Lane Detection And Lane Keeping

LaneDetectionAndLaneKeeping This project is part of my bachelor's thesis. The go

null 5 Jun 27, 2022
Lane follower: Lane-detector (OpenCV) + Object-detector (YOLO5) + CAN-bus

Lane Follower This code is for the lane follower, including perception and control, as shown below. Environment Hardware Industrial Camera Intel-NUC(1

Siqi Fan 3 Jul 7, 2022
Find-Lane-Line - Use openCV library and Python to detect the road-lane-line

Find-Lane-Line This project is to use openCV library and Python to detect the road-lane-line. Data Pipeline Step one : Color Selection Step two : Cann

Kenny Cheng 3 Aug 17, 2022
A Data Annotation Tool for Semantic Segmentation, Object Detection and Lane Line Detection.(In Development Stage)

Data-Annotation-Tool How to Run this Tool? To run this software, follow the steps: git clone https://github.com/Autonomous-Car-Project/Data-Annotation

TiVRA AI 13 Aug 18, 2022
Based on Yolo's low-power, ultra-lightweight universal target detection algorithm, the parameter is only 250k, and the speed of the smart phone mobile terminal can reach ~300fps+

Based on Yolo's low-power, ultra-lightweight universal target detection algorithm, the parameter is only 250k, and the speed of the smart phone mobile terminal can reach ~300fps+

null 567 Dec 26, 2022
VIL-100: A New Dataset and A Baseline Model for Video Instance Lane Detection (ICCV 2021)

Preparation Please see dataset/README.md to get more details about our datasets-VIL100 Please see INSTALL.md to install environment and evaluation too

null 82 Dec 15, 2022
Python scripts for performing lane detection using the LSTR model in ONNX

ONNX LSTR Lane Detection Python scripts for performing lane detection using the Lane Shape Prediction with Transformers (LSTR) model in ONNX. Requirem

Ibai Gorordo 29 Aug 30, 2022
Ultra-lightweight human body posture key point CNN model. ModelSize:2.3MB HUAWEI P40 NCNN benchmark: 6ms/img,

Ultralight-SimplePose Support NCNN mobile terminal deployment Based on MXNET(>=1.5.1) GLUON(>=0.7.0) framework Top-down strategy: The input image is t

null 223 Dec 27, 2022