Lane follower: Lane-detector (OpenCV) + Object-detector (YOLO5) + CAN-bus

Overview

Lane Follower

This code is for the lane follower, including perception and control, as shown below.

Structure

Environment

  1. Hardware
    • Industrial Camera
    • Intel-NUC(10FNK)
  2. Software
    • Ubuntu18.04
    • Python3.6
    • OpenCV4.2
    • PyTorch1.8.1

    See environment.txt for details.

How to use

A. Offline Testing

The code supports the offline testing, which takes the offline video as input and output the demo video.

python offline_test.py

B. OnLine Testing

The code also supports the online testing, which takes the real-time video streaming from the industrial camera as input and controls the vehicle.

python online_test.py

C. Demo

You can find the offline testing video and the corresponding demo video here [n25o].

demo

Details

Detailed structure

detailed-structure

Code Info

  • offline_test.py --- Offline testing

  • online_test.py --- Online testing

  • basic_function --- Some Basic Function

    • show_img(name, img): Show the image
    • find_files(directory, pattern): Method to find target files in one directory, including subdirectory
    • get_M_Minv(): Get Perspective Transform
    • draw_area(img_origin, img_line, Minv, left_fit, right_fit): Draw the road area in the image
    • draw_demo(img_result, img_bin, img_canny, img_line, img_line_warp, img_bev_result, curvature, distance_from_center, steer): Generate the Demo image
  • lib_camera --- Class for the industrial camera

    • open(): Open the camera
    • grab(): Grab an image from the camera
    • close(): Close the camera
  • mvsdk --- Official lib for the industrial camera

  • lib_can --- Class for the CAN

    • OpenDevice(): Open the CAN device
    • InitCAN(can_idx=0): Init the CAN
    • StartCan(can_idx=0): Start the CAN
    • Send(can_idx, id, frame_len, data): Send messages to CAN
    • Listen(can_idx, id, try_cnt=10): Receive messages from CAN
    • CloseDevice(): Close the CAN device
  • lib_LaneDetector --- Class for the lane detector

    • detect_line(img_input, steer, memory, debug=False): Main Function
    • pre_process(img, debug=False): Image Preprocessing
    • find_line(img, memory, debug=False): Detect the lane using Sliding Windows Methods
    • calculate_curv_and_pos(img_line, left_fit, right_fit): Calculate the curvature & distance from the center
  • lib_ObjectDetector --- Class for the traffic object detector based on YOLO5

    • load_model(): Load Yolo5 model from pytorch hub
    • detect(frame, img_area): Predict and analyze using yolo5
    • class_to_label(idx): Return the corresponding string label for a given label value
    • plot_detections(results, frame): Takes a frame and its results as input, and plots the bounding boxes and label on to the frame
  • lib_vehicle --- Class for the vehicle model and vehicle control

    • steer_cal(curvature, dist_from_center): Calculate the steer according to the curvature of the lane and the distance form the center
    • steer_ctrl(): Control the steer by sending the signal via CAN
    • steer_get(): Get the real steer of the vehicle via the CAN
  • libcontrolcan.so --- DLL for the CAN device

  • libMVSDK.so --- DLL for the industrial camera

Owner
Siqi Fan
Graduate Student @ IA, CAS (2019 ~ now) B.E. @ Shanghai Jiao Tong University (SJTU,2015~2019)
Siqi Fan
PyTorch implementation for Score-Based Generative Modeling through Stochastic Differential Equations (ICLR 2021, Oral)

Score-Based Generative Modeling through Stochastic Differential Equations This repo contains a PyTorch implementation for the paper Score-Based Genera

Yang Song 757 Jan 04, 2023
Deep deconfounded recommender (Deep-Deconf) for paper "Deep causal reasoning for recommendations"

Deep Causal Reasoning for Recommender Systems The codes are associated with the following paper: Deep Causal Reasoning for Recommendations, Yaochen Zh

Yaochen Zhu 22 Oct 15, 2022
This is a GUI interface which can process forest fire detection, smoke detection and fire segmentation

This is a GUI interface which can process forest fire detection, smoke detection and fire segmentation. Yolov5 is used to detect fire and smoke and unet is used to segment fire.

7 Jan 08, 2023
Image Segmentation with U-Net Algorithm on Carvana Dataset using AWS Sagemaker

Image Segmentation with U-Net Algorithm on Carvana Dataset using AWS Sagemaker This is a full project of image segmentation using the model built with

Htin Aung Lu 1 Jan 04, 2022
a curated list of docker-compose files prepared for testing data engineering tools, databases and open source libraries.

data-services A repository for storing various Data Engineering docker-compose files in one place. How to use it ? Set the required settings in .env f

BigData.IR 525 Dec 03, 2022
A fast Evolution Strategy implementation in Python

Evostra: Evolution Strategy for Python Evolution Strategy (ES) is an optimization technique based on ideas of adaptation and evolution. You can learn

Mika 251 Dec 08, 2022
Very Deep Convolutional Networks for Large-Scale Image Recognition

pytorch-vgg Some scripts to convert the VGG-16 and VGG-19 models [1] from Caffe to PyTorch. The converted models can be used with the PyTorch model zo

Justin Johnson 217 Dec 05, 2022
ConformalLayers: A non-linear sequential neural network with associative layers

ConformalLayers: A non-linear sequential neural network with associative layers ConformalLayers is a conformal embedding of sequential layers of Convo

Prograf-UFF 5 Sep 28, 2022
A high-level Python library for Quantum Natural Language Processing

lambeq About lambeq is a toolkit for quantum natural language processing (QNLP). Documentation: https://cqcl.github.io/lambeq/ User support: lambeq-su

Cambridge Quantum 315 Jan 01, 2023
Black-Box-Tuning - Black-Box Tuning for Language-Model-as-a-Service

Black-Box-Tuning Source code for paper "Black-Box Tuning for Language-Model-as-a

Tianxiang Sun 149 Jan 04, 2023
SLIDE : In Defense of Smart Algorithms over Hardware Acceleration for Large-Scale Deep Learning Systems

The SLIDE package contains the source code for reproducing the main experiments in this paper. Dataset The Datasets can be downloaded in Amazon-

Intel Labs 72 Dec 16, 2022
Pytorch implementation of various High Dynamic Range (HDR) Imaging algorithms

Deep High Dynamic Range Imaging Benchmark This repository is the pytorch impleme

Tianhong Dai 5 Nov 16, 2022
TensorLight - A high-level framework for TensorFlow

TensorLight is a high-level framework for TensorFlow-based machine intelligence applications. It reduces boilerplate code and enables advanced feature

Benjamin Kan 10 Jul 31, 2022
TensorFlow implementation of Style Transfer Generative Adversarial Networks: Learning to Play Chess Differently.

Adversarial Chess TensorFlow implementation of Style Transfer Generative Adversarial Networks: Learning to Play Chess Differently. Requirements To run

Muthu Chidambaram 30 Sep 07, 2021
Density-aware Single Image De-raining using a Multi-stream Dense Network (CVPR 2018)

DID-MDN Density-aware Single Image De-raining using a Multi-stream Dense Network He Zhang, Vishal M. Patel [Paper Link] (CVPR'18) We present a novel d

He Zhang 224 Dec 12, 2022
A privacy-focused, intelligent security camera system.

Self-Hosted Home Security Camera System A privacy-focused, intelligent security camera system. Features: Multi-camera support w/ minimal configuration

Scott Barnes 175 Jan 01, 2023
Optimal Adaptive Allocation using Deep Reinforcement Learning in a Dose-Response Study

Optimal Adaptive Allocation using Deep Reinforcement Learning in a Dose-Response Study Supplementary Materials for Kentaro Matsuura, Junya Honda, Imad

Kentaro Matsuura 4 Nov 01, 2022
Totally Versatile Miscellanea for Pytorch

Totally Versatile Miscellania for PyTorch Thomas Viehmann [email protected] Thi

Thomas Viehmann 428 Dec 28, 2022
Implementation of Geometric Vector Perceptron, a simple circuit for 3d rotation equivariance for learning over large biomolecules, in Pytorch. Idea proposed and accepted at ICLR 2021

Geometric Vector Perceptron Implementation of Geometric Vector Perceptron, a simple circuit with 3d rotation equivariance for learning over large biom

Phil Wang 59 Nov 24, 2022
Demo for the paper "Overlap-aware low-latency online speaker diarization based on end-to-end local segmentation"

Streaming speaker diarization Overlap-aware low-latency online speaker diarization based on end-to-end local segmentation by Juan Manuel Coria, Hervé

Juanma Coria 187 Jan 06, 2023