Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix possible bw issue in exportable code #2212

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion otx/api/usecases/exportable_code/demo/requirements.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
openvino==2022.3.0
openmodelzoo-modelapi==2022.3.0
otx==1.2.3
otx @ git+https://github.com/openvinotoolkit/training_extensions/@3743a92784f6c2c0e5a4a0a836d4ec7696451b9c#egg=otx
numpy>=1.21.0,<=1.23.5 # np.bool was removed in 1.24.0 which was used in openvino runtime
Original file line number Diff line number Diff line change
Expand Up @@ -61,8 +61,13 @@ class DetectionToAnnotationConverter(IPredictionToAnnotationConverter):
def __init__(self, labels: Union[LabelSchemaEntity, List], configuration: Optional[Dict[str, Any]] = None):
self.labels = labels.get_labels(include_empty=False) if isinstance(labels, LabelSchemaEntity) else labels
self.label_map = dict(enumerate(self.labels))
self.use_ellipse_shapes = configuration["use_ellipse_shapes"]
self.confidence_threshold = configuration["confidence_threshold"]
self.use_ellipse_shapes = False
self.confidence_threshold = 0.0
if configuration is not None:
if "use_ellipse_shapes" in configuration:
self.use_ellipse_shapes = configuration["use_ellipse_shapes"]
if "confidence_threshold" in configuration:
self.confidence_threshold = configuration["confidence_threshold"]

def convert_to_annotation(
self, predictions: np.ndarray, metadata: Optional[Dict[str, np.ndarray]] = None
Expand Down Expand Up @@ -424,8 +429,13 @@ class MaskToAnnotationConverter(IPredictionToAnnotationConverter):

def __init__(self, labels: LabelSchemaEntity, configuration: Optional[Dict[str, Any]] = None):
self.labels = labels.get_labels(include_empty=False)
self.use_ellipse_shapes = configuration["use_ellipse_shapes"]
self.confidence_threshold = configuration["confidence_threshold"]
self.use_ellipse_shapes = False
self.confidence_threshold = 0.0
if configuration is not None:
if "use_ellipse_shapes" in configuration:
self.use_ellipse_shapes = configuration["use_ellipse_shapes"]
if "confidence_threshold" in configuration:
self.confidence_threshold = configuration["confidence_threshold"]

def convert_to_annotation(self, predictions: tuple, metadata: Dict[str, Any]) -> AnnotationSceneEntity:
"""Convert predictions to OTX Annotation Scene using the metadata.
Expand Down Expand Up @@ -492,8 +502,13 @@ class RotatedRectToAnnotationConverter(IPredictionToAnnotationConverter):

def __init__(self, labels: LabelSchemaEntity, configuration: Optional[Dict[str, Any]] = None):
self.labels = labels.get_labels(include_empty=False)
self.use_ellipse_shapes = configuration["use_ellipse_shapes"]
self.confidence_threshold = configuration["confidence_threshold"]
self.use_ellipse_shapes = False
self.confidence_threshold = 0.0
if configuration is not None:
if "use_ellipse_shapes" in configuration:
self.use_ellipse_shapes = configuration["use_ellipse_shapes"]
if "confidence_threshold" in configuration:
self.confidence_threshold = configuration["confidence_threshold"]

def convert_to_annotation(self, predictions: tuple, metadata: Dict[str, Any]) -> AnnotationSceneEntity:
"""Convert predictions to OTX Annotation Scene using the metadata.
Expand Down