【问题标题】:How to increase the font size of the bounding box in Tensorflow object detection module?TensorFlow 对象检测模块中如何增加边界框的字体大小?
【发布时间】:2017-10-26 09:05:48
【问题描述】:

我在visualization_utils.py的draw_bounding_box_on_image()中将字体大小从默认的24增加到了30

font = ImageFont.truetype('arial.ttf', 30)

但字体大小仍然没有改变。

【问题讨论】:

  • 您确定更改不只是被像素量化或其他东西隐藏了吗?如果您改用 60,它仍然是相同的大小吗(对我来说很好用)?在我的版本中至少有try: font = ImageFont.truetype('arial.ttf', 24) except IOError: font = ImageFont.load_default(),你确定你没有陷入 IOError 案例吗?

标签: tensorflow object-detection


【解决方案1】:
i found the issue.
On Mac we need to give the full path.
ImageFont.truetype('/Library/Fonts/Arial.ttf', 30)

另外,我们可以把.ttf文件放到当前文件夹中使用

 ImageFont.truetype('./Arial.ttf', 30)

【讨论】:

【解决方案2】:

对于 ubuntu 操作系统,我做了以下操作

    import matplotlib.font_manager as fm
...
  try:
    font = ImageFont.truetype(fm.findfont(fm.FontProperties(family='DejaVu Sans')), 50)
  except IOError:
    font = ImageFont.load_default()

它成功了 :) PS。我想它适用于任何操作系统。

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2019-04-22
    • 2023-01-04
    • 2021-02-09
    • 1970-01-01
    • 2019-09-30
    • 1970-01-01
    • 2020-10-14
    • 2021-08-26
    相关资源
    最近更新 更多