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

[NeurIPS-2020] Self-paced Contrastive Learning with Hybrid Memory for Domain Adaptive Object Re-ID.

Self-paced Contrastive Learning (SpCL) The official repository for Self-paced Contrastive Learning with Hybrid Memory for Domain Adaptive Object Re-ID

Yixiao Ge 286 Dec 21, 2022
The code of paper "Block Modeling-Guided Graph Convolutional Neural Networks".

Block Modeling-Guided Graph Convolutional Neural Networks This repository contains the demo code of the paper: Block Modeling-Guided Graph Convolution

22 Dec 08, 2022
DeepLab resnet v2 model in pytorch

pytorch-deeplab-resnet DeepLab resnet v2 model implementation in pytorch. The architecture of deepLab-ResNet has been replicated exactly as it is from

Isht Dwivedi 601 Dec 22, 2022
IAST: Instance Adaptive Self-training for Unsupervised Domain Adaptation (ECCV 2020)

This repo is the official implementation of our paper "Instance Adaptive Self-training for Unsupervised Domain Adaptation". The purpose of this repo is to better communicate with you and respond to y

CVSM Group - email: <a href=[email protected]"> 84 Dec 12, 2022
Python lib to talk to pylontech lithium batteries (US2000, US3000, ...) using RS485

python-pylontech Python lib to talk to pylontech lithium batteries (US2000, US3000, ...) using RS485 What is this lib ? This lib is meant to talk to P

Frank 26 Dec 28, 2022
Implementation of "A Deep Learning Loss Function based on Auditory Power Compression for Speech Enhancement" by pytorch

This repository is used to suspend the results of our paper "A Deep Learning Loss Function based on Auditory Power Compression for Speech Enhancement"

ScorpioMiku 19 Sep 30, 2022
A Neural Net Training Interface on TensorFlow, with focus on speed + flexibility

Tensorpack is a neural network training interface based on TensorFlow. Features: It's Yet Another TF high-level API, with speed, and flexibility built

Tensorpack 6.2k Jan 01, 2023
Source code for paper "Deep Superpixel-based Network for Blind Image Quality Assessment"

DSN-IQA Source code for paper "Deep Superpixel-based Network for Blind Image Quality Assessment" Requirements Python =3.8.0 Pytorch =1.7.1 Usage wit

7 Oct 13, 2022
(CVPR 2022) Energy-based Latent Aligner for Incremental Learning

Energy-based Latent Aligner for Incremental Learning Accepted to CVPR 2022 We illustrate an Incremental Learning model trained on a continuum of tasks

Joseph K J 37 Jan 03, 2023
Grad2Task: Improved Few-shot Text Classification Using Gradients for Task Representation

Grad2Task: Improved Few-shot Text Classification Using Gradients for Task Representation Prerequisites This repo is built upon a local copy of transfo

Jixuan Wang 10 Sep 28, 2022
MRQy is a quality assurance and checking tool for quantitative assessment of magnetic resonance imaging (MRI) data.

Front-end View Backend View Table of Contents Description Prerequisites Running Basic Information Measurements User Interface Feedback and usage Descr

Center for Computational Imaging and Personalized Diagnostics 58 Dec 02, 2022
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
Annotated, understandable, and visually interpretable PyTorch implementations of: VAE, BIRVAE, NSGAN, MMGAN, WGAN, WGANGP, LSGAN, DRAGAN, BEGAN, RaGAN, InfoGAN, fGAN, FisherGAN

Overview PyTorch 0.4.1 | Python 3.6.5 Annotated implementations with comparative introductions for minimax, non-saturating, wasserstein, wasserstein g

Shayne O'Brien 471 Dec 16, 2022
CoTr: Efficiently Bridging CNN and Transformer for 3D Medical Image Segmentation

CoTr: Efficient 3D Medical Image Segmentation by bridging CNN and Transformer This is the official pytorch implementation of the CoTr: Paper: CoTr: Ef

218 Dec 25, 2022
Demonstrational Session git repo for H SAF User Workshop (28/1)

5th H SAF User Workshop The 5th H SAF User Workshop supported by EUMeTrain will be held in online in January 24-28 2022. This repository contains inst

H SAF 4 Aug 04, 2022
Official repository for the NeurIPS 2021 paper Get Fooled for the Right Reason: Improving Adversarial Robustness through a Teacher-guided curriculum Learning Approach

Get Fooled for the Right Reason Official repository for the NeurIPS 2021 paper Get Fooled for the Right Reason: Improving Adversarial Robustness throu

Sowrya Gali 1 Apr 25, 2022
A system for quickly generating training data with weak supervision

Programmatically Build and Manage Training Data Announcement The Snorkel team is now focusing their efforts on Snorkel Flow, an end-to-end AI applicat

Snorkel Team 5.4k Jan 02, 2023
Repository for "Toward Practical Monocular Indoor Depth Estimation" (CVPR 2022)

Toward Practical Monocular Indoor Depth Estimation Cho-Ying Wu, Jialiang Wang, Michael Hall, Ulrich Neumann, Shuochen Su [arXiv] [project site] DistDe

Meta Research 122 Dec 13, 2022
An Exact Solver for Semi-supervised Minimum Sum-of-Squares Clustering

PC-SOS-SDP: an Exact Solver for Semi-supervised Minimum Sum-of-Squares Clustering PC-SOS-SDP is an exact algorithm based on the branch-and-bound techn

Antonio M. Sudoso 1 Nov 13, 2022
PyExplainer: A Local Rule-Based Model-Agnostic Technique (Explainable AI)

PyExplainer PyExplainer is a local rule-based model-agnostic technique for generating explanations (i.e., why a commit is predicted as defective) of J

AI Wizards for Software Management (AWSM) Research Group 14 Nov 13, 2022