@@ -259,10 +259,8 @@ class AnomalyClassificationToAnnotationConverter(IPredictionToAnnotationConverte
259
259
260
260
def __init__ (self , label_schema : LabelSchemaEntity ):
261
261
labels = label_schema .get_labels (include_empty = False )
262
- self .normal_label = [label for label in labels if label .name == "Normal" ][0 ]
263
- self .anomalous_label = [label for label in labels if label .name == "Anomalous" ][
264
- 0
265
- ]
262
+ self .normal_label = [label for label in labels if not label .is_anomalous ][0 ]
263
+ self .anomalous_label = [label for label in labels if label .is_anomalous ][0 ]
266
264
267
265
def convert_to_annotation (
268
266
self , predictions : np .ndarray , metadata : Dict [str , Any ]
@@ -290,10 +288,8 @@ class AnomalySegmentationToAnnotationConverter(IPredictionToAnnotationConverter)
290
288
291
289
def __init__ (self , label_schema : LabelSchemaEntity ):
292
290
labels = label_schema .get_labels (include_empty = False )
293
- self .normal_label = [label for label in labels if label .name == "Normal" ][0 ]
294
- self .anomalous_label = [label for label in labels if label .name == "Anomalous" ][
295
- 0
296
- ]
291
+ self .normal_label = [label for label in labels if not label .is_anomalous ][0 ]
292
+ self .anomalous_label = [label for label in labels if label .is_anomalous ][0 ]
297
293
self .label_map = {0 : self .normal_label , 1 : self .anomalous_label }
298
294
299
295
def convert_to_annotation (
@@ -327,10 +323,8 @@ def __init__(self, label_schema: LabelSchemaEntity):
327
323
:param label_schema: Label Schema containing the label info of the task
328
324
"""
329
325
labels = label_schema .get_labels (include_empty = False )
330
- self .normal_label = [label for label in labels if label .name == "Normal" ][0 ]
331
- self .anomalous_label = [label for label in labels if label .name == "Anomalous" ][
332
- 0
333
- ]
326
+ self .normal_label = [label for label in labels if not label .is_anomalous ][0 ]
327
+ self .anomalous_label = [label for label in labels if label .is_anomalous ][0 ]
334
328
self .label_map = {0 : self .normal_label , 1 : self .anomalous_label }
335
329
336
330
def convert_to_annotation (
0 commit comments