提交 b7651eb2 编写于 作者: K Kentaro Wada

Fix imagePath which should be relative to labelfile

上级 81d5a401
......@@ -43,12 +43,12 @@ class LabelFile(object):
try:
with open(filename, 'rb' if PY2 else 'r') as f:
data = json.load(f)
imagePath = data['imagePath']
if data['imageData'] is not None:
imageData = b64decode(data['imageData'])
else:
imagePath = os.path.join(
os.path.dirname(filename), data['imagePath'])
# relative path from label file to relative path from cwd
imagePath = os.path.join(os.path.dirname(filename),
data['imagePath'])
with open(imagePath, 'rb') as f:
imageData = f.read()
lineColor = data['lineColor']
......@@ -57,7 +57,7 @@ class LabelFile(object):
for s in data['shapes'])
# Only replace data after everything is loaded.
self.shapes = shapes
self.imagePath = imagePath
self.imagePath = data['imagePath']
self.imageData = imageData
self.lineColor = lineColor
self.fillColor = fillColor
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册