Kaynağa Gözat

Fix style of code

Kentaro Wada 7 yıl önce
ebeveyn
işleme
e1b3ec3dd5
2 değiştirilmiş dosya ile 3 ekleme ve 2 silme
  1. 2 1
      labelme/cli/draw_json.py
  2. 1 1
      labelme/cli/json_to_dataset.py

+ 2 - 1
labelme/cli/draw_json.py

@@ -22,13 +22,14 @@ def main():
 
     data = json.load(open(json_file))
 
-    if data['imageData'] is not None:
+    if data['imageData']:
         imageData = data['imageData']
     else:
         imagePath = os.path.join(os.path.dirname(json_file), data['imagePath'])
         with open(imagePath, 'rb') as f:
             imageData = f.read()
             imageData = base64.b64encode(imageData).decode('utf-8')
+
     img = utils.img_b64_to_arr(imageData)
 
     label_name_to_value = {'_background_': 0}

+ 1 - 1
labelme/cli/json_to_dataset.py

@@ -33,7 +33,7 @@ def main():
 
     data = json.load(open(json_file))
 
-    if data['imageData'] is not None:
+    if data['imageData']:
         imageData = data['imageData']
     else:
         imagePath = os.path.join(os.path.dirname(json_file), data['imagePath'])