Skip to content

Commit

Permalink
fix inference vis.py py2 encoding (PaddlePaddle#522)
Browse files Browse the repository at this point in the history
  • Loading branch information
yghstill committed Apr 20, 2020
1 parent f8bc467 commit 003f265
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion inference/tools/vis.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
import numpy as np
import json
from PIL import Image, ImageDraw, ImageFont
import io

Flags = gflags.FLAGS
gflags.DEFINE_string('img_path', 'abc', 'image path')
Expand Down Expand Up @@ -80,7 +81,7 @@ def colormap(rgb=False):
img = cv2.imread(Flags.img_path)
img = cv2.cvtColor(img, cv2.COLOR_BGR2RGB)
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)
for box in detection_result.detection_boxes:
if box.score >= Flags.threshold:
Expand Down

0 comments on commit 003f265

Please sign in to comment.