[PYTHON] Decrease the class name of the detection result display of object detection

environment

macOS mojave python 3.6

I was in trouble

Object detection displays the detection result on the image, but when I detected it on my own image, the class name was too small to read. In the tutorial image, it is displayed in a size that is easy to see. https://github.com/tensorflow/models/tree/master/research/object_detection

solution

The code to draw the detection result is written in the following file. object_detection/utils/visualization_utils.py

As of December 4, 2019, the font size is specified on line 208.

  try:
    font = ImageFont.truetype('arial.ttf', 24)
  except IOError:
    font = ImageFont.load_default()

Change the code as follows.

  try:
    font = ImageFont.truetype('/Library/Fonts/arial.ttf', 8)
  except IOError:
    font = ImageFont.load_default()

I was able to make the font size smaller. The font size did not change well unless I respecified not only the font size but also the font type path.

Recommended Posts

Decrease the class name of the detection result display of object detection
Add the attribute of the object of the class with the for statement
Scraping the result of "Schedule-kun"
Print the name of the object directly under the object specified in Blender
[Cloudian # 9] Try to display the metadata of the object in Python (boto3)
Get the attributes of an object
Process the result of% time,% timeit
Touch the object of the neural network
The meaning of ".object" in Django
Display the result of video analysis using Cloud Video Intelligence API from Colaboratory.
Calculation of mean IoU in object detection
Explain the mechanism of PEP557 data class
[Python3] Rewrite the code object of the function
The result of installing python in Anaconda
Set the process name of the Python program
Try to display the Fibonacci sequence in various languages in the name of algorithm practice
I tried object detection with YOLO v3 (TensorFlow 2.1) on the GPU of windows!
I want to store the result of% time, %% time, etc. in an object (variable)
View the result of geometry processing in Python
Consider improving the accuracy of VAE abnormality detection
Extract only complete from the result of Trinity
[Python] Understand the self of the class. Learn the role of self from the execution result with or without self.
Stop sign detection Development of visualization part part5 Display what was detected when an object was detected