I tried using YOLO v4 on Ubuntu and ROS


Recently, YOLOv5 (although there seems to be pros and cons) came out, so I decided to change from YOLOv3 to YOLOv4, which is a little outdated, but I could not find a setup article in the ROS (Robot Operating System) environment. I will summarize it as a memorandum.

Summary of each version of YOLO (Qiita)

Execution environment

This time, we confirmed the operation on Ubuntu 16.04 and Ubuntu 18.04. Details are below.

OS Ubuntu16.04.6 LTS Ubuntu18.04.5 LTS
CPU Intel Core i7-8700 Intel Core i5-6500
GPU Geforce GTX 1080 Ti Geforce GTX 960
ROS Kinetic 1.12.14 Merodic 1.14.9
Nvidia Driver 450.51.06 440.100
CUDA(toolkit) 8.0 10.2
cuDNN 7 7

This time, we will proceed on the premise that the above environment is in place.


Currently, evacuate the ** darknet_ros package ** under ** ~ / catkin_ws / src / **. Create a backup directory (YOLOv3 this time) in your home directory and move it there.


#Please execute line by line

$ cd
$ mkdir YOLOv3
$ cd ~/catkin_ws/src
$ mv darknet_ros ~/YOLOv3

Next, clone the ** darknet_ros ** package for YOLO v4 by referring to the following. YOLO V4 for darknet_ros When I cloned with the command written in the link destination, ** yolov4-for-darknet_ros package **, a package one level higher than darknet_ros, was installed, and in my case catkin_make did not pass. I changed it to the following and it worked.


$ cd ~/catkin_ws/src
$ git clone --recursive https://github.com/Tossy0423/darknet_ros.git
$ cd ..
$ catkin_make

If make passes, you're done.


This ** darknet_ros uses ** uvc_camera ** as the driver for the ** USB camera. In my case, I'm using ** usb_cam ** as a driver, so I had to change the camera node that darknet received when testing.

Change before

1 subscribers:
3  camera_reading:
4    topic: /camera/rgb/image_row
5    queue_size: 1

After change

1 subscribers:
3  camera_reading:
4    topic: /usb_cam/image_row
5    queue_size: 1


I tried an operation test.


#Run on two terminals

# darknet_ros node launch
$ roslaunch darknet_ros yolov4.launch

#Launch camera node
$ roslaunch usb_cam usb_cam-test.launch


I was able to display it nicely. that's all.

Recommended Posts

I tried using YOLO v4 on Ubuntu and ROS
Installing and using Ansible on Ubuntu 16.04
Microservices 101-I tried putting Docker on Ubuntu-
I introduced WSL2 + Ubuntu to Window10 and tried using GDC, DMD, LDC
I tried using Junit on Mac VScode Maven
[Android] I quit SQLite and tried using Realm
I tried using Gson
I tried using TestNG
I tried using Galasa
I tried using "nifty cloud mobile backend" and "Firebase" Authentication on Kotlin + Android
I tried using Docker Desktop for Windows on Windows 10 Home
I installed CentOS 8 on Windows 10 using VirtualBox and Vagrant
Using Flutter on Ubuntu (Part 2)
I tried using azure cloud-init
I tried using Apache Wicket
I tried using Java REPL
I tried unit testing Rails app using RSpec and FactoryBot
[Rails] I tried to implement "Like function" using rails and js
I tried using anakia + Jing now
Using Azure IOT Hub on Ubuntu 20.10.
Install JDK and JRE on Ubuntu 16.10
I tried using Spring + Mybatis + DbUnit
Install ngrok on ubuntu16.04 using Vagrant
I tried using JOOQ with Gradle
I tried to integrate Docker and Maven / Netbean nicely using Jib
I tried using Java8 Stream API
I tried using JWT in Java
Enable Java 8 and Java 11 SDKs on Ubuntu
[Android] I tried using Coordinator Layout.
I tried installing CentOS 8 on ESXi 6.7
I tried using Pari gp container
I tried to display the calendar on the Eclipse console using Java.
I tried backing up MSX programs from cassette tape on Ubuntu
I tried using WebAssembly Stadio (2018/4/17 version)
I tried using Java memo LocalDate
Install Docker on Ubuntu and set up remote connection using tls
I tried using GoogleHttpClient of Java
I tried to make my own transfer guide using OpenTripPlanner and GTFS
I tried using Elasticsearch API in Java
I tried using Realm with Swift UI
I tried running Docker on Windows Server 2019
I tried using Java's diagnostic tool Arthas
I tried using UICollectionViewListCell added from Xcode12.
I tried using Scalar DL with Docker
I want to install PHP 7.2 on Ubuntu 20.04.
It's new, but I tried using Groonga
Until you run CuPy (v11.1) on Ubuntu 20.04
I tried using OpenCV with Java + Tomcat
I tried to build AdoptOpenjdk 11 on CentOS 7
Run Ubuntu + ROS with Docker on Mac
I built a Java EE environment on AWS and tried running a web application
[JDBC ③] I tried to input from the main method using placeholders and arguments.
Creating an SSL certificate using Let's Encrypt and setting up Nginx on Ubuntu 20
I was addicted to using RXTX on Sierra
[For beginners] I tried using DBUnit in Eclipse
Install java and android-sdk on Mac using homebrew
I tried putting Java on my Mac easily
I tried barcode scanning using Rails + React + QuaggaJS
Build and install Wireshark Development Release (3.3.1) on Ubuntu
Using JUnit from the command line on Ubuntu
Publish MySQL externally and log in on Ubuntu