# YoloV5 DeepSORT Pytorch ROS
<img src="./doc/track_all.gif" width="400"/> <img src="./doc/track_pedestrians.gif" width="400"/>
## Introduction
This repository implements ROS packages to detect objects using `ROS`, `yolov5`, and to classify and track single objects using `Deepport algorithms`.
The source code of this repository is as follows.
* [mikel-brostrom/Yolov5_DeepSort_Pytorch](https://github.com/mikel-brostrom/Yolov5_DeepSort_Pytorch.git)
* [ultralytics/yolov5](https://github.com/ultralytics/yolov5)
This repository is described in `Korean` and `English`, and please refer to the following link.
* [한국어](./doc/README_KOR.md)
* [English](/README.md)
## Tutorials
* [Train Custom Data(External Link)](https://github.com/ultralytics/yolov5/wiki/Train-Custom-Data)
* [Training the RE-ID model(External Link)](https://github.com/ZQPei/deep_sort_pytorch#training-the-re-id-model)
## Before You Run Node
### 1. Configuring the Python3 environment for ROS Melodic
* YoloV5 runs in `Python 3 environments`. Therefore, before running the package, you must configure the node using Python 3 to run in the `ROS Medloic environment`.
```s
sudo apt-get install python3-pip python3-all-dev python3-yaml python3-rospkg
sudo apt-get install ros-melodic-desktop-full --fix-missing
sudo pip3 install rospkg catkin_pkg
```
* Error occurs when using `cv_bridge` in python3 environment. Therefore, you should rebuild the `cv_bridge` according to the melodic version.
```s
sudo apt-get install python-catkin-tools python3-catkin-pkg-modules
# Create catkin workspace
mkdir catkin_workspace
cd catkin_workspace
catkin init
# Instruct catkin to set cmake variables
catkin config -DPYTHON_EXECUTABLE=/usr/bin/python3 -DPYTHON_INCLUDE_DIR=/usr/include/python3.6m -DPYTHON_LIBRARY=/usr/lib/x86_64-linux-gnu/libpython3.6m.so
# Instruct catkin to install built packages into install place. It is $CATKIN_WORKSPACE/install folder
catkin config --install
# Clone cv_bridge src
git clone https://github.com/ros-perception/vision_opencv.git src/vision_opencv
# Find version of cv_bridge in your repository
apt-cache show ros-melodic-cv-bridge | grep Version
Version: 1.13.0-0bionic.20210505.032238
# Checkout right version in git repo. In our case it is 1.13.0
cd src/vision_opencv/
git checkout 1.13.0
cd ../../
# Build
catkin build cv_bridge
# Extend environment with new package
echo "source install/setup.bash --extend" >> bashrc
```
### 2. ROS Node Package Download
* Run clone with a repository that is dependent.
```s
cd your_workspace/src
git clone --recurse-submodules https://github.com/jungsuyun/yolov5_deepsort_ros.git
cd ..
catkin_make
```
If you did not do `--recurse-submodules`, you must run `git submodule update --init`.
* Ensure that all dependency information in Node is met. The package works with Python 3.6 or later and requires several dependency packages to be installed.
```s
pip3 install "numpy>=1.18.5,<1.20" "matplotlib>=3.2.2,<4"
pip3 install yolov5
pip3 install -r requirements.txt
```
* Github [prevents you from uploading more than 100MB of files](https://docs.github.com/en/github/managing-large-files/working-with-large-files/conditions-for-large-files). Therefore, you should download the weight file associated with Deepport.
* [Download the Depsort-specific weight file](https://drive.google.com/drive/folders/1xhG0kRH1EX5B9_Iz8gQJb7UNnn_riXi6). Download the ckpt.t7 file to the path `scripts/deep_sort_pytorch/deep_sort/deep/checkpoint/`.
## Run YoloV5 Deepsort Node
### 1. Run Detection Node
* The yolov5 detection node runs as follows:
```s
roslaunch yolov5_deepsort detector.launch
```
By default, the image topic that performs detection is `/image_raw`. If you want to change the Subscribe image topic, you need to modify the following part of `detector.launch`.
```xml
<arg name="image_topic" default="/image_raw"/>
```
If you want to detect only one or a few objects, not multiple objects, you need to modify the following parts of `detector.launch`. If you want to detect the entire class, you must enter None, and if you want to detect only a specific class, you must enter the class name.
```xml
<arg name="class_name" default='None'/>
<!-- <arg name="class_name" default='person'/> -->
```
### 2. Run Deep Sort Node
* yolov5 depthort node runs as follows:
```s
roslaunch yolov5_deepsort tracker.launch
```
By default, the image topic that performs detection is `/image_raw`. If you want to change the Subscribe image topic, you need to modify the following part of `detector.launch`.
```xml
<arg name="image_topic" default="/image_raw"/>
```
The initial value of the class that performs tracking is `person`. If you want to track another class, you need to modify the next part of 'detector.launch'.
```xml
<arg name="class_name" default='person'/>
```
### 3. Subscribe Topic
* [/image_raw](https://docs.ros.org/en/melodic/api/sensor_msgs/html/msg/Image.html) : Subscribe Image topic to detect objects.
### 4. Published Topic
* [/detected_objects_in_image](https://github.com/jungsuyun/yolov5_deepsort_ros/blob/melodic/msg/BoundingBox.msg)
* string Class
* float64 probability
* int64 xmin
* int64 ymin
* int64 xmax
* int64 ymax
* [/detections_image_topic](https://docs.ros.org/en/melodic/api/sensor_msgs/html/msg/Image.html) : Issue Image topic with bounding box, class name entered.
## TroubleShooting
#### ImportError: dynamic module does not define module export function (PyInit_cv_bridge_boost)
This error occurs when a python package related to cv_bridge_boost is not found. Open the cv_bridge/CMakelist.txt file in the folder where you installed the cv_bridge package and modify `found_package(Boost REQUIRED python3)` as follows:
```CMake
find_package(Boost REQUIRED python3-py36)
```
Then build and run cv_bridge again.
#### ImportError: cannot import name 'BoundingBox'
This error is caused by not building yolov5_deepport package. Go to catkin_ws, `catkin_make` and run the package again.
没有合适的资源?快使用搜索试试~ 我知道了~
将 yolov5-deepport 封装到 ROS.zip
共56个文件
py:29个
xml:4个
txt:4个
1.该资源内容由用户上传,如若侵权请联系客服进行举报
2.虚拟产品一经售出概不退款(资源遇到问题,请及时私信上传者)
2.虚拟产品一经售出概不退款(资源遇到问题,请及时私信上传者)
版权申诉
0 下载量 122 浏览量
2024-11-26
22:44:48
上传
评论
收藏 11.54MB ZIP 举报
温馨提示
将 yolov5-deepport 封装到 ROSYoloV5 DeepSORT Pytorch ROS 介绍本仓库实现了 ROS 包ROS,使用yolov5、 来检测物体,使用 来对单个物体进行分类和跟踪Deepport algorithms。本仓库的源代码如下。米克尔-布罗斯特罗姆/Yolov5_DeepSort_Pytorchultralytics/yolov5Korean该存储库在和中有描述English,请参考以下链接。韩国英语教程训练自定义数据(外部链接)训练 RE-ID 模型(外部链接)运行 Node 之前1.为ROS Melodic配置Python3环境YoloV5 在 中运行Python 3 environments。因此,在运行该包之前,必须使用 Python 3 配置节点以在 中运行ROS Medloic environment。sudo apt-get install python3-pip python3-all-dev python3-yaml python3-rospkgsudo apt-get install
资源推荐
资源详情
资源评论
收起资源包目录
将 yolov5-deepport 封装到 ROS.zip (56个子文件)
CMakeLists.txt 7KB
标签.txt 4B
.gitattributes 66B
doc
track_all.gif 7.83MB
track_pedestrians.gif 3.63MB
README_KOR.md 7KB
LICENSE 1KB
package.xml 1008B
.idea
vcs.xml 180B
workspace.xml 4KB
inspectionProfiles
Project_Default.xml 1KB
.gitmodules 311B
资源内容.txt 813B
launch
detector.launch 2KB
tracker.launch 2KB
requirements.txt 379B
.gitignore 1KB
msg
BoundingBoxes.msg 2KB
BoundingBox.msg 2KB
README.md 6KB
scripts
tracker.py 12KB
detector.py 9KB
deep_sort_pytorch
LICENSE 1KB
configs
deep_sort.yaml 208B
utils
evaluation.py 3KB
__init__.py 0B
draw.py 1KB
parser.py 972B
log.py 463B
asserts.py 316B
io.py 4KB
tools.py 734B
json_logger.py 11KB
deep_sort
__init__.py 500B
sort
track.py 5KB
kalman_filter.py 8KB
__init__.py 0B
detection.py 1KB
tracker.py 5KB
iou_matching.py 3KB
preprocessing.py 2KB
nn_matching.py 5KB
linear_assignment.py 8KB
deep_sort.py 4KB
deep
__init__.py 0B
checkpoint
.gitkeep 0B
evaluate.py 294B
feature_extractor.py 2KB
model.py 3KB
original_model.py 3KB
train.jpg 59KB
train.py 6KB
test.py 2KB
README.md 65B
.gitignore 89B
README.md 5KB
共 56 条
- 1
资源评论
赵闪闪168
- 粉丝: 1551
- 资源: 3077
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
最新资源
资源上传下载、课程学习等过程中有任何疑问或建议,欢迎提出宝贵意见哦~我们会及时处理!
点击此处反馈
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功