Giter VIP home page Giter VIP logo

yolov5_ros's People

Contributors

bolomcs50 avatar caiorovetta15 avatar nhatleminh1997 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar

yolov5_ros's Issues

Can you add xywh on BoundingBox.msg file?

Hi, I'd like to add xywh to bounding_boxes msg file but when I try to catkin build, it gives an error. Can you update the msg file to accept a list type of xywh? Thanks!

error unsupported format when loading .engine model

Hi
thanks for this repo, I am able to run .pt models without an error, however, when I try to run the .engine model, it throws an error.

could you advise how to load the custom trt engine model?
thanks

Error running roslaunch yolov5_ros yolov5.launch

I tried to run :

'''$ roslaunch yolov5_ros yolov5.launch'''

and received the following error:

''''... logging to /home/user/catkin_ws/src/ros_logs/230c2286-b9f7-11ed-8f8d-48b02da5202c/roslaunch-ubuntu-226443.log
Checking log directory for disk usage. This may take a while.
Press Ctrl-C to interrupt
Done checking log file disk usage. Usage is <1GB.

started roslaunch server http://ubuntu:34229/

SUMMARY

PARAMETERS
 * /detect/agnostic_nms: True
 * /detect/confidence_threshold: 0.75
 * /detect/data: /home/convergetec...
 * /detect/device: 0
 * /detect/dnn: True
 * /detect/half: False
 * /detect/inference_size_h: 640
 * /detect/inference_size_w: 640
 * /detect/input_image_topic: /ouster/reflec_image
 * /detect/iou_threshold: 0.45
 * /detect/line_thickness: 3
 * /detect/maximum_detections: 1000
 * /detect/output_image_topic: /yolov5/image_out
 * /detect/output_topic: /yolov5/detections
 * /detect/publish_image: False
 * /detect/view_image: True
 * /detect/weights: best.pt
 * /rosdistro: noetic
 * /rosversion: 1.15.15

NODES
  /
    detect (yolov5_ros/detect.py)

ROS_MASTER_URI=http://localhost:11311/

process[detect-1]: started with pid [226469]
/home/user/.local/lib/python3.8/site-packages/torchvision/io/image.py:13: UserWarning: Failed to load image Python extension:
  warn(f"Failed to load image Python extension: {e}")
Traceback (most recent call last):
  File "/home/convergetech/catkin_wst/devel/lib/yolov5_ros/detect.py", line 15, in
    exec(compile(fh.read(), python_script, 'exec'), context)
  File "/home/convergetech/catkin_wst/src/yolov5_ros/src/detect.py", line 198, in
    detector = Yolov5Detector()
  File "/home/user/.local/lib/python3.8/site-packages/torch/autograd/grad_mode.py", line 27, in decorate_context
    return func(*args, *kwargs)
  File "/home/user/catkin_wst/src/yolov5_ros/src/detect.py", line 51, in init
    self.device = select_device(str(rospy.get_param("~device","")))
  File "/home/convergetech/catkin_wst/src/yolov5_ros/src/yolov5/utils/torch_utils.py", line 117, in select_device
    assert torch.cuda.is_available() and torch.cuda.device_count() >= len(device.replace(',', '')),
AssertionError: Invalid CUDA '--device 0' requested, use '--device cpu' or pass valid CUDA device(s)
[detect-1] process has died [pid 226469, exit code 1, cmd /home/convergetech/catkin_wst/devel/lib/yolov5_ros/detect.py __name:=detect __log:=/home/user/catkin_ws/src/ros_logs/230c2286-b9f7-11ed-8f8d-48b02da5202c/detect-1.log].
log file: /home/user/catkin_ws/src/230c2286-b9f7-11ed-8f8d-48b02da5202c/detect-1
.log
all processes on machine have died, roslaunch will exit
shutting down processing monitor...
... shutting down processing monitor complete```

Could you please tell me how to solve this?

error message when launching

i get the following issue when running the launch file:any fixes?

Traceback (most recent call last):
File "/home/tehan/catkin_ws3/devel/lib/yolov5_ros/detect.py", line 15, in
exec(compile(fh.read(), python_script, 'exec'), context)
File "/home/tehan/catkin_ws3/src/yolov5_ros/src/detect.py", line 198, in
detector = Yolov5Detector()
File "/home/tehan/.local/lib/python3.8/site-packages/torch/autograd/grad_mode.py", line 27, in decorate_context
return func(*args, **kwargs)
File "/home/tehan/catkin_ws3/src/yolov5_ros/src/detect.py", line 75, in init
self.model.warmup(imgsz=(1 if self.pt else bs, 3, *self.img_size), half=self.half) # warmup
File "/home/tehan/catkin_ws3/src/yolov5_ros/src/yolov5/models/common.py", line 463, in warmup
self.forward(im) # warmup
File "/home/tehan/catkin_ws3/src/yolov5_ros/src/yolov5/models/common.py", line 402, in forward
y = self.model(im) if self.jit else self.model(im, augment=augment, visualize=visualize)
File "/home/tehan/.local/lib/python3.8/site-packages/torch/nn/modules/module.py", line 1130, in _call_impl
return forward_call(*input, **kwargs)
File "/home/tehan/catkin_ws3/src/yolov5_ros/src/yolov5/models/yolo.py", line 126, in forward
return self._forward_once(x, profile, visualize) # single-scale inference, train
File "/home/tehan/catkin_ws3/src/yolov5_ros/src/yolov5/models/yolo.py", line 149, in _forward_once
x = m(x) # run
File "/home/tehan/.local/lib/python3.8/site-packages/torch/nn/modules/module.py", line 1130, in _call_impl
return forward_call(*input, *kwargs)
File "/home/tehan/.local/lib/python3.8/site-packages/torch/nn/modules/upsampling.py", line 154, in forward
recompute_scale_factor=self.recompute_scale_factor)
File "/home/tehan/.local/lib/python3.8/site-packages/torch/nn/modules/module.py", line 1207, in getattr
raise AttributeError("'{}' object has no attribute '{}'".format(
AttributeError: 'Upsample' object has no attribute 'recompute_scale_factor'
[detect-1] process has died [pid 33555, exit code 1, cmd /home/tehan/catkin_ws3/devel/lib/yolov5_ros/detect.py __name:=detect __log:=/home/tehan/.ros/log/7556eb8e-3810-11ed-8f26-6d4d1452b233/detect-1.log].
log file: /home/tehan/.ros/log/7556eb8e-3810-11ed-8f26-6d4d1452b233/detect-1
.log

Is it possible to test this yolov5 ROS Noetic repo with image files with my own weights?

Is it possible to test this yolov5 ROS Noetic repo with image files with my own weights?
I have a trained yolov5 network in Python, I have trained it in Colab using ultralytics repo.
Also, I have the saved best.pt weights.
Is it possible to use my weights? Also I have the *.yaml file of my dataset, however I don't know is it necessary here since I have the saved weights, I will not do the training ins ROS.
I would like to test my weights in this ROS Noetic repo on images.
Is it possible? If it is, how can I do that?

Thank you in advance,
Best regards,

Location of detection_msg.msg unknown

from detection_msgs.msg import BoundingBox, BoundingBoxes

ImportError: cannot import name 'BoundingBox' from 'detection_msgs.msg' (unknown location)
[detect-2] process has died [pid 39904, exit code 1, cmd /mnt/sda1/mythronics/catkin_ws/devel/lib/yolov5_ros/detect.py __name:=detect __log:=/home/orlando/.ros/log/b82baad2-9a47-11ed-946e-f16c2c6778ab/detect-2.log].
log file: /home/orlando/.ros/log/b82baad2-9a47-11ed-946e-f16c2c6778ab/detect-2*.log

Unable to echo /yolov5/detections

I am trying to publish the bounding boxes using the command: "rostopic echo /yolov5/detections" but i get the following error: Cannot load message class for [detection_msgs/boudingboxes]. are your messages built?
How can i fix this error?

AssertionError: Invalid CUDA '--device 0' requested, use '--device cpu' or pass valid CUDA device(s)

Hello,
I have installed your repository on Ubuntu 20.04+ROS Noetic VM on VirtualBox.
The installation was successful, catkin_make was use used for build, without error.
I have copied my best.pt weights in the specified folder and I have changed the weights name in the launch file, according to your instructions.
After I launched the package. An AssertionError was reported. something related to CUDA. All processes died.
AssertionError: Invalid CUDA '--device 0' requested, use '--device cpu' or pass valid CUDA device(s)
What could be the problem, please, will you check it and help me?
Also, is it possible to test your yolov5 on *.jpg image? Since I need to test it on images, is it possible?
If not, how can I use a video file for testing?
Later, if it works well, everything will be installed on desktop computer with appropriate hardware.
The screenshot about the error is attached.
Thank you in advance.
Best regards
Screenshot from 2022-09-02 17-25-28

[detect-1]killing on exit

RLException: Unable to launch [detect-1].
If it is a script, you may be missing a '#!' declaration at the top.
The traceback for the exception was written to the log file

When I try to run roslaunch yolov5_ros yolov5.launch it returns this error message. What should I do?

report errors

My operation reported an error. Please help me find out the reason?

Traceback (most recent call last):
File "/home/user/yolo_v5/devel/lib/yolov5_ros/detect.py", line 15, in
exec(compile(fh.read(), python_script, 'exec'), context)
File "/home/user/yolo_v5/src/yolov5_ros/src/detect.py", line 198, in
detector = Yolov5Detector()
File "/home/user/.local/lib/python3.8/site-packages/torch/autograd/grad_mode.py", line 27, in decorate_context
return func(*args, **kwargs)
File "/home/user/yolo_v5/src/yolov5_ros/src/detect.py", line 75, in init
self.model.warmup(imgsz=(1 if self.pt else bs, 3, self.img_size), half=self.half) # warmup
TypeError: warmup() got an unexpected keyword argument 'half'
[detect-1] process has died [pid 20159, exit code 1, cmd /home/user/yolo_v5/devel/lib/yolov5_ros/detect.py __name:=detect __log:=/home/user/.ros/log/e0f91f2a-0646-11ed-a3ff-c5becdac043e/detect-1.log].
log file: /home/user/.ros/log/e0f91f2a-0646-11ed-a3ff-c5becdac043e/detect-1
.log

When I export the yolov5n.pt to yolov5n.onnx ,something goes wrong

[ERROR:[email protected]] global onnx_importer.cpp:1061 handleNode DNN/ONNX: ERROR during processing node with 1 inputs and 1 outputs: [Floor]:(onnx_node!/model.11/Floor) from domain='ai.onnx'
Traceback (most recent call last):
File "/home/shenyexiang/yolo_v5/devel/lib/yolov5_ros/detect.py", line 15, in
exec(compile(fh.read(), python_script, 'exec'), context)
File "/home/shenyexiang/yolo_v5/src/yolov5_ros/src/detect.py", line 198, in
detector = Yolov5Detector()
File "/home/shenyexiang/.local/lib/python3.8/site-packages/torch/utils/_contextlib.py", line 115, in decorate_context
return func(*args, **kwargs)
File "/home/shenyexiang/.local/lib/python3.8/site-packages/torch/utils/_contextlib.py", line 129, in
func = cast(F, lambda *args, **kwargs: orig_func(*args, **kwargs))
File "/home/shenyexiang/yolo_v5/src/yolov5_ros/src/detect.py", line 52, in init
self.model = DetectMultiBackend(weights, device=self.device, dnn=rospy.get_param("~dnn"), data=rospy.get_param("~data"))
File "/home/shenyexiang/yolo_v5/src/yolov5_ros/src/yolov5/models/common.py", line 353, in init
net = cv2.dnn.readNetFromONNX("/home/shenyexiang/yolo_v5/src/yolov5_ros/src/yolov5/weights/yolov5n.onnx")
cv2.error: OpenCV(4.8.1) /io/opencv/modules/dnn/src/onnx/onnx_importer.cpp:1083: error: (-2:Unspecified error) in function 'handleNode'

Node [[email protected]]:(onnx_node!/model.11/Floor) parse error: OpenCV(4.8.1) /io/opencv/modules/dnn/src/layers/elementwise_layers.cpp:260: error: (-215:Assertion failed) src.size == dst.size && src.type() == dst.type() && src.isContinuous() && dst.isContinuous() && src.type() == CV_32F in function 'forward'

pip install -r requirements.txt

ERROR: Could not find a version that satisfies the requirement matplotlib>=3.2.2 (from -r requirements.txt (line 5)) (from versions: none)
ERROR: No matching distribution found for matplotlib>=3.2.2 (from -r requirements.txt (line 5))

Real time object Segmentation on a ROS image topic

Hello,

Currently, the yolov5_ros packages uses YOLOv5 for real time object detection and publishes result on a ROS topic. It uses this branch of the yolov5 github repo to do object detection.

My question is, if I use the master branch which allows for image segmentation, what changes need to be made to the detect script to publish result of segmentation on a ros topic? What could be the message type in this case?

In the attachment, I have shown result of strawberry segmentation done with YOLO v5. In the next step, I want to use this result to extract point cloud of one of the segmented strawberries for robot picking.

Thank you.

yolov5_segmentation

launching error.

RLException: [launch/yolov5.launch] is neither a launch file in package [yolov5_ros] nor is [yolov5_ros] a launch file name
The traceback for the exception was written to the log file

colon build without error.

gpu version not supported.

warnings.warn(incompatible_device_warn.format(device_name, capability, " ".join(arch_list), device_name))

/
how to work around without downgrade torch version

ImportError: dynamic module does not define module export function (PyInit_cv_bridge_boost)

I am getting this error

[ERROR] [1653988149.797134, 0.000000]: bad callback: <bound method Yolov5Detector.callback of <main.Yolov5Detector object at 0x7f3d3e241040>>
Traceback (most recent call last):
File "/opt/ros/melodic/lib/python2.7/dist-packages/rospy/topics.py", line 750, in _invoke_callback
cb(msg)
File "/home/winet/yolov5/src/yolov5_ros/src/detect.py", line 112, in callback
im = CvBridge().imgmsg_to_cv2(data, desired_encoding="bgr8")
File "/opt/ros/melodic/lib/python2.7/dist-packages/cv_bridge/core.py", line 163, in imgmsg_to_cv2
dtype, n_channels = self.encoding_to_dtype_with_channels(img_msg.encoding)
File "/opt/ros/melodic/lib/python2.7/dist-packages/cv_bridge/core.py", line 99, in encoding_to_dtype_with_channels
return self.cvtype2_to_dtype_with_channels(self.encoding_to_cvtype2(encoding))
File "/opt/ros/melodic/lib/python2.7/dist-packages/cv_bridge/core.py", line 91, in encoding_to_cvtype2
from cv_bridge.boost.cv_bridge_boost import getCvType
ImportError: dynamic module does not define module export function (PyInit_cv_bridge_boost)

Error running roslaunch yolov5_ros yolov5.launch

I tried to run :

'''$ roslaunch yolov5_ros yolov5.launch'''

and received the following error:

''''... logging to /home/user/catkin_ws/src/ros_logs/230c2286-b9f7-11ed-8f8d-48b02da5202c/roslaunch-ubuntu-226443.log
Checking log directory for disk usage. This may take a while.
Press Ctrl-C to interrupt
Done checking log file disk usage. Usage is <1GB.

started roslaunch server http://ubuntu:34229/

SUMMARY

PARAMETERS
 * /detect/agnostic_nms: True
 * /detect/confidence_threshold: 0.75
 * /detect/data: /home/user...
 * /detect/device: 0
 * /detect/dnn: True
 * /detect/half: False
 * /detect/inference_size_h: 640
 * /detect/inference_size_w: 640
 * /detect/input_image_topic: /ouster/reflec_image
 * /detect/iou_threshold: 0.45
 * /detect/line_thickness: 3
 * /detect/maximum_detections: 1000
 * /detect/output_image_topic: /yolov5/image_out
 * /detect/output_topic: /yolov5/detections
 * /detect/publish_image: False
 * /detect/view_image: True
 * /detect/weights: best.pt
 * /rosdistro: noetic
 * /rosversion: 1.15.15

NODES
  /
    detect (yolov5_ros/detect.py)

ROS_MASTER_URI=http://localhost:11311/

process[detect-1]: started with pid [226469]
/home/user/.local/lib/python3.8/site-packages/torchvision/io/image.py:13: UserWarning: Failed to load image Python extension:
  warn(f"Failed to load image Python extension: {e}")
Traceback (most recent call last):
  File "/home/user/catkin_wst/devel/lib/yolov5_ros/detect.py", line 15, in
    exec(compile(fh.read(), python_script, 'exec'), context)
  File "/home/user/catkin_wst/src/yolov5_ros/src/detect.py", line 198, in
    detector = Yolov5Detector()
  File "/home/user/.local/lib/python3.8/site-packages/torch/autograd/grad_mode.py", line 27, in decorate_context
    return func(*args, *kwargs)
  File "/home/user/catkin_wst/src/yolov5_ros/src/detect.py", line 51, in init
    self.device = select_device(str(rospy.get_param("~device","")))
  File "/home/user/catkin_wst/src/yolov5_ros/src/yolov5/utils/torch_utils.py", line 117, in select_device
    assert torch.cuda.is_available() and torch.cuda.device_count() >= len(device.replace(',', '')),
AssertionError: Invalid CUDA '--device 0' requested, use '--device cpu' or pass valid CUDA device(s)
[detect-1] process has died [pid 226469, exit code 1, cmd /home/user/catkin_wst/devel/lib/yolov5_ros/detect.py __name:=detect __log:=/home/user/catkin_ws/src/ros_logs/230c2286-b9f7-11ed-8f8d-48b02da5202c/detect-1.log].
log file: /home/user/catkin_ws/src/230c2286-b9f7-11ed-8f8d-48b02da5202c/detect-1
.log
all processes on machine have died, roslaunch will exit
shutting down processing monitor...
... shutting down processing monitor complete```

Could you please tell me how to solve this?

"Why does this issue occur?"

Why am I encountering this error while running YOLOv5 in Docker, and how can I resolve it? please bb

root@1eedc933a7f6:~/catkin_ws/src/yolov5_ros/launch# roslaunch yolov5_ros yolov5.launch
... logging to /root/.ros/log/0fdf95f6-7a15-11ee-8153-0242ac110002/roslaunch-1eedc933a7f6-1525.log
Checking log directory for disk usage. This may take a while.
Press Ctrl-C to interrupt
Done checking log file disk usage. Usage is <1GB.

started roslaunch server http://1eedc933a7f6:39731/

SUMMARY

PARAMETERS

  • /detect/agnostic_nms: True
  • /detect/confidence_threshold: 0.75
  • /detect/data: /root/catkin_ws/s...
  • /detect/device: 0
  • /detect/dnn: True
  • /detect/half: False
  • /detect/inference_size_h: 480
  • /detect/inference_size_w: 640
  • /detect/input_image_topic: /image_jpeg/compr...
  • /detect/iou_threshold: 0.05
  • /detect/line_thickness: 3
  • /detect/maximum_detections: 1000
  • /detect/output_image_topic: /yolov5/image_out
  • /detect/output_topic: /yolov5/detections
  • /detect/publish_image: True
  • /detect/view_image: True
  • /detect/weights: /root/catkin_ws/s...
  • /rosdistro: noetic
  • /rosversion: 1.16.0

NODES
/
detect (yolov5_ros/detect.py)

ROS_MASTER_URI=http://localhost:11311

process[detect-1]: started with pid [1550]
No protocol specified
qt.qpa.xcb: could not connect to display :1
qt.qpa.plugin: Could not load the Qt platform plugin "xcb" in "/usr/local/lib/python3.8/dist-packages/cv2/qt/plugins" even though it was found.
This application failed to start because no Qt platform plugin could be initialized. Reinstalling the application may fix this problem.

Available platform plugins are: xcb.

[detect-1] process has died [pid 1550, exit code -6, cmd /root/catkin_ws/devel/lib/yolov5_ros/detect.py __name:=detect __log:=/root/.ros/log/0fdf95f6-7a15-11ee-8153-0242ac110002/detect-1.log].
log file: /root/.ros/log/0fdf95f6-7a15-11ee-8153-0242ac110002/detect-1*.log
all processes on machine have died, roslaunch will exit
shutting down processing monitor...
... shutting down processing monitor complete
done

Launch Node Command Error

I have this error when I do the command roslaunch yolov5_ros yolov5.launch

RLException: [yolov5.launch] is neither a launch file in package [yolov5_ros] nor is [yolov5_ros] a launch file name
The traceback for the exception was written to the log file

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.