Repository navigation
How to convert an Anomalib PatchCore model to OpenVINO format with a shape of [1, 3, xx, xx] #3891
Replies: 1 comment 1 reply
|
This is a known 2.7.0 regression, not something wrong in your script. Since 2.7.0 an exported PatchCore model only accepts a batch of exactly 2, and Why: the dynamo exporter traces with an example batch of 2 because it treats sizes 0 and 1 as constants ( Two ways out:
Either way, check the IR before running the inferencer: |
Uh oh!
There was an error while loading. Please reload this page.
When exporting a PatchCore model trained with Anomalib to the OpenVINO format and running it via
OpenVINOInferencerfor inference, the model input shape ends up being[2, 3, 256, 256].I have attempted to export the model with an input shape of
[1, 3, 256, 256], but it has not been successful.How can I correctly export the model to the OpenVINO format so that it functions as expected?
Environment:
train.py:
inference.py:
Error:
File "/home/xxxx/patchcore/.venv/lib/python3.12/site-packages/openvino/_ov_api.py", line 470, in call
return self._infer_request.infer(
^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/xxxx/patchcore/.venv/lib/python3.12/site-packages/openvino/_ov_api.py", line 202, in infer
return OVDict(super().infer(_data_dispatch(
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
RuntimeError: Exception from src/inference/src/cpp/infer_request.cpp:75:
Exception from src/inference/src/cpp/infer_request.cpp:67:
Check 'shape.compatible(ov::PartialShape(tensor->get_shape()))' failed at src/plugins/intel_cpu/src/infer_request.cpp:385:
Can't set the input tensor with index: 0, because the model input (shape=[2,3,256,256]) and the tensor (shape=(1.3.256.256)) are incompatiblettle"
All reactions