Skip to content

Commit 04605b3

Browse files
committed
fix
1 parent e8ec9f5 commit 04605b3

5 files changed

Lines changed: 7 additions & 8 deletions

File tree

src/arduino/app_bricks/audio_classification/__init__.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -122,8 +122,7 @@ def classify_from_file(audio_path: str, confidence: float = 0.8) -> dict | None:
122122
features = list(struct.unpack(fmt, frames))
123123
else:
124124
raise ValueError(f"Unsupported sample width: {samp_width} bytes. Cannot process this WAV file.")
125-
126-
classification = EdgeImpulseRunnerFacade.infer_from_features(features)
125+
classification = AudioClassification.infer_from_features(features)
127126
best_match = AudioDetector.get_best_match(classification, confidence)
128127
if not best_match:
129128
return None

src/arduino/app_bricks/motion_detection/__init__.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ def __init__(self, confidence: float = 0.4):
2626
"""
2727
self._confidence = confidence
2828
super().__init__()
29-
model_info = EdgeImpulseRunnerFacade.get_model_info()
29+
model_info = self.get_model_info()
3030
if not model_info:
3131
raise ValueError("Failed to retrieve model information. Ensure the EI model runner service is running.")
3232
if model_info.frequency <= 0 or model_info.input_features_count <= 0:
@@ -133,7 +133,7 @@ def _detection_loop(self):
133133
return
134134

135135
try:
136-
ret = EdgeImpulseRunnerFacade.infer_from_features(features.tolist())
136+
ret = self.infer_from_features(features.tolist())
137137
spotted_movement = self._movement_spotted(ret)
138138
if spotted_movement is not None:
139139
keyword, confidence, complete_detection = spotted_movement

src/arduino/app_bricks/object_detection/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ def __init__(self, confidence: float = 0.3):
3131
"""
3232
self.confidence = confidence
3333
super().__init__()
34-
self._model_info = EdgeImpulseRunnerFacade.get_model_info()
34+
self._model_info = self.get_model_info()
3535
if not self._model_info:
3636
raise ValueError("Failed to retrieve model information. Ensure the Edge Impulse service is running.")
3737

src/arduino/app_bricks/vibration_anomaly_detection/__init__.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ def __init__(self, anomaly_detection_threshold: float = 1.0):
4848
"""
4949
self._anomaly_detection_threshold = anomaly_detection_threshold
5050
super().__init__()
51-
model_info = EdgeImpulseRunnerFacade.get_model_info()
51+
model_info = self.get_model_info()
5252
if not model_info:
5353
raise ValueError("Failed to retrieve model information. Ensure the EI model runner service is running.")
5454
if model_info.frequency <= 0 or model_info.input_features_count <= 0:
@@ -133,7 +133,7 @@ def loop(self):
133133
if features is None or len(features) == 0:
134134
return
135135

136-
ret = EdgeImpulseRunnerFacade.infer_from_features(features.tolist())
136+
ret = self.infer_from_features(features.tolist())
137137
logger.debug(f"Inference result: {ret}")
138138
spotted_anomaly = self._extract_anomaly_score(ret)
139139
if spotted_anomaly is not None:

src/arduino/app_internal/core/ei.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -129,7 +129,7 @@ def infer_from_features(cls, features: list) -> dict | None:
129129
"""
130130
try:
131131
url = cls._get_ei_url()
132-
model_info = EdgeImpulseRunnerFacade.get_model_info()
132+
model_info = cls.get_model_info()
133133
features = features[: int(model_info.input_features_count)]
134134

135135
response = requests.post(f"{url}/api/features", json={"features": features})

0 commit comments

Comments
 (0)