Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

OpenVino: facial detection is broken with 1.99.0 #8226

Closed
1 of 3 tasks
LeoAdL opened this issue Mar 23, 2024 · 105 comments
Closed
1 of 3 tasks

OpenVino: facial detection is broken with 1.99.0 #8226

LeoAdL opened this issue Mar 23, 2024 · 105 comments
Assignees

Comments

@LeoAdL
Copy link

LeoAdL commented Mar 23, 2024

The bug

When I try launching the face detection, whatever model I use, I get the following error:

immich_machine_learning  | [03/23/24 22:46:05] INFO     Setting 'buffalo_l' execution providers to         
immich_machine_learning  |                              ['OpenVINOExecutionProvider',                      
immich_machine_learning  |                              'CPUExecutionProvider'], in descending order of    
immich_machine_learning  |                              preference                                         
immich_machine_learning  | [03/23/24 22:46:05] INFO     Loading facial recognition model 'buffalo_l' to    
immich_machine_learning  |                              memory                                             
immich_machine_learning  | [03/23/24 22:46:08] ERROR    Exception in ASGI application                      
immich_machine_learning  |                                                                                 
immich_machine_learning  |                              ╭─────── Traceback (most recent call last) ───────╮
immich_machine_learning  |                              │ /usr/src/app/main.py:118 in predict             │
immich_machine_learning  |                              │                                                 │
immich_machine_learning  |                              │   115 │                                         │
immich_machine_learning  |                              │   116 │   model = await load(await model_cache. │
immich_machine_learning  |                              │       ttl=settings.model_ttl, **kwargs))        │
immich_machine_learning  |                              │   117 │   model.configure(**kwargs)             │
immich_machine_learning  |                              │ ❱ 118 │   outputs = await run(model.predict, in │
immich_machine_learning  |                              │   119 │   return ORJSONResponse(outputs)        │
immich_machine_learning  |                              │   120                                           │
immich_machine_learning  |                              │   121                                           │
immich_machine_learning  |                              │                                                 │
immich_machine_learning  |                              │ /usr/src/app/main.py:125 in run                 │
immich_machine_learning  |                              │                                                 │
immich_machine_learning  |                              │   122 async def run(func: Callable[..., Any], i │
immich_machine_learning  |                              │   123 │   if thread_pool is None:               │
immich_machine_learning  |                              │   124 │   │   return func(inputs)               │
immich_machine_learning  |                              │ ❱ 125 │   return await asyncio.get_running_loop │
immich_machine_learning  |                              │   126                                           │
immich_machine_learning  |                              │   127                                           │
immich_machine_learning  |                              │   128 async def load(model: InferenceModel) ->  │
immich_machine_learning  |                              │                                                 │
immich_machine_learning  |                              │ /usr/lib/python3.10/concurrent/futures/thread.p │
immich_machine_learning  |                              │ y:58 in run                                     │
immich_machine_learning  |                              │                                                 │
immich_machine_learning  |                              │ /usr/src/app/models/base.py:59 in predict       │
immich_machine_learning  |                              │                                                 │
immich_machine_learning  |                              │    56 │   │   self.load()                       │
immich_machine_learning  |                              │    57 │   │   if model_kwargs:                  │
immich_machine_learning  |                              │    58 │   │   │   self.configure(**model_kwargs │
immich_machine_learning  |                              │ ❱  59 │   │   return self._predict(inputs)      │
immich_machine_learning  |                              │    60 │                                         │
immich_machine_learning  |                              │    61 │   @abstractmethod                       │
immich_machine_learning  |                              │    62 │   def _predict(self, inputs: Any) -> An │
immich_machine_learning  |                              │                                                 │
immich_machine_learning  |                              │ /usr/src/app/models/facial_recognition.py:49 in │
immich_machine_learning  |                              │ _predict                                        │
immich_machine_learning  |                              │                                                 │
immich_machine_learning  |                              │   46 │   │   else:                              │
immich_machine_learning  |                              │   47 │   │   │   decoded_image = image          │
immich_machine_learning  |                              │   48 │   │   assert is_ndarray(decoded_image, n │
immich_machine_learning  |                              │ ❱ 49 │   │   bboxes, kpss = self.det_model.dete │
immich_machine_learning  |                              │   50 │   │   if bboxes.size == 0:               │
immich_machine_learning  |                              │   51 │   │   │   return []                      │
immich_machine_learning  |                              │   52 │   │   assert is_ndarray(kpss, np.float32 │
immich_machine_learning  |                              │                                                 │
immich_machine_learning  |                              │ /opt/venv/lib/python3.10/site-packages/insightf │
immich_machine_learning  |                              │ ace/model_zoo/retinaface.py:224 in detect       │
immich_machine_learning  |                              │                                                 │
immich_machine_learning  |                              │   221 │   │   det_img = np.zeros( (input_size[1 │
immich_machine_learning  |                              │   222 │   │   det_img[:new_height, :new_width,  │
immich_machine_learning  |                              │   223 │   │                                     │
immich_machine_learning  |                              │ ❱ 224 │   │   scores_list, bboxes_list, kpss_li │
immich_machine_learning  |                              │   225 │   │                                     │
immich_machine_learning  |                              │   226 │   │   scores = np.vstack(scores_list)   │
immich_machine_learning  |                              │   227 │   │   scores_ravel = scores.ravel()     │
immich_machine_learning  |                              │                                                 │
immich_machine_learning  |                              │ /opt/venv/lib/python3.10/site-packages/insightf │
immich_machine_learning  |                              │ ace/model_zoo/retinaface.py:152 in forward      │
immich_machine_learning  |                              │                                                 │
immich_machine_learning  |                              │   149 │   │   kpss_list = []                    │
immich_machine_learning  |                              │   150 │   │   input_size = tuple(img.shape[0:2] │
immich_machine_learning  |                              │   151 │   │   blob = cv2.dnn.blobFromImage(img, │
immich_machine_learning  |                              │       (self.input_mean, self.input_mean, self.i │
immich_machine_learning  |                              │ ❱ 152 │   │   net_outs = self.session.run(self. │
immich_machine_learning  |                              │   153 │   │                                     │
immich_machine_learning  |                              │   154 │   │   input_height = blob.shape[2]      │
immich_machine_learning  |                              │   155 │   │   input_width = blob.shape[3]       │
immich_machine_learning  |                              │                                                 │
immich_machine_learning  |                              │ /opt/venv/lib/python3.10/site-packages/onnxrunt │
immich_machine_learning  |                              │ ime/capi/onnxruntime_inference_collection.py:22 │
immich_machine_learning  |                              │ 0 in run                                        │
immich_machine_learning  |                              │                                                 │
immich_machine_learning  |                              │    217 │   │   if not output_names:             │
immich_machine_learning  |                              │    218 │   │   │   output_names = [output.name  │
immich_machine_learning  |                              │    219 │   │   try:                             │
immich_machine_learning  |                              │ ❱  220 │   │   │   return self._sess.run(output │
immich_machine_learning  |                              │    221 │   │   except C.EPFail as err:          │
immich_machine_learning  |                              │    222 │   │   │   if self._enable_fallback:    │
immich_machine_learning  |                              │    223 │   │   │   │   print(f"EP Error: {err!s │
immich_machine_learning  |                              ╰─────────────────────────────────────────────────╯
immich_machine_learning  |                              RuntimeException: [ONNXRuntimeError] : 6 :         
immich_machine_learning  |                              RUNTIME_EXCEPTION : Encountered unknown exception  
immich_machine_learning  |                              in Run()                                           
immich_microservices     | [Nest] 7  - 03/23/2024, 10:46:08 PM   ERROR [JobService] Unable to run job handler (faceDetection/face-detection): Error: Machine learning request for facial recognition failed with status 500: Internal Server Error
immich_microservices     | [Nest] 7  - 03/23/2024, 10:46:08 PM   ERROR [JobService] Error: Machine learning request for facial recognition failed with status 500: Internal Server Error
immich_microservices     |     at MachineLearningRepository.predict (/usr/src/app/dist/infra/repositories/machine-learning.repository.js:23:19)
immich_microservices     |     at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
immich_microservices     |     at async PersonService.handleDetectFaces (/usr/src/app/dist/domain/person/person.service.js:248:23)
immich_microservices     |     at async /usr/src/app/dist/domain/job/job.service.js:137:36
immich_microservices     |     at async Worker.processJob (/usr/src/app/node_modules/bullmq/dist/cjs/classes/worker.js:394:28)
immich_microservices     |     at async Worker.retryIfFailed (/usr/src/app/node_modules/bullmq/dist/cjs/classes/worker.js:581:24)
immich_microservices     | [Nest] 7  - 03/23/2024, 10:46:08 PM   ERROR [JobService] Object:
immich_microservices     | {
immich_microservices     |   "id": "9e1d4bbf-84c2-40dd-9aec-c913e5a1a662"
immich_microservices     | }
immich_microservices     | 

Regular Smart Search proceeds without issue.

The OS that Immich Server is running on

Proxmox 8.1 (6.5 Linux Kernel)

Version of Immich Server

1.99.0

Version of Immich Mobile App

1.99.0

Platform with the issue

  • Server
  • Web
  • Mobile

Your docker-compose.yml content

#
# WARNING: Make sure to use the docker-compose.yml of the current release:
#
# https://github.com/immich-app/immich/releases/latest/download/docker-compose.yml
#
# The compose file on main may not be compatible with the latest release.
#

name: immich

services:
  immich-server:
    container_name: immich_server
    image: ghcr.io/immich-app/immich-server:${IMMICH_VERSION:-release}
    command: [ "start.sh", "immich" ]
    volumes:
      - ${UPLOAD_LOCATION}:/usr/src/app/upload
      - /mount/op11:/usr/src/app/external
      - /etc/localtime:/etc/localtime:ro
    env_file:
      - .env
    ports:
      - 2283:3001
    depends_on:
      - redis
      - database
    restart: always

  immich-microservices:
    container_name: immich_microservices
    image: ghcr.io/immich-app/immich-server:${IMMICH_VERSION:-release}
    extends: 
     file: hwaccel.transcoding.yml 
     service: quicksync # set to one of [nvenc, quicksync, rkmpp, vaapi, vaapi-wsl] for accelerated transcoding
    command: [ "start.sh", "microservices" ]
    volumes:
      - ${UPLOAD_LOCATION}:/usr/src/app/upload
      - /mount/op11:/usr/src/app/external
      - /etc/localtime:/etc/localtime:ro
    env_file:
      - .env
    depends_on:
      - redis
      - database
    restart: always

  immich-machine-learning:
    container_name: immich_machine_learning
    # For hardware acceleration, add one of -[armnn, cuda, openvino] to the image tag.
    # Example tag: ${IMMICH_VERSION:-release}-cuda
    image: ghcr.io/immich-app/immich-machine-learning:main-openvino
    extends: # uncomment this section for hardware acceleration - see https://immich.app/docs/features/ml-hardware-acceleration
      file: hwaccel.ml.yml
      service: openvino # set to one of [armnn, cuda, openvino, openvino-wsl] for accelerated inference - use the `-wsl` version for WSL2 where applicable
    volumes:
      - model-cache:/cache
    env_file:
      - .env
    restart: always

  redis:
    container_name: immich_redis
    image: registry.hub.docker.com/library/redis:6.2-alpine@sha256:51d6c56749a4243096327e3fb964a48ed92254357108449cb6e23999c37773c5
    restart: always

  database:
    container_name: immich_postgres
    image: registry.hub.docker.com/tensorchord/pgvecto-rs:pg14-v0.2.0@sha256:90724186f0a3517cf6914295b5ab410db9ce23190a2d9d0b9dd6463e3fa298f0
    environment:
      POSTGRES_PASSWORD: ${DB_PASSWORD}
      POSTGRES_USER: ${DB_USERNAME}
      POSTGRES_DB: ${DB_DATABASE_NAME}
    volumes:
      - pgdata:/var/lib/postgresql/data
    restart: always

volumes:
  pgdata:
  model-cache:

Your .env content

# You can find documentation for all the supported env variables at https://immich.app/docs/install/environment-variables

# The location where your uploaded files are stored
UPLOAD_LOCATION=./library
# The Immich version to use. You can pin this to a specific version like "v1.71.0"
IMMICH_VERSION=release
# Connection secret for postgres. You should change it to a random password
DB_PASSWORD=(redacted)

# The values below this line do not need to be changed
###################################################################################
DB_HOSTNAME=immich_postgres
DB_USERNAME=postgres
DB_DATABASE_NAME=immich

REDIS_HOSTNAME=immich_redis

Reproduction steps

1. docker compose up
2. --> Jobs 
3. --> Click Face Detection: All
...

Additional information

My processor is an Intel N100.
Previously to 1.99.0, the face detection was working, but I had issues with the smart search, so I guess it's hard to get all of it with OpenVino haha.

Thank you for the gigantic work up to now!
Leo

@LeoAdL LeoAdL changed the title OpenVino: facial detection is broken OpenVino: facial detection is broken with 1.99.0 Mar 23, 2024
@mertalev
Copy link
Contributor

Can you check if setting the concurrency to 1 and restarting helps? And if that doesn't work, deleting the model cache and restarting?

@LeoAdL
Copy link
Author

LeoAdL commented Mar 24, 2024

Setting the concurrency to 1, I almost get immediately a similar error:

immich_redis             | 1:M 24 Mar 2024 00:46:41.343 * Background saving terminated with success
immich_machine_learning  | [03/24/24 00:46:43] INFO     Setting 'buffalo_l' execution providers to         
immich_machine_learning  |                              ['OpenVINOExecutionProvider',                      
immich_machine_learning  |                              'CPUExecutionProvider'], in descending order of    
immich_machine_learning  |                              preference                                         
immich_machine_learning  | [03/24/24 00:46:43] INFO     Loading facial recognition model 'buffalo_l' to    
immich_machine_learning  |                              memory                                             
immich_machine_learning  | [03/24/24 00:46:45] ERROR    Exception in ASGI application                      
immich_machine_learning  |                                                                                 
immich_machine_learning  |                              ╭─────── Traceback (most recent call last) ───────╮
immich_machine_learning  |                              │ /usr/src/app/main.py:118 in predict             │
immich_machine_learning  |                              │                                                 │
immich_machine_learning  |                              │   115 │                                         │
immich_machine_learning  |                              │   116 │   model = await load(await model_cache. │
immich_machine_learning  |                              │       ttl=settings.model_ttl, **kwargs))        │
immich_machine_learning  |                              │   117 │   model.configure(**kwargs)             │
immich_machine_learning  |                              │ ❱ 118 │   outputs = await run(model.predict, in │
immich_machine_learning  |                              │   119 │   return ORJSONResponse(outputs)        │
immich_machine_learning  |                              │   120                                           │
immich_machine_learning  |                              │   121                                           │
immich_machine_learning  |                              │                                                 │
immich_machine_learning  |                              │ /usr/src/app/main.py:125 in run                 │
immich_machine_learning  |                              │                                                 │
immich_machine_learning  |                              │   122 async def run(func: Callable[..., Any], i │
immich_machine_learning  |                              │   123 │   if thread_pool is None:               │
immich_machine_learning  |                              │   124 │   │   return func(inputs)               │
immich_machine_learning  |                              │ ❱ 125 │   return await asyncio.get_running_loop │
immich_machine_learning  |                              │   126                                           │
immich_machine_learning  |                              │   127                                           │
immich_machine_learning  |                              │   128 async def load(model: InferenceModel) ->  │
immich_machine_learning  |                              │                                                 │
immich_machine_learning  |                              │ /usr/lib/python3.10/concurrent/futures/thread.p │
immich_machine_learning  |                              │ y:58 in run                                     │
immich_machine_learning  |                              │                                                 │
immich_machine_learning  |                              │ /usr/src/app/models/base.py:59 in predict       │
immich_machine_learning  |                              │                                                 │
immich_machine_learning  |                              │    56 │   │   self.load()                       │
immich_machine_learning  |                              │    57 │   │   if model_kwargs:                  │
immich_machine_learning  |                              │    58 │   │   │   self.configure(**model_kwargs │
immich_machine_learning  |                              │ ❱  59 │   │   return self._predict(inputs)      │
immich_machine_learning  |                              │    60 │                                         │
immich_machine_learning  |                              │    61 │   @abstractmethod                       │
immich_machine_learning  |                              │    62 │   def _predict(self, inputs: Any) -> An │
immich_machine_learning  |                              │                                                 │
immich_machine_learning  |                              │ /usr/src/app/models/facial_recognition.py:49 in │
immich_machine_learning  |                              │ _predict                                        │
immich_machine_learning  |                              │                                                 │
immich_machine_learning  |                              │   46 │   │   else:                              │
immich_machine_learning  |                              │   47 │   │   │   decoded_image = image          │
immich_machine_learning  |                              │   48 │   │   assert is_ndarray(decoded_image, n │
immich_machine_learning  |                              │ ❱ 49 │   │   bboxes, kpss = self.det_model.dete │
immich_machine_learning  |                              │   50 │   │   if bboxes.size == 0:               │
immich_machine_learning  |                              │   51 │   │   │   return []                      │
immich_machine_learning  |                              │   52 │   │   assert is_ndarray(kpss, np.float32 │
immich_machine_learning  |                              │                                                 │
immich_machine_learning  |                              │ /opt/venv/lib/python3.10/site-packages/insightf │
immich_machine_learning  |                              │ ace/model_zoo/retinaface.py:224 in detect       │
immich_machine_learning  |                              │                                                 │
immich_machine_learning  |                              │   221 │   │   det_img = np.zeros( (input_size[1 │
immich_machine_learning  |                              │   222 │   │   det_img[:new_height, :new_width,  │
immich_machine_learning  |                              │   223 │   │                                     │
immich_machine_learning  |                              │ ❱ 224 │   │   scores_list, bboxes_list, kpss_li │
immich_machine_learning  |                              │   225 │   │                                     │
immich_machine_learning  |                              │   226 │   │   scores = np.vstack(scores_list)   │
immich_machine_learning  |                              │   227 │   │   scores_ravel = scores.ravel()     │
immich_machine_learning  |                              │                                                 │
immich_machine_learning  |                              │ /opt/venv/lib/python3.10/site-packages/insightf │
immich_machine_learning  |                              │ ace/model_zoo/retinaface.py:152 in forward      │
immich_machine_learning  |                              │                                                 │
immich_machine_learning  |                              │   149 │   │   kpss_list = []                    │
immich_machine_learning  |                              │   150 │   │   input_size = tuple(img.shape[0:2] │
immich_machine_learning  |                              │   151 │   │   blob = cv2.dnn.blobFromImage(img, │
immich_machine_learning  |                              │       (self.input_mean, self.input_mean, self.i │
immich_machine_learning  |                              │ ❱ 152 │   │   net_outs = self.session.run(self. │
immich_machine_learning  |                              │   153 │   │                                     │
immich_machine_learning  |                              │   154 │   │   input_height = blob.shape[2]      │
immich_machine_learning  |                              │   155 │   │   input_width = blob.shape[3]       │
immich_machine_learning  |                              │                                                 │
immich_machine_learning  |                              │ /opt/venv/lib/python3.10/site-packages/onnxrunt │
immich_machine_learning  |                              │ ime/capi/onnxruntime_inference_collection.py:22 │
immich_machine_learning  |                              │ 0 in run                                        │
immich_machine_learning  |                              │                                                 │
immich_machine_learning  |                              │    217 │   │   if not output_names:             │
immich_machine_learning  |                              │    218 │   │   │   output_names = [output.name  │
immich_machine_learning  |                              │    219 │   │   try:                             │
immich_machine_learning  |                              │ ❱  220 │   │   │   return self._sess.run(output │
immich_machine_learning  |                              │    221 │   │   except C.EPFail as err:          │
immich_machine_learning  |                              │    222 │   │   │   if self._enable_fallback:    │
immich_machine_learning  |                              │    223 │   │   │   │   print(f"EP Error: {err!s │
immich_machine_learning  |                              ╰─────────────────────────────────────────────────╯
immich_machine_learning  |                              RuntimeException: [ONNXRuntimeError] : 6 :         
immich_machine_learning  |                              RUNTIME_EXCEPTION : Encountered unknown exception  
immich_machine_learning  |                              in Run()                                           
immich_microservices     | [Nest] 7  - 03/24/2024, 12:46:45 AM   ERROR [JobService] Unable to run job handler (faceDetection/face-detection): Error: Machine learning request for facial recognition failed with status 500: Internal Server Error
immich_microservices     | [Nest] 7  - 03/24/2024, 12:46:45 AM   ERROR [JobService] Error: Machine learning request for facial recognition failed with status 500: Internal Server Error
immich_microservices     |     at MachineLearningRepository.predict (/usr/src/app/dist/infra/repositories/machine-learning.repository.js:23:19)
immich_microservices     |     at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
immich_microservices     |     at async PersonService.handleDetectFaces (/usr/src/app/dist/domain/person/person.service.js:248:23)
immich_microservices     |     at async /usr/src/app/dist/domain/job/job.service.js:137:36
immich_microservices     |     at async Worker.processJob (/usr/src/app/node_modules/bullmq/dist/cjs/classes/worker.js:394:28)
immich_microservices     |     at async Worker.retryIfFailed (/usr/src/app/node_modules/bullmq/dist/cjs/classes/worker.js:581:24)
immich_microservices     | [Nest] 7  - 03/24/2024, 12:46:45 AM   ERROR [JobService] Object:
immich_microservices     | {
immich_microservices     |   "id": "9e1d4bbf-84c2-40dd-9aec-c913e5a1a662"
immich_microservices     | }
immich_microservices     | 

Deleting the model cache did not help neither.

@mertalev
Copy link
Contributor

mertalev commented Mar 24, 2024

Can you try again with these env variables set?

ORT_OPENVINO_ENABLE_CI_LOG=1
ORT_OPENVINO_ENABLE_DEBUG=1
OPENVINO_LOG_LEVEL=5
LOG_LEVEL=debug

This will help get more info on what's causing the error.

@edjacob25
Copy link

edjacob25 commented Mar 24, 2024

I have the same issue with the N100 too. I tried changing the model to see if that was a workaround but I'm still getting the issue.
After adding those variables I got this:

Complete logs
In the OpenVINO EP
Model is fully supported on OpenVINO
CreateNgraphFunc
In the OpenVINO EP
Model is fully supported on OpenVINO
CreateNgraphFunc
[03/24/24 06:07:37] ERROR    Exception in ASGI application

                             ╭─────── Traceback (most recent call last) ───────╮
                             │ /usr/src/app/main.py:118 in predict             │
                             │                                                 │
                             │   115 │                                         │
                             │   116 │   model = await load(await model_cache. │
                             │       ttl=settings.model_ttl, **kwargs))        │
                             │   117 │   model.configure(**kwargs)             │
                             │ ❱ 118 │   outputs = await run(model.predict, in │
                             │   119 │   return ORJSONResponse(outputs)        │
                             │   120                                           │
                             │   121                                           │
                             │                                                 │
                             │ ╭────────────────── locals ───────────────────╮ │
                             │ │      image = UploadFile(filename='blob',    │ │
                             │ │              size=212656,                   │ │
                             │ │              headers=Headers({'content-dis… │ │
                             │ │              'form-data; name="image";      │ │
                             │ │              filename="blob"',              │ │
                             │ │              'content-type':                │ │
                             │ │              'application/octet-stream'}))  │ │
                             │ │     inputs = b'\xff\xd8\xff\xe2\x01\xf0ICC… │ │
                             │ │              \x00\x00mntrRGB XYZ            │ │
                             │ │              \x07\xe2\x00\x03\x00\x14\x00\… │ │
                             │ │     kwargs = {                              │ │
                             │ │              │   'minScore': 0.7,           │ │
                             │ │              │   'maxDistance': 0.5,        │ │
                             │ │              │   'minFaces': 3              │ │
                             │ │              }                              │ │
                             │ │      model = <app.models.facial_recognitio… │ │
                             │ │              object at 0x7fe1f2e98be0>      │ │
                             │ │ model_name = 'antelopev2'                   │ │
                             │ │ model_type = <ModelType.FACIAL_RECOGNITION: │ │
                             │ │              'facial-recognition'>          │ │
                             │ │    options = '{"minScore":0.7,"maxDistance… │ │
                             │ │       text = None                           │ │
                             │ ╰─────────────────────────────────────────────╯ │
                             │                                                 │
                             │ /usr/src/app/main.py:125 in run                 │
                             │                                                 │
                             │   122 async def run(func: Callable[..., Any], i │
                             │   123 │   if thread_pool is None:               │
                             │   124 │   │   return func(inputs)               │
                             │ ❱ 125 │   return await asyncio.get_running_loop │
                             │   126                                           │
                             │   127                                           │
                             │   128 async def load(model: InferenceModel) ->  │
                             │                                                 │
                             │ ╭────────────────── locals ───────────────────╮ │
                             │ │   func = <bound method                      │ │
                             │ │          InferenceModel.predict of          │ │
                             │ │          <app.models.facial_recognition.Fa… │ │
                             │ │          object at 0x7fe1f2e98be0>>         │ │
                             │ │ inputs = b'\xff\xd8\xff\xe2\x01\xf0ICC_PRO… │ │
                             │ │          \x00\x00mntrRGB XYZ                │ │
                             │ │          \x07\xe2\x00\x03\x00\x14\x00\t\x0… │ │
                             │ ╰─────────────────────────────────────────────╯ │
                             │                                                 │
                             │ /usr/lib/python3.10/concurrent/futures/thread.p │
                             │ y:58 in run                                     │
                             │                                                 │
                             │ /usr/src/app/models/base.py:59 in predict       │
                             │                                                 │
                             │    56 │   │   self.load()                       │
                             │    57 │   │   if model_kwargs:                  │
                             │    58 │   │   │   self.configure(**model_kwargs │
                             │ ❱  59 │   │   return self._predict(inputs)      │
                             │    60 │                                         │
                             │    61 │   @abstractmethod                       │
                             │    62 │   def _predict(self, inputs: Any) -> An │
                             │                                                 │
                             │ ╭────────────────── locals ───────────────────╮ │
                             │ │       inputs = b'\xff\xd8\xff\xe2\x01\xf0I… │ │
                             │ │                \x00\x00mntrRGB XYZ          │ │
                             │ │                \x07\xe2\x00\x03\x00\x14\x0… │ │
                             │ │ model_kwargs = {}                           │ │
                             │ │         self = <app.models.facial_recognit… │ │
                             │ │                object at 0x7fe1f2e98be0>    │ │
                             │ ╰─────────────────────────────────────────────╯ │
                             │                                                 │
                             │ /usr/src/app/models/facial_recognition.py:49 in │
                             │ _predict                                        │
                             │                                                 │
                             │   46 │   │   else:                              │
                             │   47 │   │   │   decoded_image = image          │
                             │   48 │   │   assert is_ndarray(decoded_image, n │
                             │ ❱ 49 │   │   bboxes, kpss = self.det_model.dete │
                             │   50 │   │   if bboxes.size == 0:               │
                             │   51 │   │   │   return []                      │
                             │   52 │   │   assert is_ndarray(kpss, np.float32 │
                             │                                                 │
                             │ ╭────────────────── locals ───────────────────╮ │
                             │ │ decoded_image = array([[[216, 140, 104],    │ │
                             │ │                 │   │   [216, 140, 104],    │ │
                             │ │                 │   │   [216, 140, 104],    │ │
                             │ │                 │   │   ...,                │ │
                             │ │                 │   │   [227, 154, 116],    │ │
                             │ │                 │   │   [227, 154, 116],    │ │
                             │ │                 │   │   [227, 154, 116]],   │ │
                             │ │                 │                           │ │
                             │ │                 │      [[216, 140, 104],    │ │
                             │ │                 │   │   [216, 140, 104],    │ │
                             │ │                 │   │   [216, 140, 104],    │ │
                             │ │                 │   │   ...,                │ │
                             │ │                 │   │   [227, 154, 116],    │ │
                             │ │                 │   │   [227, 154, 116],    │ │
                             │ │                 │   │   [227, 154, 116]],   │ │
                             │ │                 │                           │ │
                             │ │                 │      [[216, 140, 104],    │ │
                             │ │                 │   │   [216, 140, 104],    │ │
                             │ │                 │   │   [216, 140, 104],    │ │
                             │ │                 │   │   ...,                │ │
                             │ │                 │   │   [227, 154, 116],    │ │
                             │ │                 │   │   [227, 154, 116],    │ │
                             │ │                 │   │   [227, 154, 116]],   │ │
                             │ │                 │                           │ │
                             │ │                 │      ...,                 │ │
                             │ │                 │                           │ │
                             │ │                 │      [[ 47,  29,  22],    │ │
                             │ │                 │   │   [ 47,  29,  22],    │ │
                             │ │                 │   │   [ 47,  29,  22],    │ │
                             │ │                 │   │   ...,                │ │
                             │ │                 │   │   [ 10,  10,   4],    │ │
                             │ │                 │   │   [ 10,  10,   4],    │ │
                             │ │                 │   │   [ 10,  10,   4]],   │ │
                             │ │                 │                           │ │
                             │ │                 │      [[ 46,  28,  21],    │ │
                             │ │                 │   │   [ 46,  28,  21],    │ │
                             │ │                 │   │   [ 46,  28,  21],    │ │
                             │ │                 │   │   ...,                │ │
                             │ │                 │   │   [  9,   9,   3],    │ │
                             │ │                 │   │   [  9,   9,   3],    │ │
                             │ │                 │   │   [  9,   9,   3]],   │ │
                             │ │                 │                           │ │
                             │ │                 │      [[ 45,  27,  20],    │ │
                             │ │                 │   │   [ 45,  27,  20],    │ │
                             │ │                 │   │   [ 45,  27,  20],    │ │
                             │ │                 │   │   ...,                │ │
                             │ │                 │   │   [  9,   9,   3],    │ │
                             │ │                 │   │   [  9,   9,   3],    │ │
                             │ │                 │   │   [  9,   9,   3]]],  │ │
                             │ │                 dtype=uint8)                │ │
                             │ │         image = b'\xff\xd8\xff\xe2\x01\xf0… │ │
                             │ │                 \x00\x00mntrRGB XYZ         │ │
                             │ │                 \x07\xe2\x00\x03\x00\x14\x… │ │
                             │ │          self = <app.models.facial_recogni… │ │
                             │ │                 object at 0x7fe1f2e98be0>   │ │
                             │ ╰─────────────────────────────────────────────╯ │
                             │                                                 │
                             │ /opt/venv/lib/python3.10/site-packages/insightf │
                             │ ace/model_zoo/retinaface.py:224 in detect       │
                             │                                                 │
                             │   221 │   │   det_img = np.zeros( (input_size[1 │
                             │   222 │   │   det_img[:new_height, :new_width,  │
                             │   223 │   │                                     │
                             │ ❱ 224 │   │   scores_list, bboxes_list, kpss_li │
                             │   225 │   │                                     │
                             │   226 │   │   scores = np.vstack(scores_list)   │
                             │   227 │   │   scores_ravel = scores.ravel()     │
                             │                                                 │
                             │ ╭────────────────── locals ───────────────────╮ │
                             │ │     det_img = array([[[216, 140, 104],      │ │
                             │ │               │   │   [216, 140, 104],      │ │
                             │ │               │   │   [216, 140, 104],      │ │
                             │ │               │   │   ...,                  │ │
                             │ │               │   │   [  0,   0,   0],      │ │
                             │ │               │   │   [  0,   0,   0],      │ │
                             │ │               │   │   [  0,   0,   0]],     │ │
                             │ │               │                             │ │
                             │ │               │      [[217, 141, 105],      │ │
                             │ │               │   │   [217, 141, 105],      │ │
                             │ │               │   │   [217, 141, 105],      │ │
                             │ │               │   │   ...,                  │ │
                             │ │               │   │   [  0,   0,   0],      │ │
                             │ │               │   │   [  0,   0,   0],      │ │
                             │ │               │   │   [  0,   0,   0]],     │ │
                             │ │               │                             │ │
                             │ │               │      [[217, 141, 105],      │ │
                             │ │               │   │   [217, 141, 105],      │ │
                             │ │               │   │   [217, 141, 105],      │ │
                             │ │               │   │   ...,                  │ │
                             │ │               │   │   [  0,   0,   0],      │ │
                             │ │               │   │   [  0,   0,   0],      │ │
                             │ │               │   │   [  0,   0,   0]],     │ │
                             │ │               │                             │ │
                             │ │               │      ...,                   │ │
                             │ │               │                             │ │
                             │ │               │      [[ 45,  27,  20],      │ │
                             │ │               │   │   [ 45,  27,  20],      │ │
                             │ │               │   │   [ 45,  27,  20],      │ │
                             │ │               │   │   ...,                  │ │
                             │ │               │   │   [  0,   0,   0],      │ │
                             │ │               │   │   [  0,   0,   0],      │ │
                             │ │               │   │   [  0,   0,   0]],     │ │
                             │ │               │                             │ │
                             │ │               │      [[ 47,  29,  22],      │ │
                             │ │               │   │   [ 47,  29,  22],      │ │
                             │ │               │   │   [ 47,  29,  22],      │ │
                             │ │               │   │   ...,                  │ │
                             │ │               │   │   [  0,   0,   0],      │ │
                             │ │               │   │   [  0,   0,   0],      │ │
                             │ │               │   │   [  0,   0,   0]],     │ │
                             │ │               │                             │ │
                             │ │               │      [[ 46,  28,  21],      │ │
                             │ │               │   │   [ 46,  28,  21],      │ │
                             │ │               │   │   [ 46,  28,  21],      │ │
                             │ │               │   │   ...,                  │ │
                             │ │               │   │   [  0,   0,   0],      │ │
                             │ │               │   │   [  0,   0,   0],      │ │
                             │ │               │   │   [  0,   0,   0]]],    │ │
                             │ │               dtype=uint8)                  │ │
                             │ │   det_scale = 0.3333333333333333            │ │
                             │ │    im_ratio = 1.3333333333333333            │ │
                             │ │         img = array([[[216, 140, 104],      │ │
                             │ │               │   │   [216, 140, 104],      │ │
                             │ │               │   │   [216, 140, 104],      │ │
                             │ │               │   │   ...,                  │ │
                             │ │               │   │   [227, 154, 116],      │ │
                             │ │               │   │   [227, 154, 116],      │ │
                             │ │               │   │   [227, 154, 116]],     │ │
                             │ │               │                             │ │
                             │ │               │      [[216, 140, 104],      │ │
                             │ │               │   │   [216, 140, 104],      │ │
                             │ │               │   │   [216, 140, 104],      │ │
                             │ │               │   │   ...,                  │ │
                             │ │               │   │   [227, 154, 116],      │ │
                             │ │               │   │   [227, 154, 116],      │ │
                             │ │               │   │   [227, 154, 116]],     │ │
                             │ │               │                             │ │
                             │ │               │      [[216, 140, 104],      │ │
                             │ │               │   │   [216, 140, 104],      │ │
                             │ │               │   │   [216, 140, 104],      │ │
                             │ │               │   │   ...,                  │ │
                             │ │               │   │   [227, 154, 116],      │ │
                             │ │               │   │   [227, 154, 116],      │ │
                             │ │               │   │   [227, 154, 116]],     │ │
                             │ │               │                             │ │
                             │ │               │      ...,                   │ │
                             │ │               │                             │ │
                             │ │               │      [[ 47,  29,  22],      │ │
                             │ │               │   │   [ 47,  29,  22],      │ │
                             │ │               │   │   [ 47,  29,  22],      │ │
                             │ │               │   │   ...,                  │ │
                             │ │               │   │   [ 10,  10,   4],      │ │
                             │ │               │   │   [ 10,  10,   4],      │ │
                             │ │               │   │   [ 10,  10,   4]],     │ │
                             │ │               │                             │ │
                             │ │               │      [[ 46,  28,  21],      │ │
                             │ │               │   │   [ 46,  28,  21],      │ │
                             │ │               │   │   [ 46,  28,  21],      │ │
                             │ │               │   │   ...,                  │ │
                             │ │               │   │   [  9,   9,   3],      │ │
                             │ │               │   │   [  9,   9,   3],      │ │
                             │ │               │   │   [  9,   9,   3]],     │ │
                             │ │               │                             │ │
                             │ │               │      [[ 45,  27,  20],      │ │
                             │ │               │   │   [ 45,  27,  20],      │ │
                             │ │               │   │   [ 45,  27,  20],      │ │
                             │ │               │   │   ...,                  │ │
                             │ │               │   │   [  9,   9,   3],      │ │
                             │ │               │   │   [  9,   9,   3],      │ │
                             │ │               │   │   [  9,   9,   3]]],    │ │
                             │ │               dtype=uint8)                  │ │
                             │ │  input_size = (640, 640)                    │ │
                             │ │     max_num = 0                             │ │
                             │ │      metric = 'default'                     │ │
                             │ │ model_ratio = 1.0                           │ │
                             │ │  new_height = 640                           │ │
                             │ │   new_width = 480                           │ │
                             │ │ resized_img = array([[[216, 140, 104],      │ │
                             │ │               │   │   [216, 140, 104],      │ │
                             │ │               │   │   [216, 140, 104],      │ │
                             │ │               │   │   ...,                  │ │
                             │ │               │   │   [227, 154, 116],      │ │
                             │ │               │   │   [227, 154, 116],      │ │
                             │ │               │   │   [227, 154, 116]],     │ │
                             │ │               │                             │ │
                             │ │               │      [[217, 141, 105],      │ │
                             │ │               │   │   [217, 141, 105],      │ │
                             │ │               │   │   [217, 141, 105],      │ │
                             │ │               │   │   ...,                  │ │
                             │ │               │   │   [227, 154, 116],      │ │
                             │ │               │   │   [227, 154, 116],      │ │
                             │ │               │   │   [227, 154, 116]],     │ │
                             │ │               │                             │ │
                             │ │               │      [[217, 141, 105],      │ │
                             │ │               │   │   [217, 141, 105],      │ │
                             │ │               │   │   [217, 141, 105],      │ │
                             │ │               │   │   ...,                  │ │
                             │ │               │   │   [227, 154, 116],      │ │
                             │ │               │   │   [227, 154, 116],      │ │
                             │ │               │   │   [227, 154, 116]],     │ │
                             │ │               │                             │ │
                             │ │               │      ...,                   │ │
                             │ │               │                             │ │
                             │ │               │      [[ 45,  27,  20],      │ │
                             │ │               │   │   [ 45,  27,  20],      │ │
                             │ │               │   │   [ 45,  27,  20],      │ │
                             │ │               │   │   ...,                  │ │
                             │ │               │   │   [ 11,  11,   5],      │ │
                             │ │               │   │   [ 11,  11,   5],      │ │
                             │ │               │   │   [ 11,  11,   5]],     │ │
                             │ │               │                             │ │
                             │ │               │      [[ 47,  29,  22],      │ │
                             │ │               │   │   [ 47,  29,  22],      │ │
                             │ │               │   │   [ 47,  29,  22],      │ │
                             │ │               │   │   ...,                  │ │
                             │ │               │   │   [ 10,  10,   4],      │ │
                             │ │               │   │   [ 10,  10,   4],      │ │
                             │ │               │   │   [ 10,  10,   4]],     │ │
                             │ │               │                             │ │
                             │ │               │      [[ 46,  28,  21],      │ │
                             │ │               │   │   [ 46,  28,  21],      │ │
                             │ │               │   │   [ 46,  28,  21],      │ │
                             │ │               │   │   ...,                  │ │
                             │ │               │   │   [  9,   9,   3],      │ │
                             │ │               │   │   [  9,   9,   3],      │ │
                             │ │               │   │   [  9,   9,   3]]],    │ │
                             │ │               dtype=uint8)                  │ │
                             │ │        self = <insightface.model_zoo.retin… │ │
                             │ │               object at 0x7fe1f2e9bc10>     │ │
                             │ ╰─────────────────────────────────────────────╯ │
                             │                                                 │
                             │ /opt/venv/lib/python3.10/site-packages/insightf │
                             │ ace/model_zoo/retinaface.py:152 in forward      │
                             │                                                 │
                             │   149 │   │   kpss_list = []                    │
                             │   150 │   │   input_size = tuple(img.shape[0:2] │
                             │   151 │   │   blob = cv2.dnn.blobFromImage(img, │
                             │       (self.input_mean, self.input_mean, self.i │
                             │ ❱ 152 │   │   net_outs = self.session.run(self. │
                             │   153 │   │                                     │
                             │   154 │   │   input_height = blob.shape[2]      │
                             │   155 │   │   input_width = blob.shape[3]       │
                             │                                                 │
                             │ ╭────────────────── locals ───────────────────╮ │
                             │ │ bboxes_list = []                            │ │
                             │ │        blob = array([[[[-0.18359375,        │ │
                             │ │               -0.18359375, -0.18359375,     │ │
                             │ │               ..., -0.99609375,             │ │
                             │ │               │   │     -0.99609375,        │ │
                             │ │               -0.99609375],                 │ │
                             │ │               │   │    [-0.17578125,        │ │
                             │ │               -0.17578125, -0.17578125,     │ │
                             │ │               ..., -0.99609375,             │ │
                             │ │               │   │     -0.99609375,        │ │
                             │ │               -0.99609375],                 │ │
                             │ │               │   │    [-0.17578125,        │ │
                             │ │               -0.17578125, -0.17578125,     │ │
                             │ │               ..., -0.99609375,             │ │
                             │ │               │   │     -0.99609375,        │ │
                             │ │               -0.99609375],                 │ │
                             │ │               │   │    ...,                 │ │
                             │ │               │   │    [-0.83984375,        │ │
                             │ │               -0.83984375, -0.83984375,     │ │
                             │ │               ..., -0.99609375,             │ │
                             │ │               │   │     -0.99609375,        │ │
                             │ │               -0.99609375],                 │ │
                             │ │               │   │    [-0.82421875,        │ │
                             │ │               -0.82421875, -0.82421875,     │ │
                             │ │               ..., -0.99609375,             │ │
                             │ │               │   │     -0.99609375,        │ │
                             │ │               -0.99609375],                 │ │
                             │ │               │   │    [-0.83203125,        │ │
                             │ │               -0.83203125, -0.83203125,     │ │
                             │ │               ..., -0.99609375,             │ │
                             │ │               │   │     -0.99609375,        │ │
                             │ │               -0.99609375]],                │ │
                             │ │               │   │                         │ │
                             │ │               │   │   [[ 0.09765625,        │ │
                             │ │               0.09765625,  0.09765625, ..., │ │
                             │ │               -0.99609375,                  │ │
                             │ │               │   │     -0.99609375,        │ │
                             │ │               -0.99609375],                 │ │
                             │ │               │   │    [ 0.10546875,        │ │
                             │ │               0.10546875,  0.10546875, ..., │ │
                             │ │               -0.99609375,                  │ │
                             │ │               │   │     -0.99609375,        │ │
                             │ │               -0.99609375],                 │ │
                             │ │               │   │    [ 0.10546875,        │ │
                             │ │               0.10546875,  0.10546875, ..., │ │
                             │ │               -0.99609375,                  │ │
                             │ │               │   │     -0.99609375,        │ │
                             │ │               -0.99609375],                 │ │
                             │ │               │   │    ...,                 │ │
                             │ │               │   │    [-0.78515625,        │ │
                             │ │               -0.78515625, -0.78515625,     │ │
                             │ │               ..., -0.99609375,             │ │
                             │ │               │   │     -0.99609375,        │ │
                             │ │               -0.99609375],                 │ │
                             │ │               │   │    [-0.76953125,        │ │
                             │ │               -0.76953125, -0.76953125,     │ │
                             │ │               ..., -0.99609375,             │ │
                             │ │               │   │     -0.99609375,        │ │
                             │ │               -0.99609375],                 │ │
                             │ │               │   │    [-0.77734375,        │ │
                             │ │               -0.77734375, -0.77734375,     │ │
                             │ │               ..., -0.99609375,             │ │
                             │ │               │   │     -0.99609375,        │ │
                             │ │               -0.99609375]],                │ │
                             │ │               │   │                         │ │
                             │ │               │   │   [[ 0.69140625,        │ │
                             │ │               0.69140625,  0.69140625, ..., │ │
                             │ │               -0.99609375,                  │ │
                             │ │               │   │     -0.99609375,        │ │
                             │ │               -0.99609375],                 │ │
                             │ │               │   │    [ 0.69921875,        │ │
                             │ │               0.69921875,  0.69921875, ..., │ │
                             │ │               -0.99609375,                  │ │
                             │ │               │   │     -0.99609375,        │ │
                             │ │               -0.99609375],                 │ │
                             │ │               │   │    [ 0.69921875,        │ │
                             │ │               0.69921875,  0.69921875, ..., │ │
                             │ │               -0.99609375,                  │ │
                             │ │               │   │     -0.99609375,        │ │
                             │ │               -0.99609375],                 │ │
                             │ │               │   │    ...,                 │ │
                             │ │               │   │    [-0.64453125,        │ │
                             │ │               -0.64453125, -0.64453125,     │ │
                             │ │               ..., -0.99609375,             │ │
                             │ │               │   │     -0.99609375,        │ │
                             │ │               -0.99609375],                 │ │
                             │ │               │   │    [-0.62890625,        │ │
                             │ │               -0.62890625, -0.62890625,     │ │
                             │ │               ..., -0.99609375,             │ │
                             │ │               │   │     -0.99609375,        │ │
                             │ │               -0.99609375],                 │ │
                             │ │               │   │    [-0.63671875,        │ │
                             │ │               -0.63671875, -0.63671875,     │ │
                             │ │               ..., -0.99609375,             │ │
                             │ │               │   │     -0.99609375,        │ │
                             │ │               -0.99609375]]]],              │ │
                             │ │               dtype=float32)                │ │
                             │ │         img = array([[[216, 140, 104],      │ │
                             │ │               │   │   [216, 140, 104],      │ │
                             │ │               │   │   [216, 140, 104],      │ │
                             │ │               │   │   ...,                  │ │
                             │ │               │   │   [  0,   0,   0],      │ │
                             │ │               │   │   [  0,   0,   0],      │ │
                             │ │               │   │   [  0,   0,   0]],     │ │
                             │ │               │                             │ │
                             │ │               │      [[217, 141, 105],      │ │
                             │ │               │   │   [217, 141, 105],      │ │
                             │ │               │   │   [217, 141, 105],      │ │
                             │ │               │   │   ...,                  │ │
                             │ │               │   │   [  0,   0,   0],      │ │
                             │ │               │   │   [  0,   0,   0],      │ │
                             │ │               │   │   [  0,   0,   0]],     │ │
                             │ │               │                             │ │
                             │ │               │      [[217, 141, 105],      │ │
                             │ │               │   │   [217, 141, 105],      │ │
                             │ │               │   │   [217, 141, 105],      │ │
                             │ │               │   │   ...,                  │ │
                             │ │               │   │   [  0,   0,   0],      │ │
                             │ │               │   │   [  0,   0,   0],      │ │
                             │ │               │   │   [  0,   0,   0]],     │ │
                             │ │               │                             │ │
                             │ │               │      ...,                   │ │
                             │ │               │                             │ │
                             │ │               │      [[ 45,  27,  20],      │ │
                             │ │               │   │   [ 45,  27,  20],      │ │
                             │ │               │   │   [ 45,  27,  20],      │ │
                             │ │               │   │   ...,                  │ │
                             │ │               │   │   [  0,   0,   0],      │ │
                             │ │               │   │   [  0,   0,   0],      │ │
                             │ │               │   │   [  0,   0,   0]],     │ │
                             │ │               │                             │ │
                             │ │               │      [[ 47,  29,  22],      │ │
                             │ │               │   │   [ 47,  29,  22],      │ │
                             │ │               │   │   [ 47,  29,  22],      │ │
                             │ │               │   │   ...,                  │ │
                             │ │               │   │   [  0,   0,   0],      │ │
                             │ │               │   │   [  0,   0,   0],      │ │
                             │ │               │   │   [  0,   0,   0]],     │ │
                             │ │               │                             │ │
                             │ │               │      [[ 46,  28,  21],      │ │
                             │ │               │   │   [ 46,  28,  21],      │ │
                             │ │               │   │   [ 46,  28,  21],      │ │
                             │ │               │   │   ...,                  │ │
                             │ │               │   │   [  0,   0,   0],      │ │
                             │ │               │   │   [  0,   0,   0],      │ │
                             │ │               │   │   [  0,   0,   0]]],    │ │
                             │ │               dtype=uint8)                  │ │
                             │ │  input_size = (640, 640)                    │ │
                             │ │   kpss_list = []                            │ │
                             │ │ scores_list = []                            │ │
                             │ │        self = <insightface.model_zoo.retin… │ │
                             │ │               object at 0x7fe1f2e9bc10>     │ │
                             │ │   threshold = 0.7                           │ │
                             │ ╰─────────────────────────────────────────────╯ │
                             │                                                 │
                             │ /opt/venv/lib/python3.10/site-packages/onnxrunt │
                             │ ime/capi/onnxruntime_inference_collection.py:22 │
                             │ 0 in run                                        │
                             │                                                 │
                             │    217 │   │   if not output_names:             │
                             │    218 │   │   │   output_names = [output.name  │
                             │    219 │   │   try:                             │
                             │ ❱  220 │   │   │   return self._sess.run(output │
                             │    221 │   │   except C.EPFail as err:          │
                             │    222 │   │   │   if self._enable_fallback:    │
                             │    223 │   │   │   │   print(f"EP Error: {err!s │
                             │                                                 │
                             │ ╭────────────────── locals ───────────────────╮ │
                             │ │   input_feed = {                            │ │
                             │ │                │   'input.1':               │ │
                             │ │                array([[[[-0.18359375,       │ │
                             │ │                -0.18359375, -0.18359375,    │ │
                             │ │                ..., -0.99609375,            │ │
                             │ │                │   │     -0.99609375,       │ │
                             │ │                -0.99609375],                │ │
                             │ │                │   │    [-0.17578125,       │ │
                             │ │                -0.17578125, -0.17578125,    │ │
                             │ │                ..., -0.99609375,            │ │
                             │ │                │   │     -0.99609375,       │ │
                             │ │                -0.99609375],                │ │
                             │ │                │   │    [-0.17578125,       │ │
                             │ │                -0.17578125, -0.17578125,    │ │
                             │ │                ..., -0.99609375,            │ │
                             │ │                │   │     -0.99609375,       │ │
                             │ │                -0.99609375],                │ │
                             │ │                │   │    ...,                │ │
                             │ │                │   │    [-0.83984375,       │ │
                             │ │                -0.83984375, -0.83984375,    │ │
                             │ │                ..., -0.99609375,            │ │
                             │ │                │   │     -0.99609375,       │ │
                             │ │                -0.99609375],                │ │
                             │ │                │   │    [-0.82421875,       │ │
                             │ │                -0.82421875, -0.82421875,    │ │
                             │ │                ..., -0.99609375,            │ │
                             │ │                │   │     -0.99609375,       │ │
                             │ │                -0.99609375],                │ │
                             │ │                │   │    [-0.83203125,       │ │
                             │ │                -0.83203125, -0.83203125,    │ │
                             │ │                ..., -0.99609375,            │ │
                             │ │                │   │     -0.99609375,       │ │
                             │ │                -0.99609375]],               │ │
                             │ │                │   │                        │ │
                             │ │                │   │   [[ 0.09765625,       │ │
                             │ │                0.09765625,  0.09765625,     │ │
                             │ │                ..., -0.99609375,            │ │
                             │ │                │   │     -0.99609375,       │ │
                             │ │                -0.99609375],                │ │
                             │ │                │   │    [ 0.10546875,       │ │
                             │ │                0.10546875,  0.10546875,     │ │
                             │ │                ..., -0.99609375,            │ │
                             │ │                │   │     -0.99609375,       │ │
                             │ │                -0.99609375],                │ │
                             │ │                │   │    [ 0.10546875,       │ │
                             │ │                0.10546875,  0.10546875,     │ │
                             │ │                ..., -0.99609375,            │ │
                             │ │                │   │     -0.99609375,       │ │
                             │ │                -0.99609375],                │ │
                             │ │                │   │    ...,                │ │
                             │ │                │   │    [-0.78515625,       │ │
                             │ │                -0.78515625, -0.78515625,    │ │
                             │ │                ..., -0.99609375,            │ │
                             │ │                │   │     -0.99609375,       │ │
                             │ │                -0.99609375],                │ │
                             │ │                │   │    [-0.76953125,       │ │
                             │ │                -0.76953125, -0.76953125,    │ │
                             │ │                ..., -0.99609375,            │ │
                             │ │                │   │     -0.99609375,       │ │
                             │ │                -0.99609375],                │ │
                             │ │                │   │    [-0.77734375,       │ │
                             │ │                -0.77734375, -0.77734375,    │ │
                             │ │                ..., -0.99609375,            │ │
                             │ │                │   │     -0.99609375,       │ │
                             │ │                -0.99609375]],               │ │
                             │ │                │   │                        │ │
                             │ │                │   │   [[ 0.69140625,       │ │
                             │ │                0.69140625,  0.69140625,     │ │
                             │ │                ..., -0.99609375,            │ │
                             │ │                │   │     -0.99609375,       │ │
                             │ │                -0.99609375],                │ │
                             │ │                │   │    [ 0.69921875,       │ │
                             │ │                0.69921875,  0.69921875,     │ │
                             │ │                ..., -0.99609375,            │ │
                             │ │                │   │     -0.99609375,       │ │
                             │ │                -0.99609375],                │ │
                             │ │                │   │    [ 0.69921875,       │ │
                             │ │                0.69921875,  0.69921875,     │ │
                             │ │                ..., -0.99609375,            │ │
                             │ │                │   │     -0.99609375,       │ │
                             │ │                -0.99609375],                │ │
                             │ │                │   │    ...,                │ │
                             │ │                │   │    [-0.64453125,       │ │
                             │ │                -0.64453125, -0.64453125,    │ │
                             │ │                ..., -0.99609375,            │ │
                             │ │                │   │     -0.99609375,       │ │
                             │ │                -0.99609375],                │ │
                             │ │                │   │    [-0.62890625,       │ │
                             │ │                -0.62890625, -0.62890625,    │ │
                             │ │                ..., -0.99609375,            │ │
                             │ │                │   │     -0.99609375,       │ │
                             │ │                -0.99609375],                │ │
                             │ │                │   │    [-0.63671875,       │ │
                             │ │                -0.63671875, -0.63671875,    │ │
                             │ │                ..., -0.99609375,            │ │
                             │ │                │   │     -0.99609375,       │ │
                             │ │                -0.99609375]]]],             │ │
                             │ │                dtype=float32)               │ │
                             │ │                }                            │ │
                             │ │ output_names = [                            │ │
                             │ │                │   '448',                   │ │
                             │ │                │   '471',                   │ │
                             │ │                │   '494',                   │ │
                             │ │                │   '451',                   │ │
                             │ │                │   '474',                   │ │
                             │ │                │   '497',                   │ │
                             │ │                │   '454',                   │ │
                             │ │                │   '477',                   │ │
                             │ │                │   '500'                    │ │
                             │ │                ]                            │ │
                             │ │  run_options = None                         │ │
                             │ │         self = <onnxruntime.capi.onnxrunti… │ │
                             │ │                object at 0x7fe1f2e9b700>    │ │
                             │ ╰─────────────────────────────────────────────╯ │
                             ╰─────────────────────────────────────────────────╯
                             RuntimeException: [ONNXRuntimeError] : 6 :
                             RUNTIME_EXCEPTION : Encountered unknown exception
                             in Run()

Hope this helps!

@LeoAdL
Copy link
Author

LeoAdL commented Mar 24, 2024

Here are my logs, I think very similar:

immich_machine_learning  | [03/24/24 16:17:42] DEBUG    Available ORT providers:                           
immich_machine_learning  |                              {'OpenVINOExecutionProvider',                      
immich_machine_learning  |                              'CPUExecutionProvider'}                            
immich_machine_learning  | [03/24/24 16:17:42] DEBUG    Available OpenVINO devices: ['CPU', 'GPU']         
immich_machine_learning  | [03/24/24 16:17:42] INFO     Setting 'buffalo_l' execution providers to         
immich_machine_learning  |                              ['OpenVINOExecutionProvider',                      
immich_machine_learning  |                              'CPUExecutionProvider'], in descending order of    
immich_machine_learning  |                              preference                                         
immich_machine_learning  | [03/24/24 16:17:42] DEBUG    Setting execution provider options to              
immich_machine_learning  |                              [{'device_type': 'GPU_FP32', 'cache_dir':          
immich_machine_learning  |                              '/cache/facial-recognition/buffalo_l/openvino'},   
immich_machine_learning  |                              {'arena_extend_strategy': 'kSameAsRequested'}]     
immich_machine_learning  | [03/24/24 16:17:42] DEBUG    Setting execution_mode to ORT_SEQUENTIAL           
immich_machine_learning  | [03/24/24 16:17:42] DEBUG    Setting inter_op_num_threads to 0                  
immich_machine_learning  | [03/24/24 16:17:42] DEBUG    Setting intra_op_num_threads to 0                  
immich_machine_learning  | [03/24/24 16:17:42] DEBUG    Setting preferred runtime to onnx                  
immich_machine_learning  | [03/24/24 16:17:42] INFO     Loading facial recognition model 'buffalo_l' to    
immich_machine_learning  |                              memory                                             
immich_machine_learning  | In the OpenVINO EP
immich_machine_learning  | Model is fully supported on OpenVINO
immich_machine_learning  | CreateNgraphFunc
immich_machine_learning  | In the OpenVINO EP
immich_machine_learning  | Model is fully supported on OpenVINO
immich_machine_learning  | CreateNgraphFunc
immich_machine_learning  | [03/24/24 16:17:44] ERROR    Exception in ASGI application                      
immich_machine_learning  |                                                                                 
immich_machine_learning  |                              ╭─────── Traceback (most recent call last) ───────╮
immich_machine_learning  |                              │ /usr/src/app/main.py:118 in predict             │
immich_machine_learning  |                              │                                                 │
immich_machine_learning  |                              │   115 │                                         │
immich_machine_learning  |                              │   116 │   model = await load(await model_cache. │
immich_machine_learning  |                              │       ttl=settings.model_ttl, **kwargs))        │
immich_machine_learning  |                              │   117 │   model.configure(**kwargs)             │
immich_machine_learning  |                              │ ❱ 118 │   outputs = await run(model.predict, in │
immich_machine_learning  |                              │   119 │   return ORJSONResponse(outputs)        │
immich_machine_learning  |                              │   120                                           │
immich_machine_learning  |                              │   121                                           │
immich_machine_learning  |                              │                                                 │
immich_machine_learning  |                              │ ╭────────────────── locals ───────────────────╮ │
immich_machine_learning  |                              │ │      image = UploadFile(filename='blob',    │ │
immich_machine_learning  |                              │ │              size=591599,                   │ │
immich_machine_learning  |                              │ │              headers=Headers({'content-dis… │ │
immich_machine_learning  |                              │ │              'form-data; name="image";      │ │
immich_machine_learning  |                              │ │              filename="blob"',              │ │
immich_machine_learning  |                              │ │              'content-type':                │ │
immich_machine_learning  |                              │ │              'application/octet-stream'}))  │ │
immich_machine_learning  |                              │ │     inputs = b'\xff\xd8\xff\xe2\x01\xf0ICC… │ │
immich_machine_learning  |                              │ │              \x00\x00mntrRGB XYZ            │ │
immich_machine_learning  |                              │ │              \x07\xe2\x00\x03\x00\x14\x00\… │ │
immich_machine_learning  |                              │ │     kwargs = {                              │ │
immich_machine_learning  |                              │ │              │   'minScore': 0.7,           │ │
immich_machine_learning  |                              │ │              │   'maxDistance': 0.5,        │ │
immich_machine_learning  |                              │ │              │   'minFaces': 3              │ │
immich_machine_learning  |                              │ │              }                              │ │
immich_machine_learning  |                              │ │      model = <app.models.facial_recognitio… │ │
immich_machine_learning  |                              │ │              object at 0x7ab23c362fe0>      │ │
immich_machine_learning  |                              │ │ model_name = 'buffalo_l'                    │ │
immich_machine_learning  |                              │ │ model_type = <ModelType.FACIAL_RECOGNITION: │ │
immich_machine_learning  |                              │ │              'facial-recognition'>          │ │
immich_machine_learning  |                              │ │    options = '{"minScore":0.7,"maxDistance… │ │
immich_machine_learning  |                              │ │       text = None                           │ │
immich_machine_learning  |                              │ ╰─────────────────────────────────────────────╯ │
immich_machine_learning  |                              │                                                 │
immich_machine_learning  |                              │ /usr/src/app/main.py:125 in run                 │
immich_machine_learning  |                              │                                                 │
immich_machine_learning  |                              │   122 async def run(func: Callable[..., Any], i │
immich_machine_learning  |                              │   123 │   if thread_pool is None:               │
immich_machine_learning  |                              │   124 │   │   return func(inputs)               │
immich_machine_learning  |                              │ ❱ 125 │   return await asyncio.get_running_loop │
immich_machine_learning  |                              │   126                                           │
immich_machine_learning  |                              │   127                                           │
immich_machine_learning  |                              │   128 async def load(model: InferenceModel) ->  │
immich_machine_learning  |                              │                                                 │
immich_machine_learning  |                              │ ╭────────────────── locals ───────────────────╮ │
immich_machine_learning  |                              │ │   func = <bound method                      │ │
immich_machine_learning  |                              │ │          InferenceModel.predict of          │ │
immich_machine_learning  |                              │ │          <app.models.facial_recognition.Fa… │ │
immich_machine_learning  |                              │ │          object at 0x7ab23c362fe0>>         │ │
immich_machine_learning  |                              │ │ inputs = b'\xff\xd8\xff\xe2\x01\xf0ICC_PRO… │ │
immich_machine_learning  |                              │ │          \x00\x00mntrRGB XYZ                │ │
immich_machine_learning  |                              │ │          \x07\xe2\x00\x03\x00\x14\x00\t\x0… │ │
immich_machine_learning  |                              │ ╰─────────────────────────────────────────────╯ │
immich_machine_learning  |                              │                                                 │
immich_machine_learning  |                              │ /usr/lib/python3.10/concurrent/futures/thread.p │
immich_machine_learning  |                              │ y:58 in run                                     │
immich_machine_learning  |                              │                                                 │
immich_machine_learning  |                              │ /usr/src/app/models/base.py:59 in predict       │
immich_machine_learning  |                              │                                                 │
immich_machine_learning  |                              │    56 │   │   self.load()                       │
immich_machine_learning  |                              │    57 │   │   if model_kwargs:                  │
immich_machine_learning  |                              │    58 │   │   │   self.configure(**model_kwargs │
immich_machine_learning  |                              │ ❱  59 │   │   return self._predict(inputs)      │
immich_machine_learning  |                              │    60 │                                         │
immich_machine_learning  |                              │    61 │   @abstractmethod                       │
immich_machine_learning  |                              │    62 │   def _predict(self, inputs: Any) -> An │
immich_machine_learning  |                              │                                                 │
immich_machine_learning  |                              │ ╭────────────────── locals ───────────────────╮ │
immich_machine_learning  |                              │ │       inputs = b'\xff\xd8\xff\xe2\x01\xf0I… │ │
immich_machine_learning  |                              │ │                \x00\x00mntrRGB XYZ          │ │
immich_machine_learning  |                              │ │                \x07\xe2\x00\x03\x00\x14\x0… │ │
immich_machine_learning  |                              │ │ model_kwargs = {}                           │ │
immich_machine_learning  |                              │ │         self = <app.models.facial_recognit… │ │
immich_machine_learning  |                              │ │                object at 0x7ab23c362fe0>    │ │
immich_machine_learning  |                              │ ╰─────────────────────────────────────────────╯ │
immich_machine_learning  |                              │                                                 │
immich_machine_learning  |                              │ /usr/src/app/models/facial_recognition.py:49 in │
immich_machine_learning  |                              │ _predict                                        │
immich_machine_learning  |                              │                                                 │
immich_machine_learning  |                              │   46 │   │   else:                              │
immich_machine_learning  |                              │   47 │   │   │   decoded_image = image          │
immich_machine_learning  |                              │   48 │   │   assert is_ndarray(decoded_image, n │
immich_machine_learning  |                              │ ❱ 49 │   │   bboxes, kpss = self.det_model.dete │
immich_machine_learning  |                              │   50 │   │   if bboxes.size == 0:               │
immich_machine_learning  |                              │   51 │   │   │   return []                      │
immich_machine_learning  |                              │   52 │   │   assert is_ndarray(kpss, np.float32 │
immich_machine_learning  |                              │                                                 │
immich_machine_learning  |                              │ ╭────────────────── locals ───────────────────╮ │
immich_machine_learning  |                              │ │ decoded_image = array([[[  0,  17,  34],    │ │
immich_machine_learning  |                              │ │                 │   │   [  0,  17,  34],    │ │
immich_machine_learning  |                              │ │                 │   │   [  0,  18,  35],    │ │
immich_machine_learning  |                              │ │                 │   │   ...,                │ │
immich_machine_learning  |                              │ │                 │   │   [  8,   7,   9],    │ │
immich_machine_learning  |                              │ │                 │   │   [ 14,  13,  15],    │ │
immich_machine_learning  |                              │ │                 │   │   [ 19,  18,  20]],   │ │
immich_machine_learning  |                              │ │                 │                           │ │
immich_machine_learning  |                              │ │                 │      [[  0,  19,  36],    │ │
immich_machine_learning  |                              │ │                 │   │   [  1,  19,  36],    │ │
immich_machine_learning  |                              │ │                 │   │   [  2,  20,  37],    │ │
immich_machine_learning  |                              │ │                 │   │   ...,                │ │
immich_machine_learning  |                              │ │                 │   │   [  7,   6,   8],    │ │
immich_machine_learning  |                              │ │                 │   │   [ 14,  13,  15],    │ │
immich_machine_learning  |                              │ │                 │   │   [ 20,  19,  21]],   │ │
immich_machine_learning  |                              │ │                 │                           │ │
immich_machine_learning  |                              │ │                 │      [[  2,  22,  39],    │ │
immich_machine_learning  |                              │ │                 │   │   [  4,  22,  39],    │ │
immich_machine_learning  |                              │ │                 │   │   [  4,  22,  39],    │ │
immich_machine_learning  |                              │ │                 │   │   ...,                │ │
immich_machine_learning  |                              │ │                 │   │   [  5,   4,   6],    │ │
immich_machine_learning  |                              │ │                 │   │   [ 14,  13,  15],    │ │
immich_machine_learning  |                              │ │                 │   │   [ 22,  21,  23]],   │ │
immich_machine_learning  |                              │ │                 │                           │ │
immich_machine_learning  |                              │ │                 │      ...,                 │ │
immich_machine_learning  |                              │ │                 │                           │ │
immich_machine_learning  |                              │ │                 │      [[ 32,  56,  86],    │ │
immich_machine_learning  |                              │ │                 │   │   [ 36,  60,  90],    │ │
immich_machine_learning  |                              │ │                 │   │   [ 42,  66,  96],    │ │
immich_machine_learning  |                              │ │                 │   │   ...,                │ │
immich_machine_learning  |                              │ │                 │   │   [ 28,  54,  71],    │ │
immich_machine_learning  |                              │ │                 │   │   [ 31,  57,  74],    │ │
immich_machine_learning  |                              │ │                 │   │   [ 36,  62,  79]],   │ │
immich_machine_learning  |                              │ │                 │                           │ │
immich_machine_learning  |                              │ │                 │      [[ 37,  59,  87],    │ │
immich_machine_learning  |                              │ │                 │   │   [ 43,  65,  93],    │ │
immich_machine_learning  |                              │ │                 │   │   [ 53,  75, 103],    │ │
immich_machine_learning  |                              │ │                 │   │   ...,                │ │
immich_machine_learning  |                              │ │                 │   │   [ 27,  53,  70],    │ │
immich_machine_learning  |                              │ │                 │   │   [ 28,  54,  71],    │ │
immich_machine_learning  |                              │ │                 │   │   [ 32,  58,  75]],   │ │
immich_machine_learning  |                              │ │                 │                           │ │
immich_machine_learning  |                              │ │                 │      [[ 44,  66,  94],    │ │
immich_machine_learning  |                              │ │                 │   │   [ 50,  72, 100],    │ │
immich_machine_learning  |                              │ │                 │   │   [ 61,  83, 111],    │ │
immich_machine_learning  |                              │ │                 │   │   ...,                │ │
immich_machine_learning  |                              │ │                 │   │   [ 27,  53,  70],    │ │
immich_machine_learning  |                              │ │                 │   │   [ 25,  51,  68],    │ │
immich_machine_learning  |                              │ │                 │   │   [ 27,  53,  70]]],  │ │
immich_machine_learning  |                              │ │                 dtype=uint8)                │ │
immich_machine_learning  |                              │ │         image = b'\xff\xd8\xff\xe2\x01\xf0… │ │
immich_machine_learning  |                              │ │                 \x00\x00mntrRGB XYZ         │ │
immich_machine_learning  |                              │ │                 \x07\xe2\x00\x03\x00\x14\x… │ │
immich_machine_learning  |                              │ │          self = <app.models.facial_recogni… │ │
immich_machine_learning  |                              │ │                 object at 0x7ab23c362fe0>   │ │
immich_machine_learning  |                              │ ╰─────────────────────────────────────────────╯ │
immich_machine_learning  |                              │                                                 │
immich_machine_learning  |                              │ /opt/venv/lib/python3.10/site-packages/insightf │
immich_machine_learning  |                              │ ace/model_zoo/retinaface.py:224 in detect       │
immich_machine_learning  |                              │                                                 │
immich_machine_learning  |                              │   221 │   │   det_img = np.zeros( (input_size[1 │
immich_machine_learning  |                              │   222 │   │   det_img[:new_height, :new_width,  │
immich_machine_learning  |                              │   223 │   │                                     │
immich_machine_learning  |                              │ ❱ 224 │   │   scores_list, bboxes_list, kpss_li │
immich_machine_learning  |                              │   225 │   │                                     │
immich_machine_learning  |                              │   226 │   │   scores = np.vstack(scores_list)   │
immich_machine_learning  |                              │   227 │   │   scores_ravel = scores.ravel()     │
immich_machine_learning  |                              │                                                 │
immich_machine_learning  |                              │ ╭────────────────── locals ───────────────────╮ │
immich_machine_learning  |                              │ │     det_img = array([[[  1,  19,  36],      │ │
immich_machine_learning  |                              │ │               │   │   [  3,  19,  36],      │ │
immich_machine_learning  |                              │ │               │   │   [  0,  13,  31],      │ │
immich_machine_learning  |                              │ │               │   │   ...,                  │ │
immich_machine_learning  |                              │ │               │   │   [  0,   0,   0],      │ │
immich_machine_learning  |                              │ │               │   │   [  0,   0,   0],      │ │
immich_machine_learning  |                              │ │               │   │   [  0,   0,   0]],     │ │
immich_machine_learning  |                              │ │               │                             │ │
immich_machine_learning  |                              │ │               │      [[  6,  24,  41],      │ │
immich_machine_learning  |                              │ │               │   │   [  6,  22,  39],      │ │
immich_machine_learning  |                              │ │               │   │   [  1,  15,  33],      │ │
immich_machine_learning  |                              │ │               │   │   ...,                  │ │
immich_machine_learning  |                              │ │               │   │   [  0,   0,   0],      │ │
immich_machine_learning  |                              │ │               │   │   [  0,   0,   0],      │ │
immich_machine_learning  |                              │ │               │   │   [  0,   0,   0]],     │ │
immich_machine_learning  |                              │ │               │                             │ │
immich_machine_learning  |                              │ │               │      [[  1,  19,  36],      │ │
immich_machine_learning  |                              │ │               │   │   [  3,  19,  36],      │ │
immich_machine_learning  |                              │ │               │   │   [  0,  14,  32],      │ │
immich_machine_learning  |                              │ │               │   │   ...,                  │ │
immich_machine_learning  |                              │ │               │   │   [  0,   0,   0],      │ │
immich_machine_learning  |                              │ │               │   │   [  0,   0,   0],      │ │
immich_machine_learning  |                              │ │               │   │   [  0,   0,   0]],     │ │
immich_machine_learning  |                              │ │               │                             │ │
immich_machine_learning  |                              │ │               │      ...,                   │ │
immich_machine_learning  |                              │ │               │                             │ │
immich_machine_learning  |                              │ │               │      [[ 40,  67, 101],      │ │
immich_machine_learning  |                              │ │               │   │   [ 28,  55,  89],      │ │
immich_machine_learning  |                              │ │               │   │   [ 33,  60,  94],      │ │
immich_machine_learning  |                              │ │               │   │   ...,                  │ │
immich_machine_learning  |                              │ │               │   │   [  0,   0,   0],      │ │
immich_machine_learning  |                              │ │               │   │   [  0,   0,   0],      │ │
immich_machine_learning  |                              │ │               │   │   [  0,   0,   0]],     │ │
immich_machine_learning  |                              │ │               │                             │ │
immich_machine_learning  |                              │ │               │      [[ 35,  60,  92],      │ │
immich_machine_learning  |                              │ │               │   │   [ 33,  58,  90],      │ │
immich_machine_learning  |                              │ │               │   │   [ 43,  68, 100],      │ │
immich_machine_learning  |                              │ │               │   │   ...,                  │ │
immich_machine_learning  |                              │ │               │   │   [  0,   0,   0],      │ │
immich_machine_learning  |                              │ │               │   │   [  0,   0,   0],      │ │
immich_machine_learning  |                              │ │               │   │   [  0,   0,   0]],     │ │
immich_machine_learning  |                              │ │               │                             │ │
immich_machine_learning  |                              │ │               │      [[ 43,  65,  93],      │ │
immich_machine_learning  |                              │ │               │   │   [ 69,  91, 119],      │ │
immich_machine_learning  |                              │ │               │   │   [ 64,  86, 114],      │ │
immich_machine_learning  |                              │ │               │   │   ...,                  │ │
immich_machine_learning  |                              │ │               │   │   [  0,   0,   0],      │ │
immich_machine_learning  |                              │ │               │   │   [  0,   0,   0],      │ │
immich_machine_learning  |                              │ │               │   │   [  0,   0,   0]]],    │ │
immich_machine_learning  |                              │ │               dtype=uint8)                  │ │
immich_machine_learning  |                              │ │   det_scale = 0.3333333333333333            │ │
immich_machine_learning  |                              │ │    im_ratio = 1.3333333333333333            │ │
immich_machine_learning  |                              │ │         img = array([[[  0,  17,  34],      │ │
immich_machine_learning  |                              │ │               │   │   [  0,  17,  34],      │ │
immich_machine_learning  |                              │ │               │   │   [  0,  18,  35],      │ │
immich_machine_learning  |                              │ │               │   │   ...,                  │ │
immich_machine_learning  |                              │ │               │   │   [  8,   7,   9],      │ │
immich_machine_learning  |                              │ │               │   │   [ 14,  13,  15],      │ │
immich_machine_learning  |                              │ │               │   │   [ 19,  18,  20]],     │ │
immich_machine_learning  |                              │ │               │                             │ │
immich_machine_learning  |                              │ │               │      [[  0,  19,  36],      │ │
immich_machine_learning  |                              │ │               │   │   [  1,  19,  36],      │ │
immich_machine_learning  |                              │ │               │   │   [  2,  20,  37],      │ │
immich_machine_learning  |                              │ │               │   │   ...,                  │ │
immich_machine_learning  |                              │ │               │   │   [  7,   6,   8],      │ │
immich_machine_learning  |                              │ │               │   │   [ 14,  13,  15],      │ │
immich_machine_learning  |                              │ │               │   │   [ 20,  19,  21]],     │ │
immich_machine_learning  |                              │ │               │                             │ │
immich_machine_learning  |                              │ │               │      [[  2,  22,  39],      │ │
immich_machine_learning  |                              │ │               │   │   [  4,  22,  39],      │ │
immich_machine_learning  |                              │ │               │   │   [  4,  22,  39],      │ │
immich_machine_learning  |                              │ │               │   │   ...,                  │ │
immich_machine_learning  |                              │ │               │   │   [  5,   4,   6],      │ │
immich_machine_learning  |                              │ │               │   │   [ 14,  13,  15],      │ │
immich_machine_learning  |                              │ │               │   │   [ 22,  21,  23]],     │ │
immich_machine_learning  |                              │ │               │                             │ │
immich_machine_learning  |                              │ │               │      ...,                   │ │
immich_machine_learning  |                              │ │               │                             │ │
immich_machine_learning  |                              │ │               │      [[ 32,  56,  86],      │ │
immich_machine_learning  |                              │ │               │   │   [ 36,  60,  90],      │ │
immich_machine_learning  |                              │ │               │   │   [ 42,  66,  96],      │ │
immich_machine_learning  |                              │ │               │   │   ...,                  │ │
immich_machine_learning  |                              │ │               │   │   [ 28,  54,  71],      │ │
immich_machine_learning  |                              │ │               │   │   [ 31,  57,  74],      │ │
immich_machine_learning  |                              │ │               │   │   [ 36,  62,  79]],     │ │
immich_machine_learning  |                              │ │               │                             │ │
immich_machine_learning  |                              │ │               │      [[ 37,  59,  87],      │ │
immich_machine_learning  |                              │ │               │   │   [ 43,  65,  93],      │ │
immich_microservices     | [Nest] 7  - 03/24/2024, 4:17:44 PM   ERROR [JobService] Unable to run job handler (faceDetection/face-detection): Error: Machine learning request for facial recognition failed with status 500: Internal Server Error
immich_microservices     | [Nest] 7  - 03/24/2024, 4:17:44 PM   ERROR [JobService] Error: Machine learning request for facial recognition failed with status 500: Internal Server Error
immich_microservices     |     at MachineLearningRepository.predict (/usr/src/app/dist/infra/repositories/machine-learning.repository.js:23:19)
immich_microservices     |     at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
immich_microservices     |     at async PersonService.handleDetectFaces (/usr/src/app/dist/domain/person/person.service.js:248:23)
immich_microservices     |     at async /usr/src/app/dist/domain/job/job.service.js:137:36
immich_microservices     |     at async Worker.processJob (/usr/src/app/node_modules/bullmq/dist/cjs/classes/worker.js:394:28)
immich_microservices     |     at async Worker.retryIfFailed (/usr/src/app/node_modules/bullmq/dist/cjs/classes/worker.js:581:24)
immich_microservices     | [Nest] 7  - 03/24/2024, 4:17:44 PM   ERROR [JobService] Object:
immich_microservices     | {
immich_microservices     |   "id": "ea7fe00a-068b-46d3-8ae1-61dd6146286f"
immich_microservices     | }
immich_microservices     | 
immich_machine_learning  |                              │ │               │   │   [ 53,  75, 103],      │ │
immich_machine_learning  |                              │ │               │   │   ...,                  │ │
immich_machine_learning  |                              │ │               │   │   [ 27,  53,  70],      │ │
immich_machine_learning  |                              │ │               │   │   [ 28,  54,  71],      │ │
immich_machine_learning  |                              │ │               │   │   [ 32,  58,  75]],     │ │
immich_machine_learning  |                              │ │               │                             │ │
immich_machine_learning  |                              │ │               │      [[ 44,  66,  94],      │ │
immich_machine_learning  |                              │ │               │   │   [ 50,  72, 100],      │ │
immich_machine_learning  |                              │ │               │   │   [ 61,  83, 111],      │ │
immich_machine_learning  |                              │ │               │   │   ...,                  │ │
immich_machine_learning  |                              │ │               │   │   [ 27,  53,  70],      │ │
immich_machine_learning  |                              │ │               │   │   [ 25,  51,  68],      │ │
immich_machine_learning  |                              │ │               │   │   [ 27,  53,  70]]],    │ │
immich_machine_learning  |                              │ │               dtype=uint8)                  │ │
immich_machine_learning  |                              │ │  input_size = (640, 640)                    │ │
immich_machine_learning  |                              │ │     max_num = 0                             │ │
immich_machine_learning  |                              │ │      metric = 'default'                     │ │
immich_machine_learning  |                              │ │ model_ratio = 1.0                           │ │
immich_machine_learning  |                              │ │  new_height = 640                           │ │
immich_machine_learning  |                              │ │   new_width = 480                           │ │
immich_machine_learning  |                              │ │ resized_img = array([[[  1,  19,  36],      │ │
immich_machine_learning  |                              │ │               │   │   [  3,  19,  36],      │ │
immich_machine_learning  |                              │ │               │   │   [  0,  13,  31],      │ │
immich_machine_learning  |                              │ │               │   │   ...,                  │ │
immich_machine_learning  |                              │ │               │   │   [  2,   1,   3],      │ │
immich_machine_learning  |                              │ │               │   │   [  2,   1,   3],      │ │
immich_machine_learning  |                              │ │               │   │   [ 14,  13,  15]],     │ │
immich_machine_learning  |                              │ │               │                             │ │
immich_machine_learning  |                              │ │               │      [[  6,  24,  41],      │ │
immich_machine_learning  |                              │ │               │   │   [  6,  22,  39],      │ │
immich_machine_learning  |                              │ │               │   │   [  1,  15,  33],      │ │
immich_machine_learning  |                              │ │               │   │   ...,                  │ │
immich_machine_learning  |                              │ │               │   │   [  0,   0,   1],      │ │
immich_machine_learning  |                              │ │               │   │   [  4,   3,   5],      │ │
immich_machine_learning  |                              │ │               │   │   [ 16,  15,  17]],     │ │
immich_machine_learning  |                              │ │               │                             │ │
immich_machine_learning  |                              │ │               │      [[  1,  19,  36],      │ │
immich_machine_learning  |                              │ │               │   │   [  3,  19,  36],      │ │
immich_machine_learning  |                              │ │               │   │   [  0,  14,  32],      │ │
immich_machine_learning  |                              │ │               │   │   ...,                  │ │
immich_machine_learning  |                              │ │               │   │   [  2,   1,   3],      │ │
immich_machine_learning  |                              │ │               │   │   [  2,   1,   3],      │ │
immich_machine_learning  |                              │ │               │   │   [ 18,  17,  19]],     │ │
immich_machine_learning  |                              │ │               │                             │ │
immich_machine_learning  |                              │ │               │      ...,                   │ │
immich_machine_learning  |                              │ │               │                             │ │
immich_machine_learning  |                              │ │               │      [[ 40,  67, 101],      │ │
immich_machine_learning  |                              │ │               │   │   [ 28,  55,  89],      │ │
immich_machine_learning  |                              │ │               │   │   [ 33,  60,  94],      │ │
immich_machine_learning  |                              │ │               │   │   ...,                  │ │
immich_machine_learning  |                              │ │               │   │   [ 49,  75,  92],      │ │
immich_machine_learning  |                              │ │               │   │   [ 37,  63,  80],      │ │
immich_machine_learning  |                              │ │               │   │   [ 32,  58,  75]],     │ │
immich_machine_learning  |                              │ │               │                             │ │
immich_machine_learning  |                              │ │               │      [[ 35,  60,  92],      │ │
immich_machine_learning  |                              │ │               │   │   [ 33,  58,  90],      │ │
immich_machine_learning  |                              │ │               │   │   [ 43,  68, 100],      │ │
immich_machine_learning  |                              │ │               │   │   ...,                  │ │
immich_machine_learning  |                              │ │               │   │   [ 29,  55,  72],      │ │
immich_machine_learning  |                              │ │               │   │   [ 33,  59,  76],      │ │
immich_machine_learning  |                              │ │               │   │   [ 33,  59,  76]],     │ │
immich_machine_learning  |                              │ │               │                             │ │
immich_machine_learning  |                              │ │               │      [[ 43,  65,  93],      │ │
immich_machine_learning  |                              │ │               │   │   [ 69,  91, 119],      │ │
immich_machine_learning  |                              │ │               │   │   [ 64,  86, 114],      │ │
immich_machine_learning  |                              │ │               │   │   ...,                  │ │
immich_machine_learning  |                              │ │               │   │   [ 27,  53,  70],      │ │
immich_machine_learning  |                              │ │               │   │   [ 30,  56,  73],      │ │
immich_machine_learning  |                              │ │               │   │   [ 28,  54,  71]]],    │ │
immich_machine_learning  |                              │ │               dtype=uint8)                  │ │
immich_machine_learning  |                              │ │        self = <insightface.model_zoo.retin… │ │
immich_machine_learning  |                              │ │               object at 0x7ab23c362dd0>     │ │
immich_machine_learning  |                              │ ╰─────────────────────────────────────────────╯ │
immich_machine_learning  |                              │                                                 │
immich_machine_learning  |                              │ /opt/venv/lib/python3.10/site-packages/insightf │
immich_machine_learning  |                              │ ace/model_zoo/retinaface.py:152 in forward      │
immich_machine_learning  |                              │                                                 │
immich_machine_learning  |                              │   149 │   │   kpss_list = []                    │
immich_machine_learning  |                              │   150 │   │   input_size = tuple(img.shape[0:2] │
immich_machine_learning  |                              │   151 │   │   blob = cv2.dnn.blobFromImage(img, │
immich_machine_learning  |                              │       (self.input_mean, self.input_mean, self.i │
immich_machine_learning  |                              │ ❱ 152 │   │   net_outs = self.session.run(self. │
immich_machine_learning  |                              │   153 │   │                                     │
immich_machine_learning  |                              │   154 │   │   input_height = blob.shape[2]      │
immich_machine_learning  |                              │   155 │   │   input_width = blob.shape[3]       │
immich_machine_learning  |                              │                                                 │
immich_machine_learning  |                              │ ╭────────────────── locals ───────────────────╮ │
immich_machine_learning  |                              │ │ bboxes_list = []                            │ │
immich_machine_learning  |                              │ │        blob = array([[[[-0.71484375,        │ │
immich_machine_learning  |                              │ │               -0.71484375, -0.75390625,     │ │
immich_machine_learning  |                              │ │               ..., -0.99609375,             │ │
immich_machine_learning  |                              │ │               │   │     -0.99609375,        │ │
immich_machine_learning  |                              │ │               -0.99609375],                 │ │
immich_machine_learning  |                              │ │               │   │    [-0.67578125,        │ │
immich_machine_learning  |                              │ │               -0.69140625, -0.73828125,     │ │
immich_machine_learning  |                              │ │               ..., -0.99609375,             │ │
immich_machine_learning  |                              │ │               │   │     -0.99609375,        │ │
immich_machine_learning  |                              │ │               -0.99609375],                 │ │
immich_machine_learning  |                              │ │               │   │    [-0.71484375,        │ │
immich_machine_learning  |                              │ │               -0.71484375, -0.74609375,     │ │
immich_machine_learning  |                              │ │               ..., -0.99609375,             │ │
immich_machine_learning  |                              │ │               │   │     -0.99609375,        │ │
immich_machine_learning  |                              │ │               -0.99609375],                 │ │
immich_machine_learning  |                              │ │               │   │    ...,                 │ │
immich_machine_learning  |                              │ │               │   │    [-0.20703125,        │ │
immich_machine_learning  |                              │ │               -0.30078125, -0.26171875,     │ │
immich_machine_learning  |                              │ │               ..., -0.99609375,             │ │
immich_machine_learning  |                              │ │               │   │     -0.99609375,        │ │
immich_machine_learning  |                              │ │               -0.99609375],                 │ │
immich_machine_learning  |                              │ │               │   │    [-0.27734375,        │ │
immich_machine_learning  |                              │ │               -0.29296875, -0.21484375,     │ │
immich_machine_learning  |                              │ │               ..., -0.99609375,             │ │
immich_machine_learning  |                              │ │               │   │     -0.99609375,        │ │
immich_machine_learning  |                              │ │               -0.99609375],                 │ │
immich_machine_learning  |                              │ │               │   │    [-0.26953125,        │ │
immich_machine_learning  |                              │ │               -0.06640625, -0.10546875,     │ │
immich_machine_learning  |                              │ │               ..., -0.99609375,             │ │
immich_machine_learning  |                              │ │               │   │     -0.99609375,        │ │
immich_machine_learning  |                              │ │               -0.99609375]],                │ │
immich_machine_learning  |                              │ │               │   │                         │ │
immich_machine_learning  |                              │ │               │   │   [[-0.84765625,        │ │
immich_machine_learning  |                              │ │               -0.84765625, -0.89453125,     │ │
immich_machine_learning  |                              │ │               ..., -0.99609375,             │ │
immich_machine_learning  |                              │ │               │   │     -0.99609375,        │ │
immich_machine_learning  |                              │ │               -0.99609375],                 │ │
immich_machine_learning  |                              │ │               │   │    [-0.80859375,        │ │
immich_machine_learning  |                              │ │               -0.82421875, -0.87890625,     │ │
immich_machine_learning  |                              │ │               ..., -0.99609375,             │ │
immich_machine_learning  |                              │ │               │   │     -0.99609375,        │ │
immich_machine_learning  |                              │ │               -0.99609375],                 │ │
immich_machine_learning  |                              │ │               │   │    [-0.84765625,        │ │
immich_machine_learning  |                              │ │               -0.84765625, -0.88671875,     │ │
immich_machine_learning  |                              │ │               ..., -0.99609375,             │ │
immich_machine_learning  |                              │ │               │   │     -0.99609375,        │ │
immich_machine_learning  |                              │ │               -0.99609375],                 │ │
immich_machine_learning  |                              │ │               │   │    ...,                 │ │
immich_machine_learning  |                              │ │               │   │    [-0.47265625,        │ │
immich_machine_learning  |                              │ │               -0.56640625, -0.52734375,     │ │
immich_machine_learning  |                              │ │               ..., -0.99609375,             │ │
immich_machine_learning  |                              │ │               │   │     -0.99609375,        │ │
immich_machine_learning  |                              │ │               -0.99609375],                 │ │
immich_machine_learning  |                              │ │               │   │    [-0.52734375,        │ │
immich_machine_learning  |                              │ │               -0.54296875, -0.46484375,     │ │
immich_machine_learning  |                              │ │               ..., -0.99609375,             │ │
immich_machine_learning  |                              │ │               │   │     -0.99609375,        │ │
immich_machine_learning  |                              │ │               -0.99609375],                 │ │
immich_machine_learning  |                              │ │               │   │    [-0.48828125,        │ │
immich_machine_learning  |                              │ │               -0.28515625, -0.32421875,     │ │
immich_machine_learning  |                              │ │               ..., -0.99609375,             │ │
immich_machine_learning  |                              │ │               │   │     -0.99609375,        │ │
immich_machine_learning  |                              │ │               -0.99609375]],                │ │
immich_machine_learning  |                              │ │               │   │                         │ │
immich_machine_learning  |                              │ │               │   │   [[-0.98828125,        │ │
immich_machine_learning  |                              │ │               -0.97265625, -0.99609375,     │ │
immich_machine_learning  |                              │ │               ..., -0.99609375,             │ │
immich_machine_learning  |                              │ │               │   │     -0.99609375,        │ │
immich_machine_learning  |                              │ │               -0.99609375],                 │ │
immich_machine_learning  |                              │ │               │   │    [-0.94921875,        │ │
immich_machine_learning  |                              │ │               -0.94921875, -0.98828125,     │ │
immich_machine_learning  |                              │ │               ..., -0.99609375,             │ │
immich_machine_learning  |                              │ │               │   │     -0.99609375,        │ │
immich_machine_learning  |                              │ │               -0.99609375],                 │ │
immich_machine_learning  |                              │ │               │   │    [-0.98828125,        │ │
immich_machine_learning  |                              │ │               -0.97265625, -0.99609375,     │ │
immich_machine_learning  |                              │ │               ..., -0.99609375,             │ │
immich_machine_learning  |                              │ │               │   │     -0.99609375,        │ │
immich_machine_learning  |                              │ │               -0.99609375],                 │ │
immich_machine_learning  |                              │ │               │   │    ...,                 │ │
immich_machine_learning  |                              │ │               │   │    [-0.68359375,        │ │
immich_machine_learning  |                              │ │               -0.77734375, -0.73828125,     │ │
immich_machine_learning  |                              │ │               ..., -0.99609375,             │ │
immich_machine_learning  |                              │ │               │   │     -0.99609375,        │ │
immich_machine_learning  |                              │ │               -0.99609375],                 │ │
immich_machine_learning  |                              │ │               │   │    [-0.72265625,        │ │
immich_machine_learning  |                              │ │               -0.73828125, -0.66015625,     │ │
immich_machine_learning  |                              │ │               ..., -0.99609375,             │ │
immich_machine_learning  |                              │ │               │   │     -0.99609375,        │ │
immich_machine_learning  |                              │ │               -0.99609375],                 │ │
immich_machine_learning  |                              │ │               │   │    [-0.66015625,        │ │
immich_machine_learning  |                              │ │               -0.45703125, -0.49609375,     │ │
immich_machine_learning  |                              │ │               ..., -0.99609375,             │ │
immich_machine_learning  |                              │ │               │   │     -0.99609375,        │ │
immich_machine_learning  |                              │ │               -0.99609375]]]],              │ │
immich_machine_learning  |                              │ │               dtype=float32)                │ │
immich_machine_learning  |                              │ │         img = array([[[  1,  19,  36],      │ │
immich_machine_learning  |                              │ │               │   │   [  3,  19,  36],      │ │
immich_machine_learning  |                              │ │               │   │   [  0,  13,  31],      │ │
immich_machine_learning  |                              │ │               │   │   ...,                  │ │
immich_machine_learning  |                              │ │               │   │   [  0,   0,   0],      │ │
immich_machine_learning  |                              │ │               │   │   [  0,   0,   0],      │ │
immich_machine_learning  |                              │ │               │   │   [  0,   0,   0]],     │ │
immich_machine_learning  |                              │ │               │                             │ │
immich_machine_learning  |                              │ │               │      [[  6,  24,  41],      │ │
immich_machine_learning  |                              │ │               │   │   [  6,  22,  39],      │ │
immich_machine_learning  |                              │ │               │   │   [  1,  15,  33],      │ │
immich_machine_learning  |                              │ │               │   │   ...,                  │ │
immich_machine_learning  |                              │ │               │   │   [  0,   0,   0],      │ │
immich_machine_learning  |                              │ │               │   │   [  0,   0,   0],      │ │
immich_machine_learning  |                              │ │               │   │   [  0,   0,   0]],     │ │
immich_machine_learning  |                              │ │               │                             │ │
immich_machine_learning  |                              │ │               │      [[  1,  19,  36],      │ │
immich_machine_learning  |                              │ │               │   │   [  3,  19,  36],      │ │
immich_machine_learning  |                              │ │               │   │   [  0,  14,  32],      │ │
immich_machine_learning  |                              │ │               │   │   ...,                  │ │
immich_machine_learning  |                              │ │               │   │   [  0,   0,   0],      │ │
immich_machine_learning  |                              │ │               │   │   [  0,   0,   0],      │ │
immich_machine_learning  |                              │ │               │   │   [  0,   0,   0]],     │ │
immich_machine_learning  |                              │ │               │                             │ │
immich_machine_learning  |                              │ │               │      ...,                   │ │
immich_machine_learning  |                              │ │               │                             │ │
immich_machine_learning  |                              │ │               │      [[ 40,  67, 101],      │ │
immich_machine_learning  |                              │ │               │   │   [ 28,  55,  89],      │ │
immich_machine_learning  |                              │ │               │   │   [ 33,  60,  94],      │ │
immich_machine_learning  |                              │ │               │   │   ...,                  │ │
immich_machine_learning  |                              │ │               │   │   [  0,   0,   0],      │ │
immich_machine_learning  |                              │ │               │   │   [  0,   0,   0],      │ │
immich_machine_learning  |                              │ │               │   │   [  0,   0,   0]],     │ │
immich_machine_learning  |                              │ │               │                             │ │
immich_machine_learning  |                              │ │               │      [[ 35,  60,  92],      │ │
immich_machine_learning  |                              │ │               │   │   [ 33,  58,  90],      │ │
immich_machine_learning  |                              │ │               │   │   [ 43,  68, 100],      │ │
immich_machine_learning  |                              │ │               │   │   ...,                  │ │
immich_machine_learning  |                              │ │               │   │   [  0,   0,   0],      │ │
immich_machine_learning  |                              │ │               │   │   [  0,   0,   0],      │ │
immich_machine_learning  |                              │ │               │   │   [  0,   0,   0]],     │ │
immich_machine_learning  |                              │ │               │                             │ │
immich_machine_learning  |                              │ │               │      [[ 43,  65,  93],      │ │
immich_machine_learning  |                              │ │               │   │   [ 69,  91, 119],      │ │
immich_machine_learning  |                              │ │               │   │   [ 64,  86, 114],      │ │
immich_machine_learning  |                              │ │               │   │   ...,                  │ │
immich_machine_learning  |                              │ │               │   │   [  0,   0,   0],      │ │
immich_machine_learning  |                              │ │               │   │   [  0,   0,   0],      │ │
immich_machine_learning  |                              │ │               │   │   [  0,   0,   0]]],    │ │
immich_machine_learning  |                              │ │               dtype=uint8)                  │ │
immich_machine_learning  |                              │ │  input_size = (640, 640)                    │ │
immich_machine_learning  |                              │ │   kpss_list = []                            │ │
immich_machine_learning  |                              │ │ scores_list = []                            │ │
immich_machine_learning  |                              │ │        self = <insightface.model_zoo.retin… │ │
immich_machine_learning  |                              │ │               object at 0x7ab23c362dd0>     │ │
immich_machine_learning  |                              │ │   threshold = 0.7                           │ │
immich_machine_learning  |                              │ ╰─────────────────────────────────────────────╯ │
immich_machine_learning  |                              │                                                 │
immich_machine_learning  |                              │ /opt/venv/lib/python3.10/site-packages/onnxrunt │
immich_machine_learning  |                              │ ime/capi/onnxruntime_inference_collection.py:22 │
immich_machine_learning  |                              │ 0 in run                                        │
immich_machine_learning  |                              │                                                 │
immich_machine_learning  |                              │    217 │   │   if not output_names:             │
immich_machine_learning  |                              │    218 │   │   │   output_names = [output.name  │
immich_machine_learning  |                              │    219 │   │   try:                             │
immich_machine_learning  |                              │ ❱  220 │   │   │   return self._sess.run(output │
immich_machine_learning  |                              │    221 │   │   except C.EPFail as err:          │
immich_machine_learning  |                              │    222 │   │   │   if self._enable_fallback:    │
immich_machine_learning  |                              │    223 │   │   │   │   print(f"EP Error: {err!s │
immich_machine_learning  |                              │                                                 │
immich_machine_learning  |                              │ ╭────────────────── locals ───────────────────╮ │
immich_machine_learning  |                              │ │   input_feed = {                            │ │
immich_machine_learning  |                              │ │                │   'input.1':               │ │
immich_machine_learning  |                              │ │                array([[[[-0.71484375,       │ │
immich_machine_learning  |                              │ │                -0.71484375, -0.75390625,    │ │
immich_machine_learning  |                              │ │                ..., -0.99609375,            │ │
immich_machine_learning  |                              │ │                │   │     -0.99609375,       │ │
immich_machine_learning  |                              │ │                -0.99609375],                │ │
immich_machine_learning  |                              │ │                │   │    [-0.67578125,       │ │
immich_machine_learning  |                              │ │                -0.69140625, -0.73828125,    │ │
immich_machine_learning  |                              │ │                ..., -0.99609375,            │ │
immich_machine_learning  |                              │ │                │   │     -0.99609375,       │ │
immich_machine_learning  |                              │ │                -0.99609375],                │ │
immich_machine_learning  |                              │ │                │   │    [-0.71484375,       │ │
immich_machine_learning  |                              │ │                -0.71484375, -0.74609375,    │ │
immich_machine_learning  |                              │ │                ..., -0.99609375,            │ │
immich_machine_learning  |                              │ │                │   │     -0.99609375,       │ │
immich_machine_learning  |                              │ │                -0.99609375],                │ │
immich_machine_learning  |                              │ │                │   │    ...,                │ │
immich_machine_learning  |                              │ │                │   │    [-0.20703125,       │ │
immich_machine_learning  |                              │ │                -0.30078125, -0.26171875,    │ │
immich_machine_learning  |                              │ │                ..., -0.99609375,            │ │
immich_machine_learning  |                              │ │                │   │     -0.99609375,       │ │
immich_machine_learning  |                              │ │                -0.99609375],                │ │
immich_machine_learning  |                              │ │                │   │    [-0.27734375,       │ │
immich_machine_learning  |                              │ │                -0.29296875, -0.21484375,    │ │
immich_machine_learning  |                              │ │                ..., -0.99609375,            │ │
immich_machine_learning  |                              │ │                │   │     -0.99609375,       │ │
immich_machine_learning  |                              │ │                -0.99609375],                │ │
immich_machine_learning  |                              │ │                │   │    [-0.26953125,       │ │
immich_machine_learning  |                              │ │                -0.06640625, -0.10546875,    │ │
immich_machine_learning  |                              │ │                ..., -0.99609375,            │ │
immich_machine_learning  |                              │ │                │   │     -0.99609375,       │ │
immich_machine_learning  |                              │ │                -0.99609375]],               │ │
immich_machine_learning  |                              │ │                │   │                        │ │
immich_machine_learning  |                              │ │                │   │   [[-0.84765625,       │ │
immich_machine_learning  |                              │ │                -0.84765625, -0.89453125,    │ │
immich_machine_learning  |                              │ │                ..., -0.99609375,            │ │
immich_machine_learning  |                              │ │                │   │     -0.99609375,       │ │
immich_machine_learning  |                              │ │                -0.99609375],                │ │
immich_machine_learning  |                              │ │                │   │    [-0.80859375,       │ │
immich_machine_learning  |                              │ │                -0.82421875, -0.87890625,    │ │
immich_machine_learning  |                              │ │                ..., -0.99609375,            │ │
immich_machine_learning  |                              │ │                │   │     -0.99609375,       │ │
immich_machine_learning  |                              │ │                -0.99609375],                │ │
immich_machine_learning  |                              │ │                │   │    [-0.84765625,       │ │
immich_machine_learning  |                              │ │                -0.84765625, -0.88671875,    │ │
immich_machine_learning  |                              │ │                ..., -0.99609375,            │ │
immich_machine_learning  |                              │ │                │   │     -0.99609375,       │ │
immich_machine_learning  |                              │ │                -0.99609375],                │ │
immich_machine_learning  |                              │ │                │   │    ...,                │ │
immich_machine_learning  |                              │ │                │   │    [-0.47265625,       │ │
immich_machine_learning  |                              │ │                -0.56640625, -0.52734375,    │ │
immich_machine_learning  |                              │ │                ..., -0.99609375,            │ │
immich_machine_learning  |                              │ │                │   │     -0.99609375,       │ │
immich_machine_learning  |                              │ │                -0.99609375],                │ │
immich_machine_learning  |                              │ │                │   │    [-0.52734375,       │ │
immich_machine_learning  |                              │ │                -0.54296875, -0.46484375,    │ │
immich_machine_learning  |                              │ │                ..., -0.99609375,            │ │
immich_machine_learning  |                              │ │                │   │     -0.99609375,       │ │
immich_machine_learning  |                              │ │                -0.99609375],                │ │
immich_machine_learning  |                              │ │                │   │    [-0.48828125,       │ │
immich_machine_learning  |                              │ │                -0.28515625, -0.32421875,    │ │
immich_machine_learning  |                              │ │                ..., -0.99609375,            │ │
immich_machine_learning  |                              │ │                │   │     -0.99609375,       │ │
immich_machine_learning  |                              │ │                -0.99609375]],               │ │
immich_machine_learning  |                              │ │                │   │                        │ │
immich_machine_learning  |                              │ │                │   │   [[-0.98828125,       │ │
immich_machine_learning  |                              │ │                -0.97265625, -0.99609375,    │ │
immich_machine_learning  |                              │ │                ..., -0.99609375,            │ │
immich_machine_learning  |                              │ │                │   │     -0.99609375,       │ │
immich_machine_learning  |                              │ │                -0.99609375],                │ │
immich_machine_learning  |                              │ │                │   │    [-0.94921875,       │ │
immich_machine_learning  |                              │ │                -0.94921875, -0.98828125,    │ │
immich_machine_learning  |                              │ │                ..., -0.99609375,            │ │
immich_machine_learning  |                              │ │                │   │     -0.99609375,       │ │
immich_machine_learning  |                              │ │                -0.99609375],                │ │
immich_machine_learning  |                              │ │                │   │    [-0.98828125,       │ │
immich_machine_learning  |                              │ │                -0.97265625, -0.99609375,    │ │
immich_machine_learning  |                              │ │                ..., -0.99609375,            │ │
immich_machine_learning  |                              │ │                │   │     -0.99609375,       │ │
immich_machine_learning  |                              │ │                -0.99609375],                │ │
immich_machine_learning  |                              │ │                │   │    ...,                │ │
immich_machine_learning  |                              │ │                │   │    [-0.68359375,       │ │
immich_machine_learning  |                              │ │                -0.77734375, -0.73828125,    │ │
immich_machine_learning  |                              │ │                ..., -0.99609375,            │ │
immich_machine_learning  |                              │ │                │   │     -0.99609375,       │ │
immich_machine_learning  |                              │ │                -0.99609375],                │ │
immich_machine_learning  |                              │ │                │   │    [-0.72265625,       │ │
immich_machine_learning  |                              │ │                -0.73828125, -0.66015625,    │ │
immich_machine_learning  |                              │ │                ..., -0.99609375,            │ │
immich_machine_learning  |                              │ │                │   │     -0.99609375,       │ │
immich_machine_learning  |                              │ │                -0.99609375],                │ │
immich_machine_learning  |                              │ │                │   │    [-0.66015625,       │ │
immich_machine_learning  |                              │ │                -0.45703125, -0.49609375,    │ │
immich_machine_learning  |                              │ │                ..., -0.99609375,            │ │
immich_machine_learning  |                              │ │                │   │     -0.99609375,       │ │
immich_machine_learning  |                              │ │                -0.99609375]]]],             │ │
immich_machine_learning  |                              │ │                dtype=float32)               │ │
immich_machine_learning  |                              │ │                }                            │ │
immich_machine_learning  |                              │ │ output_names = [                            │ │
immich_machine_learning  |                              │ │                │   '448',                   │ │
immich_machine_learning  |                              │ │                │   '471',                   │ │
immich_machine_learning  |                              │ │                │   '494',                   │ │
immich_machine_learning  |                              │ │                │   '451',                   │ │
immich_machine_learning  |                              │ │                │   '474',                   │ │
immich_machine_learning  |                              │ │                │   '497',                   │ │
immich_machine_learning  |                              │ │                │   '454',                   │ │
immich_machine_learning  |                              │ │                │   '477',                   │ │
immich_machine_learning  |                              │ │                │   '500'                    │ │
immich_machine_learning  |                              │ │                ]                            │ │
immich_machine_learning  |                              │ │  run_options = None                         │ │
immich_machine_learning  |                              │ │         self = <onnxruntime.capi.onnxrunti… │ │
immich_machine_learning  |                              │ │                object at 0x7ab23c362b00>    │ │
immich_machine_learning  |                              │ ╰─────────────────────────────────────────────╯ │
immich_machine_learning  |                              ╰─────────────────────────────────────────────────╯
immich_machine_learning  |                              RuntimeException: [ONNXRuntimeError] : 6 :         
immich_machine_learning  |                              RUNTIME_EXCEPTION : Encountered unknown exception  
immich_machine_learning  |                              in Run()                                           
immich_machine_learning  | [03/24/24 16:17:48] DEBUG    Checking for inactivity...                         

@mertalev
Copy link
Contributor

I made an upstream issue for this based on the info here. Let's wait for their response.

@yu-jingrui
Copy link

I am having this problem too.

@diogovalentte
Copy link

I'm having the same issue in 1.100.0 too.

@mertalev
Copy link
Contributor

For future reference, it's better to leave a thumbs up for issues if they affect you. Leaving a comment notifies every participant in the issue, so it should be reserved for comments that drive the issue forward.

@kaienli
Copy link

kaienli commented Mar 29, 2024

same issue in 1.100.0 too.
on wsl2,my config is
immich-machine-learning:
container_name: immich_machine_learning
restart: always
image: ghcr.io/immich-app/immich-machine-learning:${IMMICH_VERSION:-release}-openvino
devices:
- /dev/dri:/dev/dri
- /dev/dxg:/dev/dxg
volumes:
- D:\Immich\cache:/cache
- /dev/bus/usb:/dev/bus/usb
- /usr/lib/wsl:/usr/lib/wsl
env_file:
- .env

@agrawalsourav98
Copy link
Contributor

I am also facing this issue. It runs fine on my laptop which has i5-1145G7 but doesn't work on my immich desktop which has i3-12100.

Can we provide an option to disable OpenVINO runtime for where it fails only for the facial recognition model? Because the smart search models work fine.

@mertalev
Copy link
Contributor

The i5-1145G7 has Iris graphics, same with the CPU I tested with. It seems to be that UHD graphics doesn't work, but Iris does.

@jsapede

This comment has been minimized.

@plmsuper8
Copy link

plmsuper8 commented Apr 23, 2024

similar here with smart search. 1.102.3 on N5095.
sadly the smart search nerver works for me.

good news, when change from immich-machine-learning:${IMMICH_VERSION}-openvino to immich-machine-learning:${IMMICH_VERSION}, it works! (related #8918)

@jsapede
Copy link

jsapede commented Apr 29, 2024

same error on 1.102.3, was working until 1.099

immich_machine_learning | [04/29/24 12:59:22] INFO Setting 'buffalo_l' execution providers to immich_machine_learning | ['OpenVINOExecutionProvider', immich_machine_learning | 'CPUExecutionProvider'], in descending order of immich_machine_learning | preference immich_machine_learning | [04/29/24 12:59:22] INFO Loading facial recognition model 'buffalo_l' to immich_machine_learning | memory immich_machine_learning | [04/29/24 12:59:29] ERROR Exception in ASGI application immich_machine_learning | immich_machine_learning | ╭─────── Traceback (most recent call last) ───────╮ immich_machine_learning | │ /usr/src/app/main.py:118 in predict │ immich_machine_learning | │ │ immich_machine_learning | │ 115 │ │ immich_machine_learning | │ 116 │ model = await load(await model_cache. │ immich_machine_learning | │ ttl=settings.model_ttl, **kwargs)) │ immich_machine_learning | │ 117 │ model.configure(**kwargs) │ immich_machine_learning | │ ❱ 118 │ outputs = await run(model.predict, in │ immich_machine_learning | │ 119 │ return ORJSONResponse(outputs) │ immich_machine_learning | │ 120 │ immich_machine_learning | │ 121 │ immich_machine_learning | │ │ immich_machine_learning | │ /usr/src/app/main.py:125 in run │ immich_machine_learning | │ │ immich_machine_learning | │ 122 async def run(func: Callable[..., Any], i │ immich_machine_learning | │ 123 │ if thread_pool is None: │ immich_machine_learning | │ 124 │ │ return func(inputs) │ immich_machine_learning | │ ❱ 125 │ return await asyncio.get_running_loop │ immich_machine_learning | │ 126 │ immich_machine_learning | │ 127 │ immich_machine_learning | │ 128 async def load(model: InferenceModel) -> │ immich_machine_learning | │ │ immich_machine_learning | │ /usr/lib/python3.10/concurrent/futures/thread.p │ immich_machine_learning | │ y:58 in run │ immich_machine_learning | │ │ immich_machine_learning | │ /usr/src/app/models/base.py:59 in predict │ immich_machine_learning | │ │ immich_machine_learning | │ 56 │ │ self.load() │ immich_machine_learning | │ 57 │ │ if model_kwargs: │ immich_machine_learning | │ 58 │ │ │ self.configure(**model_kwargs │ immich_machine_learning | │ ❱ 59 │ │ return self._predict(inputs) │ immich_machine_learning | │ 60 │ │ immich_machine_learning | │ 61 │ @abstractmethod │ immich_machine_learning | │ 62 │ def _predict(self, inputs: Any) -> An │ immich_machine_learning | │ │ immich_machine_learning | │ /usr/src/app/models/facial_recognition.py:49 in │ immich_machine_learning | │ _predict │ immich_machine_learning | │ │ immich_machine_learning | │ 46 │ │ else: │ immich_machine_learning | │ 47 │ │ │ decoded_image = image │ immich_machine_learning | │ 48 │ │ assert is_ndarray(decoded_image, n │ immich_machine_learning | │ ❱ 49 │ │ bboxes, kpss = self.det_model.dete │ immich_machine_learning | │ 50 │ │ if bboxes.size == 0: │ immich_machine_learning | │ 51 │ │ │ return [] │ immich_machine_learning | │ 52 │ │ assert is_ndarray(kpss, np.float32 │ immich_machine_learning | │ │ immich_machine_learning | │ /opt/venv/lib/python3.10/site-packages/insightf │ immich_machine_learning | │ ace/model_zoo/retinaface.py:224 in detect │ immich_machine_learning | │ │ immich_machine_learning | │ 221 │ │ det_img = np.zeros( (input_size[1 │ immich_machine_learning | │ 222 │ │ det_img[:new_height, :new_width, │ immich_machine_learning | │ 223 │ │ │ immich_machine_learning | │ ❱ 224 │ │ scores_list, bboxes_list, kpss_li │ immich_machine_learning | │ 225 │ │ │ immich_machine_learning | │ 226 │ │ scores = np.vstack(scores_list) │ immich_machine_learning | │ 227 │ │ scores_ravel = scores.ravel() │ immich_machine_learning | │ │ immich_machine_learning | │ /opt/venv/lib/python3.10/site-packages/insightf │ immich_machine_learning | │ ace/model_zoo/retinaface.py:152 in forward │ immich_machine_learning | │ │ immich_machine_learning | │ 149 │ │ kpss_list = [] │ immich_machine_learning | │ 150 │ │ input_size = tuple(img.shape[0:2] │ immich_machine_learning | │ 151 │ │ blob = cv2.dnn.blobFromImage(img, │ immich_machine_learning | │ (self.input_mean, self.input_mean, self.i │ immich_machine_learning | │ ❱ 152 │ │ net_outs = self.session.run(self. │ immich_machine_learning | │ 153 │ │ │ immich_machine_learning | │ 154 │ │ input_height = blob.shape[2] │ immich_machine_learning | │ 155 │ │ input_width = blob.shape[3] │ immich_machine_learning | │ │ immich_machine_learning | │ /opt/venv/lib/python3.10/site-packages/onnxrunt │ immich_machine_learning | │ ime/capi/onnxruntime_inference_collection.py:22 │ immich_machine_learning | │ 0 in run │ immich_machine_learning | │ │ immich_machine_learning | │ 217 │ │ if not output_names: │ immich_machine_learning | │ 218 │ │ │ output_names = [output.name │ immich_machine_learning | │ 219 │ │ try: │ immich_machine_learning | │ ❱ 220 │ │ │ return self._sess.run(output │ immich_machine_learning | │ 221 │ │ except C.EPFail as err: │ immich_machine_learning | │ 222 │ │ │ if self._enable_fallback: │ immich_machine_learning | │ 223 │ │ │ │ print(f"EP Error: {err!s │ immich_machine_learning | ╰─────────────────────────────────────────────────╯ immich_machine_learning | RuntimeException: [ONNXRuntimeError] : 6 : immich_machine_learning | RUNTIME_EXCEPTION : Encountered unknown exception immich_machine_learning | in Run() immich_microservices | [Nest] 7 - 04/29/2024, 12:59:29 PM ERROR [JobService] Unable to run job handler (faceDetection/face-detection): Error: Machine learning request for facial recognition failed with status 500: Internal Server Error immich_microservices | [Nest] 7 - 04/29/2024, 12:59:29 PM ERROR [JobService] Error: Machine learning request for facial recognition failed with status 500: Internal Server Error immich_microservices | at MachineLearningRepository.predict (/usr/src/app/dist/repositories/machine-learning.repository.js:23:19) immich_microservices | at process.processTicksAndRejections (node:internal/process/task_queues:95:5) immich_microservices | at async PersonService.handleDetectFaces (/usr/src/app/dist/services/person.service.js:268:23) immich_microservices | at async /usr/src/app/dist/services/job.service.js:149:36 immich_microservices | at async Worker.processJob (/usr/src/app/node_modules/bullmq/dist/cjs/classes/worker.js:394:28) immich_microservices | at async Worker.retryIfFailed (/usr/src/app/node_modules/bullmq/dist/cjs/classes/worker.js:581:24) immich_microservices | [Nest] 7 - 04/29/2024, 12:59:29 PM ERROR [JobService] Object: immich_microservices | { immich_microservices | "id": "541c6706-c6bd-43e0-bf74-d8bbc4d1b664" immich_microservices | } immich_microservices |

@nodis
Copy link

nodis commented May 1, 2024

me too

@engels0n
Copy link

engels0n commented May 2, 2024

Same problem in new version 1.103.1

`[05/02/24 07:05:03] INFO Setting 'antelopev2' execution providers to
['OpenVINOExecutionProvider',
'CPUExecutionProvider'], in descending order of
preference
[05/02/24 07:05:03] INFO Loading facial recognition model 'antelopev2' to
memory
[05/02/24 07:05:11] ERROR Exception in ASGI application

                         ╭─────── Traceback (most recent call last) ───────╮
                         │ /usr/src/app/main.py:118 in predict             │
                         │                                                 │
                         │   115 │                                         │
                         │   116 │   model = await load(await model_cache. │
                         │       ttl=settings.model_ttl, **kwargs))        │
                         │   117 │   model.configure(**kwargs)             │
                         │ ❱ 118 │   outputs = await run(model.predict, in │
                         │   119 │   return ORJSONResponse(outputs)        │
                         │   120                                           │
                         │   121                                           │
                         │                                                 │
                         │ /usr/src/app/main.py:125 in run                 │
                         │                                                 │
                         │   122 async def run(func: Callable[..., Any], i │
                         │   123 │   if thread_pool is None:               │
                         │   124 │   │   return func(inputs)               │
                         │ ❱ 125 │   return await asyncio.get_running_loop │
                         │   126                                           │
                         │   127                                           │
                         │   128 async def load(model: InferenceModel) ->  │
                         │                                                 │
                         │ /usr/lib/python3.10/concurrent/futures/thread.p │
                         │ y:58 in run                                     │
                         │                                                 │
                         │ /usr/src/app/models/base.py:59 in predict       │
                         │                                                 │
                         │    56 │   │   self.load()                       │
                         │    57 │   │   if model_kwargs:                  │
                         │    58 │   │   │   self.configure(**model_kwargs │
                         │ ❱  59 │   │   return self._predict(inputs)      │
                         │    60 │                                         │
                         │    61 │   @abstractmethod                       │
                         │    62 │   def _predict(self, inputs: Any) -> An │
                         │                                                 │
                         │ /usr/src/app/models/facial_recognition.py:49 in │
                         │ _predict                                        │
                         │                                                 │
                         │   46 │   │   else:                              │
                         │   47 │   │   │   decoded_image = image          │
                         │   48 │   │   assert is_ndarray(decoded_image, n │
                         │ ❱ 49 │   │   bboxes, kpss = self.det_model.dete │
                         │   50 │   │   if bboxes.size == 0:               │
                         │   51 │   │   │   return []                      │
                         │   52 │   │   assert is_ndarray(kpss, np.float32 │
                         │                                                 │
                         │ /opt/venv/lib/python3.10/site-packages/insightf │
                         │ ace/model_zoo/retinaface.py:224 in detect       │
                         │                                                 │
                         │   221 │   │   det_img = np.zeros( (input_size[1 │
                         │   222 │   │   det_img[:new_height, :new_width,  │
                         │   223 │   │                                     │
                         │ ❱ 224 │   │   scores_list, bboxes_list, kpss_li │
                         │   225 │   │                                     │
                         │   226 │   │   scores = np.vstack(scores_list)   │
                         │   227 │   │   scores_ravel = scores.ravel()     │
                         │                                                 │
                         │ /opt/venv/lib/python3.10/site-packages/insightf │
                         │ ace/model_zoo/retinaface.py:152 in forward      │
                         │                                                 │
                         │   149 │   │   kpss_list = []                    │
                         │   150 │   │   input_size = tuple(img.shape[0:2] │
                         │   151 │   │   blob = cv2.dnn.blobFromImage(img, │
                         │       (self.input_mean, self.input_mean, self.i │
                         │ ❱ 152 │   │   net_outs = self.session.run(self. │
                         │   153 │   │                                     │
                         │   154 │   │   input_height = blob.shape[2]      │
                         │   155 │   │   input_width = blob.shape[3]       │
                         │                                                 │
                         │ /opt/venv/lib/python3.10/site-packages/onnxrunt │
                         │ ime/capi/onnxruntime_inference_collection.py:22 │
                         │ 0 in run                                        │
                         │                                                 │
                         │    217 │   │   if not output_names:             │
                         │    218 │   │   │   output_names = [output.name  │
                         │    219 │   │   try:                             │
                         │ ❱  220 │   │   │   return self._sess.run(output │
                         │    221 │   │   except C.EPFail as err:          │
                         │    222 │   │   │   if self._enable_fallback:    │
                         │    223 │   │   │   │   print(f"EP Error: {err!s │
                         ╰─────────────────────────────────────────────────╯
                         RuntimeException: [ONNXRuntimeError] : 6 :
                         RUNTIME_EXCEPTION : Encountered unknown exception
                         in Run()`

@engels0n
Copy link

engels0n commented May 2, 2024

@plmsuper8

Thanks for the hint and "workaround".
But now it obviously uses the CPU instead of the GPU ;) - so the problem still exists.

@jsapede
Copy link

jsapede commented May 14, 2024

still not working in 1.104.0
will there be a solution for openvino use ?

@Snuupy
Copy link

Snuupy commented May 14, 2024

I was going to try downgrading onnxruntime to 2024.1 (from the current 2024.3) in the immich-machine-learning Dockerfile. The last version to have working openvino was .98 which used 2024.1. I was going to do a build and test it, but I haven't had time yet.

Edit: nope, not that simple if you try to edit the Dockerfile and change just the onnxruntime version unfortunately.

logs
immich_microservices     | [Nest] 6  - 05/14/2024, 6:24:58 PM     LOG [ImmichMicroservices] [MediaService] Successfully generated WEBP image thumbnail for asset b5bd0dc0-d6c7-4133-8a6c-59fd9dfe7e4c
immich_machine_learning  | [05/14/24 18:24:58] INFO     Setting 'ViT-B-32__openai' execution providers to  
immich_machine_learning  |                              ['OpenVINOExecutionProvider',                      
immich_machine_learning  |                              'CPUExecutionProvider'], in descending order of    
immich_machine_learning  |                              preference                                         
immich_machine_learning  | [05/14/24 18:24:58] INFO     Setting 'buffalo_l' execution providers to         
immich_machine_learning  |                              ['OpenVINOExecutionProvider',                      
immich_machine_learning  |                              'CPUExecutionProvider'], in descending order of    
immich_machine_learning  |                              preference                                         
immich_machine_learning  | [05/14/24 18:24:58] INFO     Loading clip model 'ViT-B-32__openai' to memory    
immich_machine_learning  | 2024-05-14 18:24:59.955630642 [E:onnxruntime:, inference_session.cc:1985 Initialize] Encountered unknown exception in Initialize()
immich_machine_learning  | [05/14/24 18:24:59] ERROR    Exception in ASGI application                      
immich_machine_learning  |                                                                                 
immich_machine_learning  |                              ╭─────── Traceback (most recent call last) ───────╮
immich_machine_learning  |                              │ /usr/src/app/main.py:116 in predict             │
immich_machine_learning  |                              │                                                 │
immich_machine_learning  |                              │   113 │   except orjson.JSONDecodeError:        │
immich_machine_learning  |                              │   114 │   │   raise HTTPException(400, f"Invali │
immich_machine_learning  |                              │   115 │                                         │
immich_machine_learning  |                              │ ❱ 116 │   model = await load(await model_cache. │
immich_machine_learning  |                              │       ttl=settings.model_ttl, **kwargs))        │
immich_machine_learning  |                              │   117 │   model.configure(**kwargs)             │
immich_machine_learning  |                              │   118 │   outputs = await run(model.predict, in │
immich_machine_learning  |                              │   119 │   return ORJSONResponse(outputs)        │
immich_machine_learning  |                              │                                                 │
immich_machine_learning  |                              │ /usr/src/app/main.py:137 in load                │
immich_machine_learning  |                              │                                                 │
immich_machine_learning  |                              │   134 │   │   │   model.load()                  │
immich_machine_learning  |                              │   135 │                                         │
immich_machine_learning  |                              │   136 │   try:                                  │
immich_machine_learning  |                              │ ❱ 137 │   │   await run(_load, model)           │
immich_machine_learning  |                              │   138 │   │   return model                      │
immich_machine_learning  |                              │   139 │   except (OSError, InvalidProtobuf, Bad │
immich_machine_learning  |                              │   140 │   │   log.warning(                      │
immich_machine_learning  |                              │                                                 │
immich_machine_learning  |                              │ /usr/src/app/main.py:125 in run                 │
immich_machine_learning  |                              │                                                 │
immich_machine_learning  |                              │   122 async def run(func: Callable[..., Any], i │
immich_machine_learning  |                              │   123 │   if thread_pool is None:               │
immich_machine_learning  |                              │   124 │   │   return func(inputs)               │
immich_machine_learning  |                              │ ❱ 125 │   return await asyncio.get_running_loop │
immich_machine_learning  |                              │   126                                           │
immich_machine_learning  |                              │   127                                           │
immich_machine_learning  |                              │   128 async def load(model: InferenceModel) ->  │
immich_machine_learning  |                              │                                                 │
immich_machine_learning  |                              │ /usr/lib/python3.10/concurrent/futures/thread.p │
immich_machine_learning  |                              │ y:58 in run                                     │
immich_machine_learning  |                              │                                                 │
immich_machine_learning  |                              │ /usr/src/app/main.py:134 in _load               │
immich_machine_learning  |                              │                                                 │
immich_machine_learning  |                              │   131 │                                         │
immich_machine_learning  |                              │   132 │   def _load(model: InferenceModel) -> N │
immich_machine_learning  |                              │   133 │   │   with lock:                        │
immich_machine_learning  |                              │ ❱ 134 │   │   │   model.load()                  │
immich_machine_learning  |                              │   135 │                                         │
immich_machine_learning  |                              │   136 │   try:                                  │
immich_machine_learning  |                              │   137 │   │   await run(_load, model)           │
immich_machine_learning  |                              │                                                 │
immich_machine_learning  |                              │ /usr/src/app/models/base.py:52 in load          │
immich_machine_learning  |                              │                                                 │
immich_machine_learning  |                              │    49 │   │   │   return                        │
immich_machine_learning  |                              │    50 │   │   self.download()                   │
immich_machine_learning  |                              │    51 │   │   log.info(f"Loading {self.model_ty │
immich_machine_learning  |                              │       to memory")                               │
immich_machine_learning  |                              │ ❱  52 │   │   self._load()                      │
immich_machine_learning  |                              │    53 │   │   self.loaded = True                │
immich_machine_learning  |                              │    54 │                                         │
immich_machine_learning  |                              │    55 │   def predict(self, inputs: Any, **mode │
immich_machine_learning  |                              │                                                 │
immich_machine_learning  |                              │ /usr/src/app/models/clip.py:146 in _load        │
immich_machine_learning  |                              │                                                 │
immich_machine_learning  |                              │   143 │   │   super().__init__(clean_name(model │
immich_machine_learning  |                              │   144 │                                         │
immich_machine_learning  |                              │   145 │   def _load(self) -> None:              │
immich_machine_learning  |                              │ ❱ 146 │   │   super()._load()                   │
immich_machine_learning  |                              │   147 │   │   self._load_tokenizer()            │
immich_machine_learning  |                              │   148 │   │                                     │
immich_machine_learning  |                              │   149 │   │   size: list[int] | int = self.prep │
immich_machine_learning  |                              │                                                 │
immich_machine_learning  |                              │ /usr/src/app/models/clip.py:41 in _load         │
immich_machine_learning  |                              │                                                 │
immich_machine_learning  |                              │    38 │   │                                     │
immich_machine_learning  |                              │    39 │   │   if self.mode == "vision" or self. │
immich_machine_learning  |                              │    40 │   │   │   log.debug(f"Loading clip visi │
immich_machine_learning  |                              │ ❱  41 │   │   │   self.vision_model = self._mak │
immich_machine_learning  |                              │    42 │   │   │   log.debug(f"Loaded clip visio │
immich_machine_learning  |                              │    43 │                                         │
immich_machine_learning  |                              │    44 │   def _predict(self, image_or_text: Ima │
immich_machine_learning  |                              │                                                 │
immich_machine_learning  |                              │ /usr/src/app/models/base.py:117 in              │
immich_machine_learning  |                              │ _make_session                                   │
immich_machine_learning  |                              │                                                 │
immich_machine_learning  |                              │   114 │   │   │   case ".armnn":                │
immich_machine_learning  |                              │   115 │   │   │   │   session = AnnSession(mode │
immich_machine_learning  |                              │   116 │   │   │   case ".onnx":                 │
immich_machine_learning  |                              │ ❱ 117 │   │   │   │   session = ort.InferenceSe │
immich_machine_learning  |                              │   118 │   │   │   │   │   model_path.as_posix() │
immich_machine_learning  |                              │   119 │   │   │   │   │   sess_options=self.ses │
immich_machine_learning  |                              │   120 │   │   │   │   │   providers=self.provid │
immich_machine_learning  |                              │                                                 │
immich_machine_learning  |                              │ /opt/venv/lib/python3.10/site-packages/onnxrunt │
immich_machine_learning  |                              │ ime/capi/onnxruntime_inference_collection.py:41 │
immich_machine_learning  |                              │ 9 in __init__                                   │
immich_machine_learning  |                              │                                                 │
immich_machine_learning  |                              │    416 │   │   disabled_optimizers = kwargs["di │
immich_machine_learning  |                              │        kwargs else None                         │
immich_machine_learning  |                              │    417 │   │                                    │
immich_machine_learning  |                              │    418 │   │   try:                             │
immich_machine_learning  |                              │ ❱  419 │   │   │   self._create_inference_sessi │
immich_machine_learning  |                              │        disabled_optimizers)                     │
immich_machine_learning  |                              │    420 │   │   except (ValueError, RuntimeError │
immich_machine_learning  |                              │    421 │   │   │   if self._enable_fallback:    │
immich_machine_learning  |                              │    422 │   │   │   │   try:                     │
immich_machine_learning  |                              │                                                 │
immich_machine_learning  |                              │ /opt/venv/lib/python3.10/site-packages/onnxrunt │
immich_machine_learning  |                              │ ime/capi/onnxruntime_inference_collection.py:48 │
immich_machine_learning  |                              │ 3 in _create_inference_session                  │
immich_machine_learning  |                              │                                                 │
immich_machine_learning  |                              │    480 │   │   │   disabled_optimizers = set(di │
immich_machine_learning  |                              │    481 │   │                                    │
immich_machine_learning  |                              │    482 │   │   # initialize the C++ InferenceSe │
immich_machine_learning  |                              │ ❱  483 │   │   sess.initialize_session(provider │
immich_machine_learning  |                              │    484 │   │                                    │
immich_machine_learning  |                              │    485 │   │   self._sess = sess                │
immich_machine_learning  |                              │    486 │   │   self._sess_options = self._sess. │
immich_machine_learning  |                              ╰─────────────────────────────────────────────────╯
immich_machine_learning  |                              RuntimeException: [ONNXRuntimeError] : 6 :         
immich_machine_learning  |                              RUNTIME_EXCEPTION : Encountered unknown exception  
immich_machine_learning  |                              in Initialize()                                    
immich_machine_learning  | [05/14/24 18:24:59] INFO     Loading facial recognition model 'buffalo_l' to    
immich_machine_learning  |                              memory                                             
immich_microservices     | [Nest] 6  - 05/14/2024, 6:25:00 PM   ERROR [ImmichMicroservices] [JobService] Unable to run job handler (smartSearch/smart-search): Error: Machine learning request for clip failed with status 500: Internal Server Error
immich_microservices     | [Nest] 6  - 05/14/2024, 6:25:00 PM   ERROR [ImmichMicroservices] [JobService] Error: Machine learning request for clip failed with status 500: Internal Server Error
immich_microservices     |     at MachineLearningRepository.predict (/usr/src/app/dist/repositories/machine-learning.repository.js:23:19)
immich_microservices     |     at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
immich_microservices     |     at async SmartInfoService.handleEncodeClip (/usr/src/app/dist/services/smart-info.service.js:85:31)
immich_microservices     |     at async /usr/src/app/dist/services/job.service.js:149:36
immich_microservices     |     at async Worker.processJob (/usr/src/app/node_modules/bullmq/dist/cjs/classes/worker.js:394:28)
immich_microservices     |     at async Worker.retryIfFailed (/usr/src/app/node_modules/bullmq/dist/cjs/classes/worker.js:581:24)
immich_microservices     | [Nest] 6  - 05/14/2024, 6:25:00 PM   ERROR [ImmichMicroservices] [JobService] Object:
immich_microservices     | {
immich_microservices     |   "id": "b5bd0dc0-d6c7-4133-8a6c-59fd9dfe7e4c",
immich_microservices     |   "source": "upload"
immich_microservices     | }
immich_microservices     | 
immich_machine_learning  | 2024-05-14 18:25:00.970047176 [E:onnxruntime:, inference_session.cc:1985 Initialize] Encountered unknown exception in Initialize()
immich_machine_learning  | [05/14/24 18:25:00] ERROR    Exception in ASGI application                      
immich_machine_learning  |                                                                                 
immich_machine_learning  |                              ╭─────── Traceback (most recent call last) ───────╮
immich_machine_learning  |                              │ /usr/src/app/main.py:116 in predict             │
immich_machine_learning  |                              │                                                 │
immich_machine_learning  |                              │   113 │   except orjson.JSONDecodeError:        │
immich_machine_learning  |                              │   114 │   │   raise HTTPException(400, f"Invali │
immich_machine_learning  |                              │   115 │                                         │
immich_machine_learning  |                              │ ❱ 116 │   model = await load(await model_cache. │
immich_machine_learning  |                              │       ttl=settings.model_ttl, **kwargs))        │
immich_machine_learning  |                              │   117 │   model.configure(**kwargs)             │
immich_machine_learning  |                              │   118 │   outputs = await run(model.predict, in │
immich_machine_learning  |                              │   119 │   return ORJSONResponse(outputs)        │
immich_machine_learning  |                              │                                                 │
immich_machine_learning  |                              │ /usr/src/app/main.py:137 in load                │
immich_machine_learning  |                              │                                                 │
immich_machine_learning  |                              │   134 │   │   │   model.load()                  │
immich_machine_learning  |                              │   135 │                                         │
immich_machine_learning  |                              │   136 │   try:                                  │
immich_machine_learning  |                              │ ❱ 137 │   │   await run(_load, model)           │
immich_machine_learning  |                              │   138 │   │   return model                      │
immich_machine_learning  |                              │   139 │   except (OSError, InvalidProtobuf, Bad │
immich_machine_learning  |                              │   140 │   │   log.warning(                      │
immich_machine_learning  |                              │                                                 │
immich_machine_learning  |                              │ /usr/src/app/main.py:125 in run                 │
immich_machine_learning  |                              │                                                 │
immich_machine_learning  |                              │   122 async def run(func: Callable[..., Any], i │
immich_machine_learning  |                              │   123 │   if thread_pool is None:               │
immich_machine_learning  |                              │   124 │   │   return func(inputs)               │
immich_machine_learning  |                              │ ❱ 125 │   return await asyncio.get_running_loop │
immich_machine_learning  |                              │   126                                           │
immich_machine_learning  |                              │   127                                           │
immich_machine_learning  |                              │   128 async def load(model: InferenceModel) ->  │
immich_machine_learning  |                              │                                                 │
immich_machine_learning  |                              │ /usr/lib/python3.10/concurrent/futures/thread.p │
immich_machine_learning  |                              │ y:58 in run                                     │
immich_machine_learning  |                              │                                                 │
immich_machine_learning  |                              │ /usr/src/app/main.py:134 in _load               │
immich_machine_learning  |                              │                                                 │
immich_machine_learning  |                              │   131 │                                         │
immich_machine_learning  |                              │   132 │   def _load(model: InferenceModel) -> N │
immich_machine_learning  |                              │   133 │   │   with lock:                        │
immich_machine_learning  |                              │ ❱ 134 │   │   │   model.load()                  │
immich_machine_learning  |                              │   135 │                                         │
immich_machine_learning  |                              │   136 │   try:                                  │
immich_machine_learning  |                              │   137 │   │   await run(_load, model)           │
immich_machine_learning  |                              │                                                 │
immich_machine_learning  |                              │ /usr/src/app/models/base.py:52 in load          │
immich_machine_learning  |                              │                                                 │
immich_machine_learning  |                              │    49 │   │   │   return                        │
immich_machine_learning  |                              │    50 │   │   self.download()                   │
immich_machine_learning  |                              │    51 │   │   log.info(f"Loading {self.model_ty │
immich_machine_learning  |                              │       to memory")                               │
immich_machine_learning  |                              │ ❱  52 │   │   self._load()                      │
immich_machine_learning  |                              │    53 │   │   self.loaded = True                │
immich_machine_learning  |                              │    54 │                                         │
immich_machine_learning  |                              │    55 │   def predict(self, inputs: Any, **mode │
immich_machine_learning  |                              │                                                 │
immich_machine_learning  |                              │ /usr/src/app/models/facial_recognition.py:30 in │
immich_machine_learning  |                              │ _load                                           │
immich_machine_learning  |                              │                                                 │
immich_machine_learning  |                              │   27 │   │   super().__init__(clean_name(model_ │
immich_machine_learning  |                              │   28 │                                          │
immich_machine_learning  |                              │   29 │   def _load(self) -> None:               │
immich_machine_learning  |                              │ ❱ 30 │   │   self.det_model = RetinaFace(sessio │
immich_machine_learning  |                              │   31 │   │   self.rec_model = ArcFaceONNX(      │
immich_machine_learning  |                              │   32 │   │   │   self.rec_file.with_suffix(".on │
immich_machine_learning  |                              │   33 │   │   │   session=self._make_session(sel │
immich_machine_learning  |                              │                                                 │
immich_machine_learning  |                              │ /usr/src/app/models/base.py:117 in              │
immich_machine_learning  |                              │ _make_session                                   │
immich_machine_learning  |                              │                                                 │
immich_machine_learning  |                              │   114 │   │   │   case ".armnn":                │
immich_machine_learning  |                              │   115 │   │   │   │   session = AnnSession(mode │
immich_machine_learning  |                              │   116 │   │   │   case ".onnx":                 │
immich_machine_learning  |                              │ ❱ 117 │   │   │   │   session = ort.InferenceSe │
immich_machine_learning  |                              │   118 │   │   │   │   │   model_path.as_posix() │
immich_machine_learning  |                              │   119 │   │   │   │   │   sess_options=self.ses │
immich_machine_learning  |                              │   120 │   │   │   │   │   providers=self.provid │
immich_machine_learning  |                              │                                                 │
immich_machine_learning  |                              │ /opt/venv/lib/python3.10/site-packages/onnxrunt │
immich_machine_learning  |                              │ ime/capi/onnxruntime_inference_collection.py:41 │
immich_machine_learning  |                              │ 9 in __init__                                   │
immich_machine_learning  |                              │                                                 │
immich_machine_learning  |                              │    416 │   │   disabled_optimizers = kwargs["di │
immich_machine_learning  |                              │        kwargs else None                         │
immich_machine_learning  |                              │    417 │   │                                    │
immich_machine_learning  |                              │    418 │   │   try:                             │
immich_machine_learning  |                              │ ❱  419 │   │   │   self._create_inference_sessi │
immich_machine_learning  |                              │        disabled_optimizers)                     │
immich_machine_learning  |                              │    420 │   │   except (ValueError, RuntimeError │
immich_machine_learning  |                              │    421 │   │   │   if self._enable_fallback:    │
immich_machine_learning  |                              │    422 │   │   │   │   try:                     │
immich_machine_learning  |                              │                                                 │
immich_machine_learning  |                              │ /opt/venv/lib/python3.10/site-packages/onnxrunt │
immich_machine_learning  |                              │ ime/capi/onnxruntime_inference_collection.py:48 │
immich_machine_learning  |                              │ 3 in _create_inference_session                  │
immich_machine_learning  |                              │                                                 │
immich_machine_learning  |                              │    480 │   │   │   disabled_optimizers = set(di │
immich_machine_learning  |                              │    481 │   │                                    │
immich_machine_learning  |                              │    482 │   │   # initialize the C++ InferenceSe │
immich_machine_learning  |                              │ ❱  483 │   │   sess.initialize_session(provider │
immich_machine_learning  |                              │    484 │   │                                    │
immich_machine_learning  |                              │    485 │   │   self._sess = sess                │
immich_machine_learning  |                              │    486 │   │   self._sess_options = self._sess. │
immich_machine_learning  |                              ╰─────────────────────────────────────────────────╯
immich_machine_learning  |                              RuntimeException: [ONNXRuntimeError] : 6 :         
immich_machine_learning  |                              RUNTIME_EXCEPTION : Encountered unknown exception  
immich_machine_learning  |                              in Initialize()                                    
immich_microservices     | [Nest] 6  - 05/14/2024, 6:25:01 PM   ERROR [ImmichMicroservices] [JobService] Unable to run job handler (faceDetection/face-detection): Error: Machine learning request for facial recognition failed with status 500: Internal Server Error
immich_microservices     | [Nest] 6  - 05/14/2024, 6:25:01 PM   ERROR [ImmichMicroservices] [JobService] Error: Machine learning request for facial recognition failed with status 500: Internal Server Error
immich_microservices     |     at MachineLearningRepository.predict (/usr/src/app/dist/repositories/machine-learning.repository.js:23:19)
immich_microservices     |     at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
immich_microservices     |     at async PersonService.handleDetectFaces (/usr/src/app/dist/services/person.service.js:269:23)
immich_microservices     |     at async /usr/src/app/dist/services/job.service.js:149:36
immich_microservices     |     at async Worker.processJob (/usr/src/app/node_modules/bullmq/dist/cjs/classes/worker.js:394:28)
immich_microservices     |     at async Worker.retryIfFailed (/usr/src/app/node_modules/bullmq/dist/cjs/classes/worker.js:581:24)
immich_microservices     | [Nest] 6  - 05/14/2024, 6:25:01 PM   ERROR [ImmichMicroservices] [JobService] Object:
immich_microservices     | {
immich_microservices     |   "id": "b5bd0dc0-d6c7-4133-8a6c-59fd9dfe7e4c",
immich_microservices     |   "source": "upload"
immich_microservices     | }
immich_microservices     | 

@Snuupy
Copy link

Snuupy commented May 14, 2024

I got it working, give me a bit to upload the image and do a writeup :) Thanks @mertalev for the help!

@Snuupy
Copy link

Snuupy commented May 14, 2024

Want to use my image?

In your docker-compose.yml, replace

image: ghcr.io/immich-app/immich-machine-learning:${IMMICH_VERSION:-release}-openvino with
image: ghcr.io/snuupy/immich-machine-learning:v1.105.0-openvino

https://github.com/Snuupy/immich/pkgs/container/immich-machine-learning

Want to build your own image? Here's how I did it:

install poetry, change onnxruntime-openvino to target 1.15 or 1.16 in the pyproject.toml file, then run poetry lock --no-update

[tool.poetry.group.openvino.dependencies]
# onnxruntime-openvino = "^1.17.1"
onnxruntime-openvino = ">=1.15.0,<1.16.0"

In the machine-learning/Dockerfile, change the line:

FROM openvino/ubuntu22_runtime:2023.3.0@sha256:176646df619032ea6c10faf842867119c393e7497b7f88b5e307e932a0fd5aa8 as builder-openvino (v1.105.0)

to FROM openvino/ubuntu22_runtime:2023.1.0@sha256:002842a9005ba01543b7169ff6f14ecbec82287f09c4d1dd37717f0a8e8754a7 as builder-openvino (v1.98.2)

then do a
docker build --build-arg="DEVICE=openvino" -t NAMESPACE/immich-machine-learning:v1.105.0-openvino .

@jsapede
Copy link

jsapede commented May 15, 2024

tested this morning seems to work, its scrapping !

@engels0n
Copy link

Nice ! Thank you @Snuupy

@alextran1502 can you merge it into the next version, please? ;)

@Snuupy
Copy link

Snuupy commented Jul 8, 2024

Yes.

root@snuminipc:~/immich# uname -r
6.8.0-36-generic

for me:

105: working
105.1: working
106.4: not working

let me look at what commits were between 105.1 and 106.4...

I'll try again with env vars removed, maybe new onnxruntime -> no need for env vars

Edit: I removed the env vars and it stopped compiling forever, I get these in logs and smart search is broken now.

immich_machine_learning  | [07/08/24 17:45:10] INFO     Downloading visual model 'ViT-B-32__openai'. This  
immich_machine_learning  |                              may take a while.                                  
immich_machine_learning  | /opt/venv/lib/python3.10/site-packages/huggingface_hub/file_download.py:1194: UserWarning: `local_dir_use_symlinks` parameter is deprecated and will be ignored. The process to download files to a local folder has been updated and do not rely on symlinks anymore. You only need to pass a destination folder as`local_dir`.
immich_machine_learning  | For more details, check out https://huggingface.co/docs/huggingface_hub/main/en/guides/download#download-files-to-local-folder.
immich_machine_learning  |   warnings.warn(
immich_server            | [Nest] 7  - 07/08/2024, 5:45:15 PM     LOG [Microservices:MediaService] Successfully generated JPEG image preview for asset 0fceb6e7-1281-451d-8553-6fccadddbca4
immich_server            | [Nest] 7  - 07/08/2024, 5:45:15 PM     LOG [Microservices:MediaService] Successfully generated WEBP image thumbnail for asset 0fceb6e7-1281-451d-8553-6fccadddbca4
Fetching 11 files: 100%|██████████| 11/11 [00:16<00:00,  1.46s/it]
immich_machine_learning  | [07/08/24 17:45:27] INFO     Attempt #2 to load visual model 'ViT-B-32__openai' 
immich_machine_learning  |                              to memory                                          
immich_machine_learning  | [07/08/24 17:45:27] INFO     Setting execution providers to                     
immich_machine_learning  |                              ['OpenVINOExecutionProvider',                      
immich_machine_learning  |                              'CPUExecutionProvider'], in descending order of    
immich_machine_learning  |                              preference                                         
immich_machine_learning  | 2024-07-08 17:45:27.463828333 [W:onnxruntime:Default, openvino_provider_factory.cc:111 CreateExecutionProviderFactory] [OpenVINO] Selected 'device_type' GPU_FP32 is deprecated. 
immich_machine_learning  | Update the 'device_type' to specified types 'CPU', 'GPU', 'GPU.0', 'GPU.1', 'NPU' or from HETERO/MULTI/AUTO options and set 'precision' separately. 
immich_machine_learning  | 
immich_machine_learning  | In the OpenVINO EP
immich_machine_learning  | Model is fully supported on OpenVINO
immich_machine_learning  | CreateNgraphFunc
immich_server            | [Nest] 17  - 07/08/2024, 5:46:47 PM     LOG [Api:EventRepository] Websocket Disconnect: 2MKFnsNyU-iL5_axAAAJ
immich_server            | [Nest] 17  - 07/08/2024, 5:46:49 PM     LOG [Api:EventRepository] Websocket Connect:    DbsJUz6vJ4IjyG_qAAAL
immich_machine_learning  | [07/08/24 17:47:06] INFO     Attempt #2 to load detection model 'buffalo_l' to  
immich_machine_learning  |                              memory                                             
immich_machine_learning  | [07/08/24 17:47:06] INFO     Setting execution providers to                     
immich_machine_learning  |                              ['OpenVINOExecutionProvider',                      
immich_machine_learning  |                              'CPUExecutionProvider'], in descending order of    
immich_machine_learning  |                              preference                                         
immich_machine_learning  | 2024-07-08 17:47:06.203039789 [W:onnxruntime:Default, openvino_provider_factory.cc:111 CreateExecutionProviderFactory] [OpenVINO] Selected 'device_type' GPU_FP32 is deprecated. 
immich_machine_learning  | Update the 'device_type' to specified types 'CPU', 'GPU', 'GPU.0', 'GPU.1', 'NPU' or from HETERO/MULTI/AUTO options and set 'precision' separately. 
immich_machine_learning  | 
immich_machine_learning  | In the OpenVINO EP
immich_machine_learning  | Model is fully supported on OpenVINO
immich_machine_learning  | CreateNgraphFunc
immich_machine_learning  | Inference successful
immich_machine_learning  | Inference successful
immich_machine_learning  | Inference successful
immich_machine_learning  | [07/08/24 17:47:27] INFO     Attempt #2 to load recognition model 'buffalo_l' to
immich_machine_learning  |                              memory                                             
immich_machine_learning  | [07/08/24 17:47:27] INFO     Setting execution providers to                     
immich_machine_learning  |                              ['OpenVINOExecutionProvider',                      
immich_machine_learning  |                              'CPUExecutionProvider'], in descending order of    
immich_machine_learning  |                              preference                                         
immich_machine_learning  | 2024-07-08 17:47:28.037891755 [W:onnxruntime:Default, openvino_provider_factory.cc:111 CreateExecutionProviderFactory] [OpenVINO] Selected 'device_type' GPU_FP32 is deprecated. 
immich_machine_learning  | Update the 'device_type' to specified types 'CPU', 'GPU', 'GPU.0', 'GPU.1', 'NPU' or from HETERO/MULTI/AUTO options and set 'precision' separately. 
immich_machine_learning  | 
immich_machine_learning  | In the OpenVINO EP
immich_machine_learning  | Model is fully supported on OpenVINO
immich_machine_learning  | CreateNgraphFunc
immich_machine_learning  | mimalloc: warning: mi_usable_size: pointer might not point to a valid heap region: 0x7cd51c020080
immich_machine_learning  | (this may still be a valid very large allocation (over 64MiB))
immich_machine_learning  | mimalloc: warning: (yes, the previous pointer 0x7cd51c020080 was valid after all)
immich_machine_learning  | mimalloc: warning: mi_usable_size: pointer might not point to a valid heap region: 0x7cd51c020080
immich_machine_learning  | (this may still be a valid very large allocation (over 64MiB))
immich_machine_learning  | mimalloc: warning: (yes, the previous pointer 0x7cd51c020080 was valid after all)
immich_machine_learning  | mimalloc: warning: mi_usable_size: pointer might not point to a valid heap region: 0x7cd51c030080
immich_machine_learning  | (this may still be a valid very large allocation (over 64MiB))
immich_machine_learning  | mimalloc: warning: (yes, the previous pointer 0x7cd51c030080 was valid after all)
immich_machine_learning  | mimalloc: warning: mi_usable_size: pointer might not point to a valid heap region: 0x7cd51c030080
immich_machine_learning  | (this may still be a valid very large allocation (over 64MiB))
immich_machine_learning  | mimalloc: warning: (yes, the previous pointer 0x7cd51c030080 was valid after all)
immich_machine_learning  | mimalloc: warning: mi_free: pointer might not point to a valid heap region: 0x7cd51c020080
immich_machine_learning  | (this may still be a valid very large allocation (over 64MiB))
immich_machine_learning  | mimalloc: warning: (yes, the previous pointer 0x7cd51c020080 was valid after all)
immich_machine_learning  | mimalloc: warning: mi_free: pointer might not point to a valid heap region: 0x7cd51c030080
immich_machine_learning  | (this may still be a valid very large allocation (over 64MiB))
immich_machine_learning  | mimalloc: warning: (yes, the previous pointer 0x7cd51c030080 was valid after all)
immich_machine_learning  | mimalloc: warning: mi_usable_size: pointer might not point to a valid heap region: 0x7cd520020080
immich_machine_learning  | (this may still be a valid very large allocation (over 64MiB))
immich_machine_learning  | mimalloc: warning: (yes, the previous pointer 0x7cd520020080 was valid after all)
immich_machine_learning  | mimalloc: warning: mi_usable_size: pointer might not point to a valid heap region: 0x7cd520020080
immich_machine_learning  | (this may still be a valid very large allocation (over 64MiB))
immich_machine_learning  | mimalloc: warning: (yes, the previous pointer 0x7cd520020080 was valid after all)
immich_machine_learning  | mimalloc: warning: mi_usable_size: pointer might not point to a valid heap region: 0x7cd520030080
immich_machine_learning  | (this may still be a valid very large allocation (over 64MiB))
immich_machine_learning  | Inference successful
immich_machine_learning  | Inference successful

Edit 2: I re-ran the facial recognition (a 2nd? 3rd? time) and now the face clusters show up under Explore but smart search like searching for a "car" still is broken, I get nonsense results (I used to get pictures/videos of a car), let me try to clear model cache and see if that fixes anything...

Edit 3: nope, smart search still broken. Facial detection works. Any other ideas to try?

@mertalev
Copy link
Contributor

Interesting that the env vars were causing that issue for you. Two ideas:

  1. Add ARG DEVICE under FROM prod-${DEVICE} as prod. I think mimalloc is still getting preloaded because the DEVICE env ends up being empty instead of openvino.
  2. Change the Dockerfile to not install mimalloc at all. (Try if 1 does not work).

@Snuupy
Copy link

Snuupy commented Jul 10, 2024

now it says:

immich_server            | [Nest] 17  - 07/10/2024, 7:15:00 PM     LOG [Api:EventRepository] Websocket Connect:    XV43qzMRiDTAsVrCAAAF
immich_machine_learning  | Inference successful

but this is not true, the smart search results are non-sensical

it returns results, but they are bogus (and the same) results each time

@mertalev
Copy link
Contributor

but this is not true, the smart search results are non-sensical

It's true, it's just that the compiled OpenVINO model probably has a mistake that makes it produce different outputs.

Was smart search working well in 105.1?

Does face detection behave any differently with mimalloc removed?

@Snuupy
Copy link

Snuupy commented Jul 10, 2024

It's true, it's just that the compiled OpenVINO model probably has a mistake that makes it produce different outputs.

Ah. Is there a way for us to fix it?

Was smart search working well in 105.1?

Yes. When I switch back to cpu I get correct results. What is the fix for this?

Does face detection behave any differently with mimalloc removed?

I only did 1) (setting ARG DEVICE), haven't really tested it actually

@mertalev
Copy link
Contributor

Ah. Is there a way for us to fix it?

There are a few things we can try, but it's ultimately up to OpenVINO. I have some modified models with shape inference and static dimensions lying around that could make it easier for it OpenVINO to know how the model should work. Let me see if I can link one for you to try.

@kaivol
Copy link

kaivol commented Jul 13, 2024

Wanted to chime to confirm that the changes by @Snuupy fixed OpenVINO for me, thank you very much!
(I built the image myself because the latest published image doesn't seem to be up to date (?))

@mertalev
Copy link
Contributor

Oh, that's really interesting! Could you share:

  • Do both smart search and face detection work?
  • Are the results good / the same as CPU?
  • What processor do you have?
  • Was only face detection failing for you before, or was smart search also failing?
  • What's the version of your kernel?

@Snuupy
Copy link

Snuupy commented Jul 13, 2024

Wanted to chime to confirm that the changes by @Snuupy fixed OpenVINO for me, thank you very much! (I built the image myself because the latest published image doesn't seem to be up to date (?))

sorry, was testing a bunch of changes so the code and docker image are out of sync (I went as far as trying to revert back to a specific commit and applying all my changes on top again, but I didn't realize I also had to build the server image and ran out of time on my end).

can you please test smart search? that was still broken for me. try to search for a car or something.

@kaivol
Copy link

kaivol commented Jul 14, 2024

* Do both smart search and face detection work?
* Are the results good / the same as CPU?

Update: Without OpenVINO, significantly more faces are found. Also Smart Search seems to work.

Smart search doesn't really seem to work: Queries like 'beach' or 'grass' return plausible result, but more specific queries (e.g. 'desk') do not.
But I'm also not sure what level of quality I can expect here.

Face detection results look reasonably good, though some obvious images are missing.

I will try without OpenVINO and report whether the results are different.

I'm using the XLM-Roberta-Large-Vit-B-16Plus and buffalo_l images, fyi.

* What processor do you have?

Intel Pentium G4600

* Was only face detection failing for you before, or was smart search also failing?

I'm not sure about that, I tried different versions of Immich with and without OpenVINO acceleration every now and then.

* What's the version of your kernel?

5.15.0-112-generic
I'm running Immich via podman, in case that makes a difference.


Also, I noticed that pressing the MISSING button in the Smart Search category always reruns recognition on all (or at least most of my) images, is this expected behavior or an error in my setup?

And a last remark: I also got errors as reported here, not sure if this is relevant.

@Snuupy
Copy link

Snuupy commented Jul 18, 2024

Smart search doesn't really seem to work: Queries like 'beach' or 'grass' return plausible result, but more specific queries (e.g. 'desk') do not. But I'm also not sure what level of quality I can expect here.

yeah smart search is broken, it's quite obvious when it's working

searching for car gets you a car, receipt gets you receipts, a sign gets you a sign, etc.

@kaivol
Copy link

kaivol commented Jul 21, 2024

Just FYI, face detection works works for me with onnxruntime-openvino = "^1.18.0" and openvino/ubuntu22_runtime:2024.1 (see here).

@mertalev
Copy link
Contributor

I upgraded main to use the latest onnxruntime-openvino and made some changes to how the OpenVINO image is built. Testing with a 155H processor, I can confirm face detection returns the right results and performs well (roughly 3x faster than CPU in my case).

Search produces very wrong model outputs as mentioned by others. After trying a few things, changing the models to have static dimensions gives the expected results. I'll upload revised models to address this for now and let y'all know when they're up.

@djjudas21
Copy link

As someone who is an experienced kubernetes engineer but who knows absolutely nothing about AI/ML models, I just wanted to say thanks all for your continued knowledge and effort on this issue. I appreciate it ☺️👍

@mertalev
Copy link
Contributor

mertalev commented Jul 23, 2024

New search models are up! You can delete your model cache volume to make it download the updated models. This only fixes smart search being inaccurate, though - face detection still needs an image with the above changes (or main) until the next release. Let me know if you still have issues!

@w00tlarr
Copy link

New search models are up! You can delete your model cache volume to make it download the updated models. This only fixes smart search being inaccurate, though - face detection still needs an image with the above changes (or main) until the next release. Let me know if you still have issues!

Awesome news!! Much appreciated and a long time coming. Is there a PR image that I can use to test this out?

@mertalev
Copy link
Contributor

This image is pinned so it won't update with main: ghcr.io/immich-app/immich-machine-learning:main-openvino@sha256:fb55668b598823f3101174ae3f7e6a1911a894523cc93f69fbafe86a175ebea4

@XiaoranQingxue
Copy link

After I updated the latest "CLIP" model (I used "XLM-Roberta-Large-Vit-B-16Plus"), the recognition was twice as slow,Using a "UHD730", Is this an inevitable problem?

@krishne35
Copy link

krishne35 commented Jul 23, 2024

After I updated the latest "CLIP" model (I used "XLM-Roberta-Large-Vit-B-16Plus"), the recognition was twice as slow,Using a "UHD730", Is this an inevitable problem?

+1
But I'm using i7 6700T

@mertalev
Copy link
Contributor

After I updated the latest "CLIP" model (I used "XLM-Roberta-Large-Vit-B-16Plus"), the recognition was twice as slow,Using a "UHD730", Is this an inevitable problem?

The performance will depend heavily on how good the processor's iGPU is relative to the CPU. Can you confirm that the results are correct / same as CPU?

@mertalev
Copy link
Contributor

Can you clarify if you mean searching is slower than on CPU, or if processing jobs is slower? I have an idea if it's the latter.

@XiaoranQingxue
Copy link

I'm sorry. Maybe I wasn't clear enough.

Using "postman", using the same image, test "visual" and "textual" many times, averaging the response time

old model - visual
commit:3ec6422
latest model - visual
commit:02aad7a
old model - textual latest model - textual
CPU(12300T) 325ms 330ms 240ms 240ms
iGPU(UHD730) 270ms 607ms 190ms 190ms

Here are the test results in my current environment, and 607ms is "obtrusive"

@XiaoranQingxue
Copy link

XiaoranQingxue commented Jul 24, 2024

After I updated the latest "CLIP" model (I used "XLM-Roberta-Large-Vit-B-16Plus"), the recognition was twice as slow,Using a "UHD730", Is this an inevitable problem?

The performance will depend heavily on how good the processor's iGPU is relative to the CPU. Can you confirm that the results are correct / same as CPU?

I only tested "car" and "车", and both models returned the same results using CPU and iGPU (at least from the retrieved photos).

@mertalev
Copy link
Contributor

mertalev commented Jul 24, 2024

Thanks, that chart is very helpful. It does seem like the XLM visual model is worse than before. I'm curious how many models this affects; the default is fine, at least. It might be specific to M-CLIP models like this one, or it could possibly affect larger visual models in general.

ViT-B-32__openai

old model+image - visual new model+image - visual old model+image - textual new model+image - textual
CPU (155H) 70ms 70ms 40ms 40ms
iGPU (Arc) 85ms 35ms 55ms 15ms

XLM-Roberta-Large-Vit-B-16Plus

old model+image - visual new model+image - visual old model+image - textual new model+image - textual
CPU (155H) 270ms 280ms 230ms 230ms
iGPU (Arc) 165ms 375ms 135ms 55ms

@w00tlarr
Copy link

:-(

Hi, seem ghcr.io/immich-app/immich-machine-learning:main-openvino@sha256:fb55668b598823f3101174ae3f7e6a1911a894523cc93f69fbafe86a175ebea4 is not available.

So I tried using the latest main-openvino image from today...

Seems I can't load clip model... I haven't been using the OpenVino image for quite some time since it was broken from 1.99.0.
Just checked and this also happens with the release version too.

_immich_machine_learning_logs.txt

@mertalev
Copy link
Contributor

I'm sorry. Maybe I wasn't clear enough.

Using "postman", using the same image, test "visual" and "textual" many times, averaging the response time
old model - visual
commit:3ec6422 latest model - visual
commit:02aad7a old model - textual latest model - textual
CPU(12300T) 325ms 330ms 240ms 240ms
iGPU(UHD730) 270ms 607ms 190ms 190ms

Here are the test results in my current environment, and 607ms is "obtrusive"

I made an issue for this here. My guess is that it's doing an optimization that ends up slowing down the model. I don't think this is really an Immich issue, though.

@mertalev
Copy link
Contributor

:-(

Hi, seem ghcr.io/immich-app/immich-machine-learning:main-openvino@sha256:fb55668b598823f3101174ae3f7e6a1911a894523cc93f69fbafe86a175ebea4 is not available.

So I tried using the latest main-openvino image from today...

Seems I can't load clip model... I haven't been using the OpenVino image for quite some time since it was broken from 1.99.0. Just checked and this also happens with the release version too.

_immich_machine_learning_logs.txt

Could you share more about the server environment, like distro, kernel version, etc.? If it's Ubuntu, you can try installing linux-generic-hwe-24.04 (replacing the end with the relevant version). OpenVINO recommends kernel 6.2 or newer with the intel-i915-dkms driver.

@w00tlarr
Copy link

w00tlarr commented Jul 27, 2024

:-(
Hi, seem ghcr.io/immich-app/immich-machine-learning:main-openvino@sha256:fb55668b598823f3101174ae3f7e6a1911a894523cc93f69fbafe86a175ebea4 is not available.
So I tried using the latest main-openvino image from today...
Seems I can't load clip model... I haven't been using the OpenVino image for quite some time since it was broken from 1.99.0. Just checked and this also happens with the release version too.
_immich_machine_learning_logs.txt

Could you share more about the server environment, like distro, kernel version, etc.? If it's Ubuntu, you can try installing linux-generic-hwe-24.04 (replacing the end with the relevant version). OpenVINO recommends kernel 6.2 or newer with the intel-i915-dkms driver.


It worked today using this:
immich-machine-learning:
container_name: immich_machine_learning
image: ghcr.io/immich-app/immich-machine-learning:main-openvino
device_cgroup_rules:
- "c 189:* rmw"
devices:
- /dev/dri:/dev/dri # If using Openvino
privileged: true
volumes:
- /dev/bus/usb:/dev/bus/usb
- /mnt/immich/data:/cache
env_file:
- stack.env
environment:
- NODE_ENV=production
- LD_LIBRARY_PATH=/usr/lib/x86_64-linux-gnu/dri #If using VAAPI
- LIBVA_DRIVER_NAME=iHD # If using VAAPI
- MACHINE_LEARNING_WORKER_TIMEOUT=300
- MACHINE_LEARNING_PRELOAD__FACIAL_RECOGNITION=buffalo_l
- MACHINE_LEARNING_PRELOAD__CLIP=ViT-B-32__openai
depends_on:
- immich-redis
- immich-database
labels:
- "com.centurylinklabs.watchtower.scope=immich"
restart: unless-stopped

===
My actual setup is N100 (Beelink S12 Pro)
Proxmox 8.1 with kernel 6.5.13-5-pve with SR-IOV vGPU splits
LXC Debian 12 w/Docker (Privileged)
Immich 1.110 (just updated today) deployed via Portainer Stack

Works now with the main-openvino image!

@mertalev
Copy link
Contributor

Awesome! With that, I think we can close this issue at this point.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests