Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Problem using different weights #13

Open
Nikolaiarn opened this issue Nov 13, 2023 · 0 comments
Open

Problem using different weights #13

Nikolaiarn opened this issue Nov 13, 2023 · 0 comments

Comments

@Nikolaiarn
Copy link

Hello, I am wondering if you could help me?
I changed the weights to another .pt file that I trained myself in yolov5. The code works fine when I use the default weights from coco128 but not the one I made myself. I have tested the weights in a detect.y script and it works, but not in this wrapper. I get this error when running the launch file.
[INFO] [launch]: All log files can be found below /home/nikolai/.ros/log/2023-11-13-20-37-17-700838-NikUbuntu22-41350
[INFO] [launch]: Default logging verbosity is set to INFO
[INFO] [yolov5_ros-1]: process started with pid [41351]
[yolov5_ros-1] /usr/lib/python3/dist-packages/requests/init.py:87: RequestsDependencyWarning: urllib3 (2.1.0) or chardet (5.2.0) doesn't match a supported version!
[yolov5_ros-1] warnings.warn("urllib3 ({}) or chardet ({}) doesn't match a supported "
[yolov5_ros-1] /usr/lib/python3/dist-packages/scipy/init.py:146: UserWarning: A NumPy version >=1.17.3 and <1.25.0 is required for this version of SciPy (detected version 1.26.0
[yolov5_ros-1] warnings.warn(f"A NumPy version >={np_minversion} and <{np_maxversion}"
[yolov5_ros-1] /opt/ros/humble/local/lib/python3.10/dist-packages/rclpy/node.py:441: UserWarning: when declaring parameter named 'classes', declaring a parameter only providing its name is deprecated. You have to either:
[yolov5_ros-1] - Pass a name and a default value different to "PARAMETER NOT SET" (and optionally a descriptor).
[yolov5_ros-1] - Pass a name and a parameter type.
[yolov5_ros-1] - Pass a name and a descriptor with `dynamic_typing=True
[yolov5_ros-1] warnings.warn(
[yolov5_ros-1] YOLOv5 🚀 2023-11-9 torch 2.1.0+cu121 CPU
[yolov5_ros-1]
[yolov5_ros-1] Traceback (most recent call last):
[yolov5_ros-1] File "/home/nikolai/yolov5/install/yolov5_ros/lib/yolov5_ros/yolov5_ros", line 33, in
[yolov5_ros-1] sys.exit(load_entry_point('yolov5-ros==0.2.0', 'console_scripts', 'yolov5_ros')())
[yolov5_ros-1] File "/home/nikolai/yolov5/install/yolov5_ros/lib/python3.10/site-packages/yolov5_ros/main.py", line 294, in ros_main
[yolov5_ros-1] yolov5_node = yolov5_ros()
[yolov5_ros-1] File "/home/nikolai/yolov5/install/yolov5_ros/lib/python3.10/site-packages/yolov5_ros/main.py", line 235, in init
[yolov5_ros-1] self.yolov5 = yolov5_demo(self.weights,
[yolov5_ros-1] File "/home/nikolai/yolov5/install/yolov5_ros/lib/python3.10/site-packages/yolov5_ros/main.py", line 64, in init
[yolov5_ros-1] self.load_model()
[yolov5_ros-1] File "/home/nikolai/yolov5/install/yolov5_ros/lib/python3.10/site-packages/yolov5_ros/main.py", line 71, in load_model
[yolov5_ros-1] self.model = DetectMultiBackend(self.weights, device=self.device, dnn=self.dnn, data=self.data)
[yolov5_ros-1] File "/home/nikolai/yolov5/install/yolov5_ros/lib/python3.10/site-packages/yolov5_ros/models/common.py", line 307, in init
[yolov5_ros-1] model = attempt_load(weights if isinstance(weights, list) else w, map_location=device)
[yolov5_ros-1] File "/home/nikolai/yolov5/install/yolov5_ros/lib/python3.10/site-packages/yolov5_ros/models/experimental.py", line 96, in attempt_load
[yolov5_ros-1] ckpt = torch.load(attempt_download(w), map_location=map_location) # load
[yolov5_ros-1] File "/home/nikolai/.local/lib/python3.10/site-packages/torch/serialization.py", line 1014, in load
[yolov5_ros-1] return _load(opened_zipfile,
[yolov5_ros-1] File "/home/nikolai/.local/lib/python3.10/site-packages/torch/serialization.py", line 1422, in _load
[yolov5_ros-1] result = unpickler.load()
[yolov5_ros-1] File "/home/nikolai/.local/lib/python3.10/site-packages/torch/serialization.py", line 1415, in find_class
[yolov5_ros-1] return super().find_class(mod_name, name)
[yolov5_ros-1] AttributeError: Can't get attribute 'DetectionModel' on <module 'models.yolo' from '/home/nikolai/yolov5/install/yolov5_ros/lib/python3.10/site-packages/yolov5_ros/models/yolo.py'>
[ERROR] [yolov5_ros-1]: process has died [pid 41351, exit code 1, cmd '/home/nikolai/yolov5/install/yolov5_ros/lib/yolov5_ros/yolov5_ros --ros-args --params-file /tmp/launch_params_c9wgt9re --params-file /tmp/launch_params_kqr_4gek'].

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant