Skip to content

Latest commit

 

History

History
90 lines (54 loc) · 2.92 KB

README.md

File metadata and controls

90 lines (54 loc) · 2.92 KB

ros2yolo_python(fast->use that)

this project is basis in date of 2021/04/08

if you use this, yolo get image in your webcam and detect class(80) and there's coordinates on image{x,y,w,h} and label of class ,and original image send to ros2 as publish.

getting weights_file

https://drive.google.com/file/d/1cewMfusmPjYWbrnuJRuKhPMwRe_b9PaT/view is named yolov4.weights

you need .cfg, .names, .weights file for yolo in ros2 if you download .weights file in that link, you put that in ~rosyolo_final/(in that dir, there are cfg folder, and then you can check .cfg and .names)

also check rosyolo_final/ros2yolo/ros2yolo/ros2_yolo.py (there is key code for yolo data sending to ros2)

and check what is

  • yolo_image : yolo + original_image -> .jpg(yolo result)
  • original_image : original_image -> .jpg(you want conveying to yolo)
  • dir_weights : where is .weights
  • dir_cfg : where is .cfg
  • dir_coco : where is .names

*path1 is used for if you want sending yolo_image or original image to otehr directory


basis issue

this code use your webcam, if you don't have webcam in notebook you need other external webcam and usd connet to notebook modify vc = cv2.VideoCapture(0) # 0 = notebook_webcam, 2 = usb_webcam (in my computer) in ros2_yolo.py

if you want to modify publishing frequency(basis is 1) modifiy ros2yolo_publisher = Ros2yoloPublisher(1)

if you need to other size in yolo(basis is 416*416) check blob = cv2.dnn.blobFromImage(image, 0.00392, (416, 416), (0, 0, 0), True, crop=False) #it about detect_size.

source /opt/ros/foxy/setup.bash


use that

  1. git clone https://github.com/Profrog/ros2yolo_python
  2. colcon build
  3. source install/setup.bash
  4. ros2 run ros2yolo ros2_yolo

example


system setting

### about yolo

yolo version : yolov4

notebook : HP-Pavilion-Gaming-Laptop-16-a0xxx
process : Intel® Core™ i7-10750H CPU @ 2.60GHz × 12
gpu1 : NVIDIA Corporation TU116M [GeForce GTX 1660 Ti Mobile]
gpu2 : Intel Corporation UHD Graphics
cuda: 11.2
cuDNN : v8.1.1
NVIDIA-SMI 460.39
Driver Version: 460.39
opencv :4.4.0
python :3.8.5
cmake : 3.20.0
os : Ubuntu 20.04.2 LTS x86_64

### about ros2

ros2 version : foxy

ros2 and yolo tutorial(for that setting)