ソースを参照

Fix not imageData property

granbestiapop 5 年 前
コミット
e1fdeda94e
1 ファイル変更2 行追加3 行削除
  1. 2 3
      labelme/cli/json_to_dataset.py

+ 2 - 3
labelme/cli/json_to_dataset.py

@@ -32,10 +32,9 @@ def main():
         os.mkdir(out_dir)
 
     data = json.load(open(json_file))
+    imageData = data.get('imageData')
 
-    if data['imageData']:
-        imageData = data['imageData']
-    else:
+    if not imageData:
         imagePath = os.path.join(os.path.dirname(json_file), data['imagePath'])
         with open(imagePath, 'rb') as f:
             imageData = f.read()