Skip to content

CPU Inference not working with optimized onnx cpu model #148

@MarcelCode

Description

@MarcelCode

I want to create an optimized model for ONNX CPU.

My code for exporting the model:

model_path = "./model/raw"

model = ModelManager.get(model_path)

runtime = RuntimeType.ONNX_CPU

optimized_model = model.export(runtime_type=runtime,
                               image_size=640,
                               device="cpu",
                               out_dir="./model/cpu",
                               overwrite=True)

For inference I am using the following code:

infer_model = InferModel(model_dir="./model/cpu",
                             runtime_type=RuntimeType.ONNX_CPU)

result = infer_model.infer("./image/raw/20230703_102957_38_2490-2093-1352-12.png",
                           annotate=True)

I am getting the following error:
RuntimeError: Found no NVIDIA driver on your system. Please check that you have an NVIDIA GPU

Am I doing sth wrong?

I saw that in infer/infer_model.py line 178 the device is hardcoded to cuda. If I change it to "cpu" it works.

Can you confirm that this is a bug or have I initialized my onnx cpu model in a wrong way?

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions