question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Unexpected input data type

See original GitHub issue

I am trying to run the /extract endpoint but it always throws me the same error. The Docker image was built successfully and other API endpoints like /draw_detections run fine (I pass the images as base64 strings). Only the /extract endpoint fails. I am using the default glintr100 recognition model

OS: Windows 10 (No GPU - Using the deploy_cpu.sh’s env variables)

insightface_1  | [15:32:00] INFO - Detector started
insightface_1  | [15:32:00] INFO - Warming up face detection ONNX Runtime engine...
insightface_1  | [15:32:02] INFO - Warming up ArcFace ONNX Runtime engine...
insightface_1  | [15:32:03] INFO - Warming up GenderAge ONNX Runtime engine...
insightface_1  | [2022-06-30 15:32:03 +0000] [19] [INFO] Started server process [19]
insightface_1  | [2022-06-30 15:32:03 +0000] [19] [INFO] Waiting for application startup.
insightface_1  | [2022-06-30 15:32:03 +0000] [19] [INFO] Application startup complete.
insightface_1  | [2022-06-30 15:32:14 +0000] [19] [ERROR] Exception in ASGI application
insightface_1  | Traceback (most recent call last):
insightface_1  |   File "/usr/local/lib/python3.8/site-packages/uvicorn/protocols/http/h11_impl.py", line 403, in run_asgi
insightface_1  |     result = await app(self.scope, self.receive, self.send)
insightface_1  |   File "/usr/local/lib/python3.8/site-packages/uvicorn/middleware/proxy_headers.py", line 78, in __call__
insightface_1  |     return await self.app(scope, receive, send)
insightface_1  |   File "/usr/local/lib/python3.8/site-packages/fastapi/applications.py", line 269, in __call__
insightface_1  |     await super().__call__(scope, receive, send)
insightface_1  |   File "/usr/local/lib/python3.8/site-packages/starlette/applications.py", line 124, in __call__
insightface_1  |     await self.middleware_stack(scope, receive, send)
insightface_1  |   File "/usr/local/lib/python3.8/site-packages/starlette/middleware/errors.py", line 184, in __call__
insightface_1  |     raise exc
insightface_1  |   File "/usr/local/lib/python3.8/site-packages/starlette/middleware/errors.py", line 162, in __call__
insightface_1  |     await self.app(scope, receive, _send)
insightface_1  |   File "/usr/local/lib/python3.8/site-packages/starlette/exceptions.py", line 93, in __call__
insightface_1  |     raise exc
insightface_1  |   File "/usr/local/lib/python3.8/site-packages/starlette/exceptions.py", line 82, in __call__
insightface_1  |     await self.app(scope, receive, sender)
insightface_1  |   File "/usr/local/lib/python3.8/site-packages/fastapi/middleware/asyncexitstack.py", line 21, in __call__
insightface_1  |     raise e
insightface_1  |   File "/usr/local/lib/python3.8/site-packages/fastapi/middleware/asyncexitstack.py", line 18, in __call__
insightface_1  |     await self.app(scope, receive, send)
insightface_1  |   File "/usr/local/lib/python3.8/site-packages/starlette/routing.py", line 670, in __call__
insightface_1  |     await route.handle(scope, receive, send)
insightface_1  |   File "/usr/local/lib/python3.8/site-packages/starlette/routing.py", line 266, in handle
insightface_1  |     await self.app(scope, receive, send)
insightface_1  |   File "/usr/local/lib/python3.8/site-packages/starlette/routing.py", line 65, in app
insightface_1  |     response = await func(request)
insightface_1  |   File "/usr/local/lib/python3.8/site-packages/fastapi/routing.py", line 227, in app
insightface_1  |     raw_response = await run_endpoint_function(
insightface_1  |   File "/usr/local/lib/python3.8/site-packages/fastapi/routing.py", line 160, in run_endpoint_function
insightface_1  |     return await dependant.call(**values)
insightface_1  |   File "/app/app.py", line 80, in extract
insightface_1  |     output = await processing.extract(images, max_size=data.max_size, return_face_data=data.return_face_data,
insightface_1  |   File "/app/modules/processing.py", line 195, in extract
insightface_1  |     output = await self.embed(images, max_size=max_size, return_face_data=return_face_data, threshold=threshold,
insightface_1  |   File "/app/modules/processing.py", line 142, in embed
insightface_1  |     faces_by_img = (e for e in await _get([img for img in imgs_iterable]))
insightface_1  |   File "/app/modules/face_model.py", line 278, in get
insightface_1  |     faces = list(self.process_faces(faces,
insightface_1  |   File "/app/modules/face_model.py", line 149, in process_faces
insightface_1  |     ga = self.ga_model.get(crops)
insightface_1  |   File "/app/modules/model_zoo/exec_backends/onnxrt_backend.py", line 65, in get
insightface_1  |     ret = self.rec_model.run(self.outputs, {self.input.name: imgs})[0]
insightface_1  |   File "/usr/local/lib/python3.8/site-packages/onnxruntime/capi/onnxruntime_inference_collection.py", line 192, in run
insightface_1  |     return self._sess.run(output_names, input_feed, run_options)
insightface_1  | onnxruntime.capi.onnxruntime_pybind11_state.InvalidArgument: [ONNXRuntimeError] : 2 : INVALID_ARGUMENT : Unexpected input data type. Actual: (tensor(uint8)) , expected: (tensor(float))

Issue Analytics

  • State:closed
  • Created a year ago
  • Comments:7 (5 by maintainers)

github_iconTop GitHub Comments

1reaction
SthPhoenixcommented, Jul 2, 2022

Applied fix, should be working now out of the box

0reactions
SthPhoenixcommented, Jul 1, 2022

Oh, I totally missed you have enabled gender/age model, which seems to be source of this error. Thanks, I’ll fix it shortly.

P.S. Actually, at closer look you have changed quiet a lot default settings, which is a bit opposite to:

I use the exact same environment variables

Read more comments on GitHub >

github_iconTop Results From Across the Web

Unexpected input data type. Actual: (tensor(double)) , expected
While when I try to inference on the random "pure" NumPy object IMG_Rando , there seems to be a problem: Unexpected input data...
Read more >
Unexpected input data type - Optimum - Hugging Face Forums
Hi, I am running the example given on optimum github page and i am getting the following error on a window machine ...
Read more >
INVALID_ARGUMENT : Unexpected input data type. Actual ...
Hi, I have a fine-tuned BERT model that has the following shape. graph_name: tf_bert_for_multi_classification domain: onnxmltools description: input 0: ...
Read more >
Common errors with onnxruntime — ONNX Runtime 1.14.92+ ...
The first example fails due to bad types. onnxruntime only expects single floats ... [ONNXRuntimeError] : 2 : INVALID_ARGUMENT : Unexpected input data...
Read more >
R Error: Unexpected Input in X (2 Examples) - Statistics Globe
In this Example, I'll explain how to replicate the error “unexpected input in X” in R. First, let's create a numeric data object: ......
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found