9 Commits

Author SHA1 Message Date
Yosi Taguri
5e89efba64
fix(ml): handle empty/corrupt images in face detection (#27391)
* fix(ml): handle empty/corrupt images in face detection

When a corrupt or degenerate image with zero-dimension (0 width or 0 height)
reaches the face detection pipeline, insightface's RetinaFace.detect() calls
cv2.resize() with a target size of 0, triggering an OpenCV assertion failure:

  error: (-215:Assertion failed) inv_scale_x > 0 in function 'resize'

This crashes the ML worker and returns a 500 error to the server.

Add an early return in FaceDetector._predict() that checks for zero-dimension
images after decoding and returns empty detection results instead of passing
them to the insightface model.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>

* fix(ml): move empty image validation to request level

Per review feedback, validate image dimensions in the predict endpoint
(returning 400) rather than in each model's _predict method. This
catches all zero-dimension images before they reach any model task.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>

* fix(ml): resolve mypy strict type error in predict endpoint

Use intermediate `decoded` variable so mypy knows `.width` and `.height`
are accessed on `Image`, not on `Image | str`.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>

---------

Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-27 11:14:34 -04:00
Aleksander Pejcic
aaf34fa7d4
feat(ml): enable openvino for cpu (#22948)
* Enable OpenVINO CPU acceleration in Immich

* Remove unnecessary debug log

* Removing checking for device_ids for openvino since cpu will always be available

* Find OpenVINOExecutionProvider index instead of assuming index 0

* Fix openvino tests

* Fix failing test mock. OpenVINO expects provider options, but cuda provide doesn't so use that for mocked tests.

* Support empty provider options in OrtSessions in which case ONNXRuntime will use its own defaults

* Use OpenVINOExecutionProvider for test_sets_provider_options_kwarg

* fix mock

* simplify

* unused variable

---------

Co-authored-by: Aleksander <pejcic@adobe.com>
Co-authored-by: mertalev <101130780+mertalev@users.noreply.github.com>
2026-03-07 18:40:43 +00:00
Mert
35a521c6ec
fix(ml): batch size setting (#26524) 2026-03-05 12:01:47 -05:00
Kishor Prins
dd9046508d
feat: ROCm 7.2 and MIGraphX support (#26178) 2026-02-26 16:52:26 +00:00
Mert
a4ae86ce29
feat(ml): add preload and fp16 settings for ocr (#23576) 2025-11-06 17:55:11 +00:00
Mert
1b62c2ef55
feat(ml): coreml (#17718)
* coreml

* add test

* use arena by default in native installation

* fix tests

* add env to docs

* remove availability envs
2025-10-14 17:51:31 +00:00
Mitchell Pleune
9fd2c5220d
fix: test_sets_default_sess_options fails if compiling with globally enabled cuda (#17516)
Coming from nixos, this test fails when cuda is enabled. https://github.com/NixOS/nixpkgs/pull/382896

Solution as proposed by @mertalev
2025-04-10 13:06:33 -04:00
Mert
6789c2ac19
feat(ml): better multilingual search with nllb models (#13567) 2025-03-31 11:06:57 -04:00
Mert
84c35e35d6
chore(ml): installable package (#17153)
* app -> immich_ml

* fix test ci

* omit file name

* add new line

* add new line
2025-03-27 19:49:09 +00:00