Yolov5_ros icon indicating copy to clipboard operation
Yolov5_ros copied to clipboard

Own best.pt weights and yolo.py file problem

Open TDVL opened this issue 3 years ago • 9 comments

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. Screenshot from 2022-09-04 15-28-43 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. Screenshot from 2022-09-04 15-05-58 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,

TDVL avatar Sep 04 '22 15:09 TDVL

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.

TDVL avatar Sep 05 '22 14:09 TDVL

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. Screenshot from 2022-09-07 08-32-44 The force_reload=True does not help. Here is the screenshot. Screenshot from 2022-09-07 08-38-00 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?

TDVL avatar Sep 07 '22 06:09 TDVL

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? Screenshot from 2022-09-15 21-01-28

TDVL avatar Sep 15 '22 19:09 TDVL

You can modify yolov5 folders for the version you are using

qq44642754a avatar Sep 16 '22 04:09 qq44642754a

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.

TDVL avatar Sep 16 '22 06:09 TDVL

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

qq44642754a avatar Sep 16 '22 06:09 qq44642754a

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?

TDVL avatar Sep 16 '22 07:09 TDVL

Hello, I have added the path to the yolo model, but there is a new error now. Screenshot from 2022-09-19 11-56-28 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.

TDVL avatar Sep 19 '22 10:09 TDVL

Same problem ,have you solved this?

kankanjiuzou123 avatar Nov 09 '22 01:11 kankanjiuzou123