@@ -61,8 +61,13 @@ class DetectionToAnnotationConverter(IPredictionToAnnotationConverter):
6161 def __init__ (self , labels : Union [LabelSchemaEntity , List ], configuration : Optional [Dict [str , Any ]] = None ):
6262 self .labels = labels .get_labels (include_empty = False ) if isinstance (labels , LabelSchemaEntity ) else labels
6363 self .label_map = dict (enumerate (self .labels ))
64- self .use_ellipse_shapes = configuration ["use_ellipse_shapes" ]
65- self .confidence_threshold = configuration ["confidence_threshold" ]
64+ self .use_ellipse_shapes = False
65+ self .confidence_threshold = 0.0
66+ if configuration is not None :
67+ if "use_ellipse_shapes" in configuration :
68+ self .use_ellipse_shapes = configuration ["use_ellipse_shapes" ]
69+ if "confidence_threshold" in configuration :
70+ self .confidence_threshold = configuration ["confidence_threshold" ]
6671
6772 def convert_to_annotation (
6873 self , predictions : np .ndarray , metadata : Optional [Dict [str , np .ndarray ]] = None
@@ -424,8 +429,13 @@ class MaskToAnnotationConverter(IPredictionToAnnotationConverter):
424429
425430 def __init__ (self , labels : LabelSchemaEntity , configuration : Optional [Dict [str , Any ]] = None ):
426431 self .labels = labels .get_labels (include_empty = False )
427- self .use_ellipse_shapes = configuration ["use_ellipse_shapes" ]
428- self .confidence_threshold = configuration ["confidence_threshold" ]
432+ self .use_ellipse_shapes = False
433+ self .confidence_threshold = 0.0
434+ if configuration is not None :
435+ if "use_ellipse_shapes" in configuration :
436+ self .use_ellipse_shapes = configuration ["use_ellipse_shapes" ]
437+ if "confidence_threshold" in configuration :
438+ self .confidence_threshold = configuration ["confidence_threshold" ]
429439
430440 def convert_to_annotation (self , predictions : tuple , metadata : Dict [str , Any ]) -> AnnotationSceneEntity :
431441 """Convert predictions to OTX Annotation Scene using the metadata.
@@ -492,8 +502,13 @@ class RotatedRectToAnnotationConverter(IPredictionToAnnotationConverter):
492502
493503 def __init__ (self , labels : LabelSchemaEntity , configuration : Optional [Dict [str , Any ]] = None ):
494504 self .labels = labels .get_labels (include_empty = False )
495- self .use_ellipse_shapes = configuration ["use_ellipse_shapes" ]
496- self .confidence_threshold = configuration ["confidence_threshold" ]
505+ self .use_ellipse_shapes = False
506+ self .confidence_threshold = 0.0
507+ if configuration is not None :
508+ if "use_ellipse_shapes" in configuration :
509+ self .use_ellipse_shapes = configuration ["use_ellipse_shapes" ]
510+ if "confidence_threshold" in configuration :
511+ self .confidence_threshold = configuration ["confidence_threshold" ]
497512
498513 def convert_to_annotation (self , predictions : tuple , metadata : Dict [str , Any ]) -> AnnotationSceneEntity :
499514 """Convert predictions to OTX Annotation Scene using the metadata.
0 commit comments