未验证 提交 003f2657 编写于 作者: G Guanghua Yu 提交者: GitHub

fix inference vis.py py2 encoding (#522)

上级 f8bc4673
...@@ -20,6 +20,7 @@ import gflags ...@@ -20,6 +20,7 @@ import gflags
import numpy as np import numpy as np
import json import json
from PIL import Image, ImageDraw, ImageFont from PIL import Image, ImageDraw, ImageFont
import io
Flags = gflags.FLAGS Flags = gflags.FLAGS
gflags.DEFINE_string('img_path', 'abc', 'image path') gflags.DEFINE_string('img_path', 'abc', 'image path')
...@@ -80,7 +81,7 @@ if __name__ == "__main__": ...@@ -80,7 +81,7 @@ if __name__ == "__main__":
img = cv2.imread(Flags.img_path) img = cv2.imread(Flags.img_path)
img = cv2.cvtColor(img, cv2.COLOR_BGR2RGB) img = cv2.cvtColor(img, cv2.COLOR_BGR2RGB)
class2LabelMap = dict() class2LabelMap = dict()
with open(Flags.c2l_path, "r", encoding="utf-8") as json_f: with io.open(Flags.c2l_path, "r", encoding="utf-8") as json_f:
class2LabelMap = json.load(json_f) class2LabelMap = json.load(json_f)
for box in detection_result.detection_boxes: for box in detection_result.detection_boxes:
if box.score >= Flags.threshold: if box.score >= Flags.threshold:
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册