immich icon indicating copy to clipboard operation
immich copied to clipboard

Error in log

Open SanoKriss opened this issue 5 months ago • 2 comments

I have searched the existing issues, both open and closed, to make sure this is not a duplicate report.

  • [x] Yes

The bug

ERROR Exception in ASGI application

                         ╭─────── Traceback (most recent call last) ───────╮
                         │ /usr/src/immich_ml/main.py:177 in predict       │
                         │                                                 │
                         │   174 │   │   inputs = text                     │
                         │   175 │   else:                                 │
                         │   176 │   │   raise HTTPException(400, "Either  │
                         │ ❱ 177 │   response = await run_inference(inputs │
                         │   178 │   return ORJSONResponse(response)       │
                         │   179                                           │
                         │   180                                           │
                         │                                                 │
                         │ /usr/src/immich_ml/main.py:200 in run_inference │
                         │                                                 │
                         │   197 │   │   response[entry["task"]] = output  │
                         │   198 │                                         │
                         │   199 │   without_deps, with_deps = entries     │
                         │ ❱ 200 │   await asyncio.gather(*[_run_inference │
                         │   201 │   if with_deps:                         │
                         │   202 │   │   await asyncio.gather(*[_run_infer │
                         │   203 │   if isinstance(payload, Image):        │
                         │                                                 │
                         │ /usr/src/immich_ml/main.py:195 in               │
                         │ _run_inference                                  │
                         │                                                 │
                         │   192 │   │   │   │   message = f"Task {entry[' │
                         │       output of {dep}"                          │
                         │   193 │   │   │   │   raise HTTPException(400,  │
                         │   194 │   │   model = await load(model)         │
                         │ ❱ 195 │   │   output = await run(model.predict, │
                         │   196 │   │   outputs[model.identity] = output  │
                         │   197 │   │   response[entry["task"]] = output  │
                         │   198                                           │
                         │                                                 │
                         │ /usr/src/immich_ml/main.py:213 in run           │
                         │                                                 │
                         │   210 │   if thread_pool is None:               │
                         │   211 │   │   return func(*args, **kwargs)      │
                         │   212 │   partial_func = partial(func, *args, * │
                         │ ❱ 213 │   return await asyncio.get_running_loop │
                         │   214                                           │
                         │   215                                           │
                         │   216 async def load(model: InferenceModel) ->  │
                         │                                                 │
                         │ /usr/local/lib/python3.11/concurrent/futures/th │
                         │ read.py:58 in run                               │
                         │                                                 │
                         │ /usr/src/immich_ml/models/base.py:61 in predict │
                         │                                                 │
                         │    58 │   │   self.load()                       │
                         │    59 │   │   if model_kwargs:                  │
                         │    60 │   │   │   self.configure(**model_kwargs │
                         │ ❱  61 │   │   return self._predict(*inputs, **m │
                         │    62 │                                         │
                         │    63 │   @abstractmethod                       │
                         │    64 │   def _predict(self, *inputs: Any, **mo │
                         │                                                 │
                         │ /usr/src/immich_ml/models/facial_recognition/de │
                         │ tection.py:30 in _predict                       │
                         │                                                 │
                         │   27 │   def _predict(self, inputs: NDArray[np. │
                         │      FaceDetectionOutput:                       │
                         │   28 │   │   inputs = decode_cv2(inputs)        │
                         │   29 │   │                                      │
                         │ ❱ 30 │   │   bboxes, landmarks = self._detect(i │
                         │   31 │   │   return {                           │
                         │   32 │   │   │   "boxes": bboxes[:, :4].round() │
                         │   33 │   │   │   "scores": bboxes[:, 4],        │
                         │                                                 │
                         │ /usr/src/immich_ml/models/facial_recognition/de │
                         │ tection.py:38 in _detect                        │
                         │                                                 │
                         │   35 │   │   }                                  │
                         │   36 │                                          │
                         │   37 │   def _detect(self, inputs: NDArray[np.u │
                         │      NDArray[np.float32]]:                      │
                         │ ❱ 38 │   │   return self.model.detect(inputs)   │
                         │   39 │                                          │
                         │   40 │   def configure(self, **kwargs: Any) ->  │
                         │   41 │   │   self.model.det_thresh = kwargs.pop │
                         │                                                 │
                         │ /opt/venv/lib/python3.11/site-packages/insightf │
                         │ ace/model_zoo/retinaface.py:220 in detect       │
                         │                                                 │
                         │   217 │   │   │   new_width = input_size[0]     │
                         │   218 │   │   │   new_height = int(new_width *  │
                         │   219 │   │   det_scale = float(new_height) / i │
                         │ ❱ 220 │   │   resized_img = cv2.resize(img, (ne │
                         │   221 │   │   det_img = np.zeros( (input_size[1 │
                         │   222 │   │   det_img[:new_height, :new_width,  │
                         │   223                                           │
                         ╰─────────────────────────────────────────────────╯
                         error: OpenCV(4.11.0)                              
                         /io/opencv/modules/imgproc/src/resize.cpp:4211:    
                         error: (-215:Assertion failed) inv_scale_x > 0 in  
                         function 'resize'                                  

The OS that Immich Server is running on

Ubuntu 24.04.2

Version of Immich Server

v1.134.0

Version of Immich Mobile App

v1.134.0

Platform with the issue

  • [x] Server
  • [ ] Web
  • [ ] Mobile

Your docker-compose.yml content

.

Your .env content

.

Reproduction steps

...

Relevant log output

ERROR    Exception in ASGI application                      
                                                                                
                             ╭─────── Traceback (most recent call last) ───────╮
                             │ /usr/src/immich_ml/main.py:177 in predict       │
                             │                                                 │
                             │   174 │   │   inputs = text                     │
                             │   175 │   else:                                 │
                             │   176 │   │   raise HTTPException(400, "Either  │
                             │ ❱ 177 │   response = await run_inference(inputs │
                             │   178 │   return ORJSONResponse(response)       │
                             │   179                                           │
                             │   180                                           │
                             │                                                 │
                             │ /usr/src/immich_ml/main.py:200 in run_inference │
                             │                                                 │
                             │   197 │   │   response[entry["task"]] = output  │
                             │   198 │                                         │
                             │   199 │   without_deps, with_deps = entries     │
                             │ ❱ 200 │   await asyncio.gather(*[_run_inference │
                             │   201 │   if with_deps:                         │
                             │   202 │   │   await asyncio.gather(*[_run_infer │
                             │   203 │   if isinstance(payload, Image):        │
                             │                                                 │
                             │ /usr/src/immich_ml/main.py:195 in               │
                             │ _run_inference                                  │
                             │                                                 │
                             │   192 │   │   │   │   message = f"Task {entry[' │
                             │       output of {dep}"                          │
                             │   193 │   │   │   │   raise HTTPException(400,  │
                             │   194 │   │   model = await load(model)         │
                             │ ❱ 195 │   │   output = await run(model.predict, │
                             │   196 │   │   outputs[model.identity] = output  │
                             │   197 │   │   response[entry["task"]] = output  │
                             │   198                                           │
                             │                                                 │
                             │ /usr/src/immich_ml/main.py:213 in run           │
                             │                                                 │
                             │   210 │   if thread_pool is None:               │
                             │   211 │   │   return func(*args, **kwargs)      │
                             │   212 │   partial_func = partial(func, *args, * │
                             │ ❱ 213 │   return await asyncio.get_running_loop │
                             │   214                                           │
                             │   215                                           │
                             │   216 async def load(model: InferenceModel) ->  │
                             │                                                 │
                             │ /usr/local/lib/python3.11/concurrent/futures/th │
                             │ read.py:58 in run                               │
                             │                                                 │
                             │ /usr/src/immich_ml/models/base.py:61 in predict │
                             │                                                 │
                             │    58 │   │   self.load()                       │
                             │    59 │   │   if model_kwargs:                  │
                             │    60 │   │   │   self.configure(**model_kwargs │
                             │ ❱  61 │   │   return self._predict(*inputs, **m │
                             │    62 │                                         │
                             │    63 │   @abstractmethod                       │
                             │    64 │   def _predict(self, *inputs: Any, **mo │
                             │                                                 │
                             │ /usr/src/immich_ml/models/facial_recognition/de │
                             │ tection.py:30 in _predict                       │
                             │                                                 │
                             │   27 │   def _predict(self, inputs: NDArray[np. │
                             │      FaceDetectionOutput:                       │
                             │   28 │   │   inputs = decode_cv2(inputs)        │
                             │   29 │   │                                      │
                             │ ❱ 30 │   │   bboxes, landmarks = self._detect(i │
                             │   31 │   │   return {                           │
                             │   32 │   │   │   "boxes": bboxes[:, :4].round() │
                             │   33 │   │   │   "scores": bboxes[:, 4],        │
                             │                                                 │
                             │ /usr/src/immich_ml/models/facial_recognition/de │
                             │ tection.py:38 in _detect                        │
                             │                                                 │
                             │   35 │   │   }                                  │
                             │   36 │                                          │
                             │   37 │   def _detect(self, inputs: NDArray[np.u │
                             │      NDArray[np.float32]]:                      │
                             │ ❱ 38 │   │   return self.model.detect(inputs)   │
                             │   39 │                                          │
                             │   40 │   def configure(self, **kwargs: Any) ->  │
                             │   41 │   │   self.model.det_thresh = kwargs.pop │
                             │                                                 │
                             │ /opt/venv/lib/python3.11/site-packages/insightf │
                             │ ace/model_zoo/retinaface.py:220 in detect       │
                             │                                                 │
                             │   217 │   │   │   new_width = input_size[0]     │
                             │   218 │   │   │   new_height = int(new_width *  │
                             │   219 │   │   det_scale = float(new_height) / i │
                             │ ❱ 220 │   │   resized_img = cv2.resize(img, (ne │
                             │   221 │   │   det_img = np.zeros( (input_size[1 │
                             │   222 │   │   det_img[:new_height, :new_width,  │
                             │   223                                           │
                             ╰─────────────────────────────────────────────────╯
                             error: OpenCV(4.11.0)                              
                             /io/opencv/modules/imgproc/src/resize.cpp:4211:    
                             error: (-215:Assertion failed) inv_scale_x > 0 in  
                             function 'resize'

Additional information

No response

SanoKriss avatar Jun 09 '25 07:06 SanoKriss

Could you provide more context and reproduction steps?

skatsubo avatar Jun 09 '25 21:06 skatsubo

sorry, I just found error in immich log, but immich work fine

SanoKriss avatar Jun 10 '25 17:06 SanoKriss