Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
Y
yolov5
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
图表
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
图像
聊天
创建新问题
作业
提交
问题看板
Open sidebar
Administrator
yolov5
Commits
8ad9e4ed
Unverified
提交
8ad9e4ed
authored
9月 20, 2021
作者:
Glenn Jocher
提交者:
GitHub
9月 20, 2021
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Annotator `check_font()` RANK -1 remove progress (#4864)
* Annotator `check_font()` RANK -1 remove progress * Cleanup
上级
2b3109ee
隐藏空白字符变更
内嵌
并排
正在显示
1 个修改的文件
包含
6 行增加
和
3 行删除
+6
-3
plots.py
utils/plots.py
+6
-3
没有找到文件。
utils/plots.py
浏览文件 @
8ad9e4ed
...
...
@@ -3,11 +3,12 @@
Plotting utils
"""
import
math
import
os
from
copy
import
copy
from
pathlib
import
Path
import
cv2
import
math
import
matplotlib
import
matplotlib.pyplot
as
plt
import
numpy
as
np
...
...
@@ -21,6 +22,7 @@ from utils.metrics import fitness
# Settings
CONFIG_DIR
=
user_config_dir
()
# Ultralytics settings dir
RANK
=
int
(
os
.
getenv
(
'RANK'
,
-
1
))
matplotlib
.
rc
(
'font'
,
**
{
'size'
:
11
})
matplotlib
.
use
(
'Agg'
)
# for writing to files only
...
...
@@ -55,12 +57,13 @@ def check_font(font='Arial.ttf', size=10):
except
Exception
as
e
:
# download if missing
url
=
"https://ultralytics.com/assets/"
+
font
.
name
print
(
f
'Downloading {url} to {font}...'
)
torch
.
hub
.
download_url_to_file
(
url
,
str
(
font
))
torch
.
hub
.
download_url_to_file
(
url
,
str
(
font
)
,
progress
=
False
)
return
ImageFont
.
truetype
(
str
(
font
),
size
)
class
Annotator
:
check_font
()
# download TTF if necessary
if
RANK
in
(
-
1
,
0
):
check_font
()
# download TTF if necessary
# YOLOv5 Annotator for train/val mosaics and jpgs and detect/hub inference annotations
def
__init__
(
self
,
im
,
line_width
=
None
,
font_size
=
None
,
font
=
'Arial.ttf'
,
pil
=
True
):
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论