Yolov5_ros
Yolov5_ros copied to clipboard
Own best.pt weights and yolo.py file problem
Hello Zhitao,
Thank you for the great repo Yolov5. I have installed everything according to the guide from this link Zhitao
I think it is working, please see the screenshot.
I have a ZED camera, I have launched it in ROS, now I need to subscribe to it. This will be done automatically, or I need to change something in your repo?
Also, I have put my weights best.pt in the weights folder, I have changed the weights name in launch filet to "best.pt". When I launch the package, there is an some model error and something related to the path, and something related to yolo.py file.
The screenshot about this error is attached too.
Please, will you check this error? I think the best.pt file is the reason for this.
I have trained the yolov5 and saved the weights few days ago in Google Colab using Ultralytics yolov5, these weights are working great in Colab and on Ubuntu too in Python.
Thank you in advance.
Best regards,
Hello, Basically, does it matter if the weights are obtained with an older or a newer version of the yolov5? I did not make any modifications here to the yolov5 itself. For me, it is important that the yolov5 uses my weights to detect objects that are of interest to me. Is it possible that the weight change, the new best.pt file affects the whole model? In the Python version this was not a problem, I have only changed the weights name in the terminal when I have called the yolov5 object detector. Here, I have changed the weights name in the launch file, however there is a new error (please se the screenshot from yesterday), I have tried to find this error in forums all day, but I didn't find any solution of this problem. Finally: what does it mean this error/bug? Exception: Can't get attribute. Cache maybe out of date, try force_reload=TRUE Please, could you suggest a solution for this? Thank you in advance for your attention.
Hello,
Still I cannot run with my weights the yolo in ROS.
The path to the model and to the weights have been added.
When I change the weights, the error is again on.
The force_reload=True does not help. Here is the screenshot.
Hence I have followed all the guides and suggestions, but something is wrong with new weights.
This ROS repo uses your yolov5 model and it works with original *.pt files?
Is it possible that only the weights change can cause these problems?
Hello Zhitao,
Your ROS yolov5 is now working, however it doesn't recognize my weights. I have changed the weights name in the launch file, and the yolov5 detects the object from the official weights (car, remote), but it should detect the connector on the car.
What could be the problem? Please, will you check it?

You can modify yolov5 folders for the version you are using
Hello. Thank you for the response. What folder, exactly what files should I modify and what part. I don't want to spoil the working yolo. Also, I have deleted the original yolov5.pt from weights folder, then I have copied and renamed my best.pt to yolov5.pt. So how can yolo use the old weights then? Thank you in advance.
You can simply replace the entire file yolov5 for the version you are using. Here i use the version of yolov5 P6.0. And the second question, you can re-download the original yolov5.pt and modify the weights folder in the launch file
Where is the yolov5 file? I can see only yolo.py file. The weights should not be independent of the yolov5 version? I only want to change the weights in order to detect my custom object. This weights replacement works well in Python with this Ultralytics yolo? I don't need the original yolov5s.pt, I need my weights. I can't use them after I rename my best.pt to yolov5s.pt?
Hello,
I have added the path to the yolo model, but there is a new error now.
What could be the problem now?
Also, is it not possible to use your model and ROS implementation, but with my best.pt weights? According to the documentation, the *.pt file not depends of the yolo version.
Is this possible? My best.pt is also trained with yolov5s, only in Google Colab and it works well in Python.
Same problem ,have you solved this?