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

self.stride = int(self.model.stride.max()) AttributeError: 'int' object has no attribute 'max' #3

Open
zheng980722 opened this issue Mar 4, 2022 · 4 comments

Comments

@zheng980722
Copy link

运行roslaunch ros_yolo service_demo.launch 时报错,提示
File "/home/eisa/catkin_ws/src/ros-yolov5/src/yolo_bridge/yolo_bridge.py", line 47, in load_model
self.stride = int(self.model.stride.max())
AttributeError: 'int' object has no attribute 'max'

将该行注释或改为self.stride = self.model.stride直接继续可开启服务,但是运行客户端时会报错:
File "/home/eisa/catkin_ws/src/ros-yolov5/src/yolo_bridge/yolo_bridge_utils.py", line 132, in non_max_suppression\n nc = prediction.shape[2] - 5 # number of classes\n', 'IndexError: tuple index out of range\n'] ,元祖索引错误,推测是没有正常产生prediction

请问老哥遇到过类似的情况吗

@linshuchar
Copy link

我也是,解决了吗?

@Anastasia-CS
Copy link

我也是,求解决方法。

@Xuzhiping123
Copy link

请问一下有人解决了这个错误吗?AttributeError:'int' object has no attribute 'max'

@DecAngel
Copy link

在yolo_bridge.py的47行self.stride = int(self.model.stride.max())改为self.stride = self.model.stride,然后在76行pred = self.model(img)[0]改成pred = self.model(img)就行。

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

5 participants