把re.txt文件里的torch等注释了。 根据电脑显卡配pytorch版本,试过2080ti(CUDA11.7)和3060显卡(CUDA11.2),只能使用pytorch-1.10.0:
1、进入pytorch地址:
https://pytorch.org/get-started/previous-versions/
2、找到1.10.0版本的命令,运行:
# CUDA 11.1
pip install torch==1.10.0+cu111 torchvision==0.11.0+cu111 torchaudio==0.10.0 -f https://download.pytorch.org/whl/torch_stable.html
This package provides a ROS wrapper for PyTorch-YOLOv5 based on PyTorch-YOLOv5. The package has been tested with Ubuntu 16.04 and Ubuntu 18.04.
V1.0.1: Add device options(cpu or gpu).
Authors: Zhitao Zheng (qq44642754@163.com)
- Ubuntu 16.04 / 18.04
- ROS Kinetic / Melodic
- Python>=3.6.0 environment, including PyTorch>=1.7
1. First download the corresponding installation package Anaconda
bash ~/Downloads/Anaconda3-2021.05-Linux-x86_64.sh
export PATH=/home/your/anaconda3/bin:$PATH
source ~/.bashrc
conda create -n mypytorch python=3.8
conda activate mypytorch
Install PyTorch: https://pytorch.org/get-started/locally/
conda install pytorch torchvision cudatoolkit=10.2 -c pytorch
alias python='/home/your/anaconda3/envs/mypytorch/bin/python3.8'
source ~/.bashrc
cd /your/catkin_ws/src
git clone https://github.com/qq44642754a/Yolov5_ros.git
cd yolov5_ros/yolov5
sudo pip install -r requirements.txt
- First, make sure to put your weights in the models folder.
- The default settings (using
yolov5s.pt
) in thelaunch/yolo_v5.launch
file should work, all you should have to do is change the image topic you would like to subscribe to:
roslaunch yolov5_ros yolo_v5.launch
Alternatively you can modify the parameters in the launch file, recompile and launch it that way so that no arguments need to be passed at runtime.
-
image_topic
Subscribed camera topic.
-
weights_path
Path to weights file.
-
pub_topic
Published topic with the detected bounding boxes.
-
confidence
Confidence threshold for detected objects.