add output of anomaly score and sorted according to spec, related to #21 and #22

This commit is contained in:
2026-01-06 10:19:49 +01:00
parent 8bdb9889ba
commit d1279e167a
5 changed files with 49 additions and 23 deletions

View File

@@ -67,9 +67,9 @@ def test_measure_length(single_img_path):
pixels_per_metric_X,
pixels_per_metric_Y,
)
assert len(data) == 18
assert isinstance(data[0], str)
assert float(data[0].replace(",", ".")) == pytest.approx(1266.932)
assert len(data["sensor_sizes"]) == 18
assert isinstance(data["sensor_sizes"][0], str)
assert float(data["sensor_sizes"][0].replace(",", ".")) == pytest.approx(1266.932)
img_left = imgs["left"]
assert 235 < img_left.shape[0] < 260
assert 910 < img_left.shape[1] < 960
@@ -89,20 +89,20 @@ def test_isolated_pipeline(results_folder, path_img_with_failure_TrainedModel):
DETECTION_MODELS = dopt_sensor_anomalies._find_paths.get_detection_models(MODEL_FOLDER)
assert DETECTION_MODELS["left"].exists()
assert DETECTION_MODELS["right"].exists()
data_csv, sensor_images = detect.measure_length(
export_data, sensor_images = detect.measure_length(
path_img_with_failure_TrainedModel,
pixels_per_metric_X,
pixels_per_metric_Y,
)
# measured sizes
assert len(data_csv) == 18
assert len(export_data["sensor_sizes"]) == 18
assert sensor_images["left"] is not None
assert sensor_images["right"] is not None
detect.anomaly_detection(
img_path=path_img_with_failure_TrainedModel,
detection_models=DETECTION_MODELS,
data_csv=data_csv,
export_data=export_data,
sensor_images=sensor_images,
anomaly_threshold=constants.ANOMALY_THRESHOLD_DEFAULT,
)