YOLO-v5 기반 단안 카메라의 영상을 활용해 차간 거리를 일정하게 유지하며 주행하는 Adaptive Cruise Control 기능 구현

Overview

자율 주행차의 영상 기반 차간거리 유지 개발

Table of Contents


프로젝트 소개


YOLO-v5 기반으로 단안 카메라의 영상을 활용해 차간 거리를 일정하게 유지하며 주행하는 Adaptive Cruise Control 기능을 제공한다.


주요 기능

객체 인식

  • 복도에서의 차량 카트 이미지를 촬영하여 커스텀 데이터셋을 제작
  • YOLO-v5 모델 중 가장 초당 프레임 수 가 높은 YOLO-v5s에 커스텀 데이터셋을 학습
  • 라즈베리파이에 부착된 웹캠을 통해 실시간으로 전방 차량 인식

거리 측정

  • 객체 인식 시 나타나는 Bounding box의 좌표값을 추출하여 대상과의 거리가 1m 일 때 Bounding box의 높이와 너비값을 측정
  • 이후 인식된 객체의 Bounding box 높이와 너비값과 1m 일 때의 Bounding box 높이와 너비값의 비례식을 통해 거리를 측정

거리 유지

  • 측정된 거리 기반으로 동작을 나누어 시리얼 통신을 통해 동작 신호를 cart 조작하는 STM보드에 전달
  • STM보드에서 전달받은 신호를 기반으로 PWM 제어를 통해 차간 거리가 유지되도록 속도 조절

시스템 구조

객체 인식 및 거리측정 시스템 구조

거리유지 시스템 구조

거리측정 알고리즘

  • 카메라의 해상도에 따라 1m에서 기준이 되는 Bounding box의 width와 height의 크기가 달라진다

디렉토리 구조

adaptive-cruise-control
├── cart
│   ├── main_arm.c
│   ├── main_cart.c
│   └── README.md
│
├── dataset
│   └── ...
│
├── yolov5
│   ├── detect_custom.py
│   ├── cart_model.pt
│   └── ...
│
└── README.md

결과

실시간 객체 인식 및 거리측정

  • 학습된 가중치 모델을 바탕으로 단안 카메라를 이용하여 전방 차량 키트를 인식하였다.

  • 인식된 차량 키트에 대한 Bounding box에서 왼쪽부터 클래스명, 예측 정확도, 단안 카메라 기준 예측 거리(cm) 를 나타낸다.

  • 인식 결과, 이미지 크기 128*128 기준 평균적으로 초당 약 3 프레임의 속도로 동작하였으며, 최대 5m까지 높은 정확도로 인식됨을 확인할 수 있었다.

  • 거리 예측 오차율 측정 결과

실제 거리 측정 최소 거리 측정 최대 거리 최대 오차율
0.5m 0.47m 0.53m 6%
1m 0.96m 1.02m 3%
2m 1.98m 2.02m 1%
3m 2.85m 2.94m 5%
5m 4.65m 5.05m 7%

거리유지

동작 설정

  1. 전방 차량과의 거리가 70cm보다 가까워진 경우 차량 정지
  2. 전방 차량과의 거리가 70cm ~ 120cm인 경우 큰 폭으로 속도 감소
  3. 전방 차량과의 거리가 120cm ~ 150cm 인 경우 작은 폭으로 속도 감소
  4. 전방 차량이 없거나 거리가 150cm 보다 먼 경우 원래 주행 속도로 복구

거리유지 기능 실험 결과

  • 기준 주행 속도는 차량 키트가 스스로 움직일 수 있는 최저 속도로 설정하였다.
  • 테스트 결과, 거리가 1m에 가까워 지면 상당히 속도가 줄어들었고 0.7m에 이르면 차량 키트가 완전히 정지하였으며, 전방에 가까운 차량이 없으면 원래의 주행 속도로 돌아오는 기능 또한 정상적으로 동작함을 확인할 수 있었다.

실행 방법

YOLO v5를 활용한 실시간 객체 인식 및 거리 예측

  1. https://github.com/sungjuGit/Pytorch-and-Vision-for-Raspberry-Pi-4B 에서 Pytorch, Pytorch Vision 설치에 필요한 wheel 파일을 라즈베리파이에 다운로드한다.

  2. sudo pip3 install torch-1.8.0a0+56b43f4-cp37-cp37m-linux_armv7l.whl
    sudo pip3 install torchvision-0.9.0a0+8fb5838-cp37-cp37m-linux_armv7l.whl

  3. adative-cruise-control/yolov5를 라즈베리파이에 클론한다.

  4. pip3 install -r requirements.txt으로 필요한 종속 라이브러리를 설치한다.

  5. python3 detect_custom.py --weights cart_model.pt --img 128 --conf 0.4 --source 0 으로 실시간 객체 인식 및 거리 예측을 한다.

detect_custom.py : 객체인식 및 거리 예측을 위한 파이썬 파일
cart_model.pt : 커스텀 이미지로 학습된 yolo-v5s 가중치 모델


거리 예측을 바탕으로 카트 구동

  1. https://github.com/icns-distributed-cloud/Self-driving-project 을 노트북에 클론한다.

  2. Self-driving-project/2021_self_driving_cart/robot_arm_basic/Src/main.cadaptive-cruise-control/cart/main_arm.c으로 대치시킨다.

  3. Self-driving-project/2021_self_driving_cart/cart/Src/main.cadaptive-cruise-control/cart/main_cart.c으로 대치시킨다.

  4. ICNS Lab에서 제작한 카트에 있는 STM-Arm Board, STM-Cart Board에 각 코드를 디버깅한다.


Custom Dataset을 통한 YOLO-v5 Model 학습 방법

  • 데이터셋 수정을 통해 발전된 학습모델 제작을 원할 시 링크 참조

참조


팀원


👆 Back To The Top

Mixed Transformer UNet for Medical Image Segmentation

MT-UNet Update 2021/11/19 Thank you for your interest in our work. We have uploaded the code of our MTUNet to help peers conduct further research on i

dotman 92 Dec 25, 2022
MMdet2-based reposity about lightweight detection model: Nanodet, PicoDet.

Lightweight-Detection-and-KD MMdet2-based reposity about lightweight detection model: Nanodet, PicoDet. This repo also includes detection knowledge di

Egqawkq 12 Jan 05, 2023
Neural networks applied in recognizing guitar chords using python, AutoML.NET with C# and .NET Core

Chord Recognition Demo application The demo application is written in C# with .NETCore. As of July 9, 2020, the only version available is for windows

Andres Mauricio Rondon Patiño 24 Oct 22, 2022
Unsupervised CNN for Single View Depth Estimation: Geometry to the Rescue

Realtime Unsupervised Depth Estimation from an Image This is the caffe implementation of our paper "Unsupervised CNN for single view depth estimation:

Ravi Garg 227 Nov 28, 2022
Hierarchical Attentive Recurrent Tracking

Hierarchical Attentive Recurrent Tracking This is an official Tensorflow implementation of single object tracking in videos by using hierarchical atte

Adam Kosiorek 147 Aug 07, 2021
Code & Data for Enhancing Photorealism Enhancement

Code & Data for Enhancing Photorealism Enhancement

Intel ISL (Intel Intelligent Systems Lab) 1.1k Jan 08, 2023
Simple and Robust Loss Design for Multi-Label Learning with Missing Labels

Simple and Robust Loss Design for Multi-Label Learning with Missing Labels Official PyTorch Implementation of the paper Simple and Robust Loss Design

Xinyu Huang 28 Oct 27, 2022
Tracking Progress in Question Answering over Knowledge Graphs

Tracking Progress in Question Answering over Knowledge Graphs Table of contents Question Answering Systems with Descriptions The QA Systems Table cont

Knowledge Graph Question Answering 47 Jan 02, 2023
LaBERT - A length-controllable and non-autoregressive image captioning model.

Length-Controllable Image Captioning (ECCV2020) This repo provides the implemetation of the paper Length-Controllable Image Captioning. Install conda

bearcatt 53 Nov 13, 2022
Implementation of C-RNN-GAN.

Implementation of C-RNN-GAN. Publication: Title: C-RNN-GAN: Continuous recurrent neural networks with adversarial training Information: http://mogren.

Olof Mogren 427 Dec 25, 2022
Implementation of the master's thesis "Temporal copying and local hallucination for video inpainting".

Temporal copying and local hallucination for video inpainting This repository contains the implementation of my master's thesis "Temporal copying and

David Álvarez de la Torre 1 Dec 02, 2022
Robotics with GPU computing

Robotics with GPU computing Cupoch is a library that implements rapid 3D data processing for robotics using CUDA. The goal of this library is to imple

Shirokuma 625 Jan 07, 2023
This is the official implementation of Elaborative Rehearsal for Zero-shot Action Recognition (ICCV2021)

Elaborative Rehearsal for Zero-shot Action Recognition This is an official implementation of: Shizhe Chen and Dong Huang, Elaborative Rehearsal for Ze

DeLightCMU 26 Sep 24, 2022
Code-free deep segmentation for computational pathology

NoCodeSeg: Deep segmentation made easy! This is the official repository for the manuscript "Code-free development and deployment of deep segmentation

André Pedersen 26 Nov 23, 2022
Conservative and Adaptive Penalty for Model-Based Safe Reinforcement Learning

Conservative and Adaptive Penalty for Model-Based Safe Reinforcement Learning This is the official repository for Conservative and Adaptive Penalty fo

7 Nov 22, 2022
Text to image synthesis using thought vectors

Text To Image Synthesis Using Thought Vectors This is an experimental tensorflow implementation of synthesizing images from captions using Skip Though

Paarth Neekhara 2.1k Jan 05, 2023
Official PyTorch code for Hierarchical Conditional Flow: A Unified Framework for Image Super-Resolution and Image Rescaling (HCFlow, ICCV2021)

Hierarchical Conditional Flow: A Unified Framework for Image Super-Resolution and Image Rescaling (HCFlow, ICCV2021) This repository is the official P

Jingyun Liang 159 Dec 30, 2022
DETReg: Unsupervised Pretraining with Region Priors for Object Detection

DETReg: Unsupervised Pretraining with Region Priors for Object Detection Amir Bar, Xin Wang, Vadim Kantorov, Colorado J Reed, Roei Herzig, Gal Chechik

Amir Bar 283 Dec 27, 2022
The PASS dataset: pretrained models and how to get the data - PASS: Pictures without humAns for Self-Supervised Pretraining

The PASS dataset: pretrained models and how to get the data - PASS: Pictures without humAns for Self-Supervised Pretraining

Yuki M. Asano 249 Dec 22, 2022
This repository contains PyTorch code for Robust Vision Transformers.

This repository contains PyTorch code for Robust Vision Transformers.

117 Dec 07, 2022