YOLO进行标签生成的注意点!

来源:互联网 发布:app数据库设计实例 编辑:程序博客网 时间:2024/05/17 04:16

1、其中如果要查看自身系统的中文字体使用指令:

fc-list :lang=zh
一般系统都是会自带有一些中文字体。
2、我们生成标签的代码为:

# -*- coding:utf-8 -*-  import osimport matplotlib#zhfont = "./DroidSansFallbackFull.ttf" #l = ["person","bicycle","car","motorcycle","airplane","bus","train","truck","boat","traffic light","fire hydrant","stop sign","parking meter","bench","bird","cat","dog","horse","sheep","cow","elephant","bear","zebra","giraffe","backpack","umbrella","handbag","tie","suitcase","frisbee","skis","snowboard","sports ball","kite","baseball bat","baseball glove","skateboard","surfboard","tennis racket","bottle","wine glass","cup","fork","knife","spoon","bowl","banana","apple","sandwich","orange","broccoli","carrot","hot dog","pizza","donut","cake","chair","couch","potted plant","bed","dining table","toilet","tv","laptop","mouse","remote","keyboard","cell phone","microwave","oven","toaster","sink","refrigerator","book","clock","vase","scissors","teddy bear","hair drier","toothbrush", "aeroplane", "bicycle", "bird", "boat", "bottle", "bus", "car", "cat", "chair", "cow", "diningtable", "dog", "horse", "motorbike", "person", "pottedplant", "sheep", "sofa", "train", "tvmonitor"]l=["飞机","自行车","鸟","船","瓶子","巴士","汽车","猫","椅子","牛","餐桌","狗","马","摩托车","行人","盆栽","羊","沙发","火车","电视机"]for word in l:    os.system("convert -fill black -background white -bordercolor white -border 4 -font /usr/share/fonts/wps-office/simhei.ttf -pointsize 18 label:\"%s\" \"%s.png\""%(word, word))
其中的font时自定义字体,这个跟每个人的系统有关,通过第一步的路径把其改为自己的路径即可完成。

原创粉丝点击