image 1/2 /home/yuhang/yolov5/inference/images/bus.jpg: Traceback (most recent call last): File "detect.py", line 172, in <module> detect() File "detect.py", line 73, in detect pred = model(img, augment=opt.augment)[0] File "/home/yuhang/.conda/envs/pytorch/lib/python3.8/site-packages/torch/nn/modules/module.py", line 1501, in _call_impl return forward_call(*args, **kwargs) File "/home/yuhang/yolov5/models/yolo.py", line 116, in forward return self.forward_once(x, profile) # single-scale inference, train File "/home/yuhang/yolov5/models/yolo.py", line 136, in forward_once x = m(x) # run File "/home/yuhang/.conda/envs/pytorch/lib/python3.8/site-packages/torch/nn/modules/module.py", line 1501, in _call_impl return forward_call(*args, **kwargs) File "/home/yuhang/.conda/envs/pytorch/lib/python3.8/site-packages/torch/nn/modules/upsampling.py", line 157, in forward recompute_scale_factor=self.recompute_scale_factor) File "/home/yuhang/.conda/envs/pytorch/lib/python3.8/site-packages/torch/nn/modules/module.py", line 1614, in __getattr__ raise AttributeError("'{}' object has no attribute '{}'".format( AttributeError: 'Upsample' object has no attribute 'recompute_scale_factor'
时间: 2023-08-18 08:09:03 浏览: 604
根据你提供的错误信息,看起来是在运行`detect.py`时出现了一个错误。具体来说,`Upsample`对象没有`recompute_scale_factor`属性,导致了`AttributeError`异常。
这个问题可能是由于使用的`torch.nn.Upsample`版本不兼容造成的。新版本的PyTorch中已经将`recompute_scale_factor`属性删除,并且使用了`torch.nn.functional.interpolate`函数来进行上采样操作。
要解决这个问题,你可以尝试更新代码中的`Upsample`为`torch.nn.functional.interpolate`,并相应地调整参数。你可以将以下代码段:
```python
x = m(x)
```
替换为:
```python
x = torch.nn.functional.interpolate(x, scale_factor=2, mode='nearest')
```
这将使用最近邻插值方法对`x`进行上采样。
请注意,这只是一个示例解决方案,具体取决于你的代码实现和需求。你可能需要根据你的情况进行适当的调整。
相关问题
[2023-07-12 09:32:05,693] ERROR com.dtwave.aurora.gateway.strategy.core.utils.PluginUtils - http invoked failed & trace - {"appId":"434023306828447744","bodyJson":"","bodyString":"[123, 34, 99, 111, 100, 101, 34, 58, 34, 52, 48, 51, 32, 70, 79, 82, 66, 73, 68, 68, 69, 78, 34, 44, 34, 99, 111, 110, 116, 101, 110, 116, 34, 58, 110, 117, 108, 108, 44, 34, 109, 101, 115, 115, 97, 103, 101, 34, 58, 34, 105, 110, 118, 97, 108, 105, 100, 32, 114, 101, 113, 117, 101, 115, 116, 44, 32, 105, 112, 58, 32, 49, 48, 46, 55, 49, 46, 49, 54, 48, 46, 55, 55, 32, 110, 111, 116, 32, 105, 110, 32, 119, 104, 105, 116, 101, 73, 112, 76, 105, 115, 116, 34, 44, 34, 115, 117, 99, 99, 101, 115, 115, 34, 58, 102, 97, 108, 115, 101, 125]","costTime":0,"entryTime":1689125525686,"headers":"{\"RemoteIp\":\"10.71.160.77\",\"Host\":\"interface.yuhang.gov.cn\",\"X-Forwarded-For\":\"10.71.160.77\",\"Connection\":\"close\",\"User-Agent\":\"curl/7.29.0\",\"Accept\":\"*/*\",\"Content-Type\":\"application/json\",\"Data_Type\":\"msg\",\"X-AURORA-TOKEN\":\"2Qb1JkJZvYjr6et9\"}","host":"10.71.160.77","matchId":"881601530060800","method":"GET","path":"/yhsgj/yhsgj_prd/talentService","projectId":"386852150919168","queryParams":"{\"RemoteIp\":\"10.71.160.77\",\"Host\":\"interface.yuhang.gov.cn\",\"X-Forwarded-For\":\"10.71.160.77\",\"Connection\":\"close\",\"User-Agent\":\"curl/7.29.0\",\"Accept\":\"*/*\",\"Content-Type\":\"application/json\",\"Data_Type\":\"msg\",\"X-AURORA-TOKEN\":\"2Qb1JkJZvYjr6et9\"}","requestSize":0,"responseSize":0,"systemCode":"A330110251817202209017364","tenantId":"386768890331136","userId":"386768890363904"}
这是一个错误日志,记录了一次HTTP请求的失败信息。其中包含了请求的相关参数和头部信息,以及错误发生的时间和其他详细信息。
根据日志内容,可以看出该请求是一个GET方法的请求,路径为"/yhsgj/yhsgj_prd/talentService"。请求的主机地址为"10.71.160.77",请求的参数包含在queryParams中。但是由于某些原因,请求失败了,具体的错误原因可能需要查看更多的日志信息或者进行进一步的排查。
阅读全文
相关推荐
![-](https://img-home.csdnimg.cn/images/20241231045021.png)
![-](https://img-home.csdnimg.cn/images/20241231044930.png)
![-](https://img-home.csdnimg.cn/images/20241231044930.png)
![zip](https://img-home.csdnimg.cn/images/20241231045053.png)
![rar](https://img-home.csdnimg.cn/images/20241231044955.png)
![zip](https://img-home.csdnimg.cn/images/20241231045053.png)
![pptx](https://img-home.csdnimg.cn/images/20241231044947.png)
![pdf](https://img-home.csdnimg.cn/images/20241231044930.png)
![zip](https://img-home.csdnimg.cn/images/20241231045053.png)
![pdf](https://img-home.csdnimg.cn/images/20241231044930.png)
![zip](https://img-home.csdnimg.cn/images/20241231045053.png)
![-](https://img-home.csdnimg.cn/images/20241231044930.png)
![-](https://img-home.csdnimg.cn/images/20241231044930.png)
![-](https://img-home.csdnimg.cn/images/20241231045053.png)
![-](https://img-home.csdnimg.cn/images/20241231044930.png)
![-](https://img-home.csdnimg.cn/images/20241231044833.png)
![-](https://img-home.csdnimg.cn/images/20241231044901.png)
![-](https://img-home.csdnimg.cn/images/20241231044930.png)