|
@@ -2,8 +2,13 @@
|
|
|
|
|
|
import argparse
|
|
|
import json
|
|
|
+import os
|
|
|
+import sys
|
|
|
+import base64
|
|
|
import matplotlib.pyplot as plt
|
|
|
|
|
|
+PY2 = sys.version_info[0] == 2
|
|
|
+
|
|
|
from labelme import utils
|
|
|
|
|
|
|
|
@@ -16,7 +21,14 @@ def main():
|
|
|
|
|
|
data = json.load(open(json_file))
|
|
|
|
|
|
- img = utils.img_b64_to_arr(data['imageData'])
|
|
|
+ if data['imageData'] is not None:
|
|
|
+ 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}
|
|
|
for shape in data['shapes']:
|