Closed tehantehan closed 1 year ago
I had a same problem, and I finally solved it. This problem occurred by python and torch version. When you use python 3.8 with over torch 1.10, it makes error like that. You can solve it by annotating code
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)
like this
def forward(self, input: Tensor) -> Tensor: return F.interpolate(input, self.size, self.scale_factor, self.mode, self.align_corners, #recompute_scale_factor=self.recompute_scale_factor )
thanks @KhugCihon for the fix
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