|
@@ -21,7 +21,7 @@ class LabelFile(object):
|
|
suffix = '.json'
|
|
suffix = '.json'
|
|
|
|
|
|
def __init__(self, filename=None):
|
|
def __init__(self, filename=None):
|
|
- self.shapes = ()
|
|
|
|
|
|
+ self.shapes = []
|
|
self.imagePath = None
|
|
self.imagePath = None
|
|
self.imageData = None
|
|
self.imageData = None
|
|
if filename is not None:
|
|
if filename is not None:
|
|
@@ -82,17 +82,17 @@ class LabelFile(object):
|
|
)
|
|
)
|
|
lineColor = data['lineColor']
|
|
lineColor = data['lineColor']
|
|
fillColor = data['fillColor']
|
|
fillColor = data['fillColor']
|
|
- shapes = (
|
|
|
|
- (
|
|
|
|
- s['label'],
|
|
|
|
- s['points'],
|
|
|
|
- s['line_color'],
|
|
|
|
- s['fill_color'],
|
|
|
|
- s.get('shape_type', 'polygon'),
|
|
|
|
- s.get('flags', {}),
|
|
|
|
|
|
+ shapes = [
|
|
|
|
+ dict(
|
|
|
|
+ label=s['label'],
|
|
|
|
+ points=s['points'],
|
|
|
|
+ line_color=s['line_color'],
|
|
|
|
+ fill_color=s['fill_color'],
|
|
|
|
+ shape_type=s.get('shape_type', 'polygon'),
|
|
|
|
+ flags=s.get('flags', {}),
|
|
)
|
|
)
|
|
for s in data['shapes']
|
|
for s in data['shapes']
|
|
- )
|
|
|
|
|
|
+ ]
|
|
except Exception as e:
|
|
except Exception as e:
|
|
raise LabelFileError(e)
|
|
raise LabelFileError(e)
|
|
|
|
|