@@ -173,12 +173,13 @@ def export_to_comet(path, name, options):
173
173
asset_id , asset_type , asset_data , asset_metadata , asset_thumbnail = row
174
174
metadata = json .loads (asset_metadata )
175
175
## Only send what comet can accept:
176
- for layer_index , annotation_layer in enumerate (metadata ["annotations" ]):
177
- for index , annotation in reversed (
178
- list (enumerate (annotation_layer ["data" ][:]))
179
- ):
180
- if get_annnotation_type (annotation ) not in ["points" , "boxes" ]:
181
- del metadata ["annotations" ][layer_index ]["data" ][index ]
176
+ if "annotations" in metadata :
177
+ for layer_index , annotation_layer in enumerate (metadata ["annotations" ]):
178
+ for index , annotation in reversed (
179
+ list (enumerate (annotation_layer ["data" ][:]))
180
+ ):
181
+ if get_annnotation_type (annotation ) not in ["points" , "boxes" ]:
182
+ del metadata ["annotations" ][layer_index ]["data" ][index ]
182
183
if asset_data :
183
184
if isinstance (asset_data , str ):
184
185
if asset_data .startswith ("{" ):
@@ -202,10 +203,12 @@ def export_to_comet(path, name, options):
202
203
else :
203
204
step = 0
204
205
206
+ annotations = metadata ["annotations" ] if "annotations" in metadata else None
207
+
205
208
asset_results = experiment .log_image (
206
209
binary_io ,
207
210
name = file_name ,
208
- annotations = metadata [ " annotations" ] ,
211
+ annotations = annotations ,
209
212
step = step ,
210
213
)
211
214
# For consistenency:
0 commit comments