ML specific: compare your environments
For example, your model runs on mobile and in cloud using different engines: coreml
and onnxruntime
.
It would be great to make sure both pipelines are equal:
def test_pipelines_match(image_fixture):
image = cv2.imread(image_fixture)
coreml_model = CoreMLModel()
onnx_model = OnnxModel()
coreml_bbox, coreml_angle = coreml_model.predict(image)
onnx_bbox, onnx_angle = onnx_model.predict(image)
np.testing.assert_allclose(coreml_bbox, onnx_bbox, rtol=0, atol=1e-4)
np.testing.assert_allclose(coreml_angle, onnx_angle, rtol=0, atol=1e-4)