yolov5训练过程中,怎么把进度条下显示的准确度召回率map等显示小数点后四位
时间: 2024-02-12 09:04:35 浏览: 122
在 YOLOv5 训练过程中,可以通过更改 `utils.general.metrics` 函数中的 `format` 参数来控制显示小数点后的位数。默认情况下,`format` 参数设置为 `%.3f`,即显示小数点后三位。若要显示小数点后四位,则可以将该参数更改为 `%.4f`。
具体操作如下:
1. 打开 `utils/general.py` 文件。
2. 找到 `metrics` 函数,该函数的代码如下:
```python
def metrics(pred, target, iou_thresh=0.5):
"""Calculate mean average precision (mAP), precision, recall for single image"""
...
...
...
```
3. 在该函数中,找到 `format` 参数,该参数默认设置为 `%.3f`。将其更改为 `%.4f`。
```python
def metrics(pred, target, iou_thresh=0.5):
"""Calculate mean average precision (mAP), precision, recall for single image"""
...
...
...
format_str = '%s' + '%10.4f' * 6 # 设置小数点后四位
print(format_str % ('all', *x))
```
4. 保存修改后的文件,重新启动训练即可看到小数点后四位的显示。
阅读全文
相关推荐
![rar](https://img-home.csdnimg.cn/images/20241231044955.png)
![rar](https://img-home.csdnimg.cn/images/20241231044955.png)
![rar](https://img-home.csdnimg.cn/images/20241231044955.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![application/x-rar](https://img-home.csdnimg.cn/images/20210720083606.png)
![rar](https://img-home.csdnimg.cn/images/20241231044955.png)
![application/x-rar](https://img-home.csdnimg.cn/images/20210720083606.png)
![application/x-rar](https://img-home.csdnimg.cn/images/20210720083606.png)
![application/x-zip](https://img-home.csdnimg.cn/images/20210720083736.png)
![txt](https://img-home.csdnimg.cn/images/20241231045021.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)
![rar](https://img-home.csdnimg.cn/images/20241231044955.png)
![application/msword](https://img-home.csdnimg.cn/images/20210720083327.png)
![-](https://img-home.csdnimg.cn/images/20241231044955.png)