mirror of
https://github.com/blakeblackshear/frigate.git
synced 2026-02-15 07:35:27 +03:00
Handle larger images
This commit is contained in:
parent
0c5d4c7319
commit
acfacaaa5d
@ -193,6 +193,17 @@ class GenericONNXEmbedding:
|
||||
raise ValueError("Face embedding does not support batch inputs.")
|
||||
|
||||
pil = self._process_image(raw_inputs)
|
||||
|
||||
# handle images larger than input size
|
||||
width, height = pil.size
|
||||
if width > 112 or height > 112:
|
||||
if width > height:
|
||||
new_height = int(((width / height) * 112) // 4 * 4)
|
||||
pil = pil.resize((112, new_height))
|
||||
else:
|
||||
new_width = int(((height / width) * 112) // 4 * 4)
|
||||
pil = pil.resize((new_width, 112))
|
||||
|
||||
og = np.array(pil).astype(np.float32)
|
||||
|
||||
# Image must be 112x112
|
||||
|
||||
@ -26,7 +26,7 @@ from frigate.events.types import EventTypeEnum
|
||||
from frigate.genai import get_genai_client
|
||||
from frigate.models import Event
|
||||
from frigate.util.builtin import serialize
|
||||
from frigate.util.image import SharedMemoryFrameManager, calculate_region, area
|
||||
from frigate.util.image import SharedMemoryFrameManager, area, calculate_region
|
||||
|
||||
from .embeddings import Embeddings
|
||||
|
||||
@ -318,7 +318,10 @@ class EmbeddingMaintainer(threading.Thread):
|
||||
face_box = face.get("box")
|
||||
|
||||
# check that face is valid
|
||||
if not face_box or area(face_box) < self.config.semantic_search.face_recognition.min_area:
|
||||
if (
|
||||
not face_box
|
||||
or area(face_box) < self.config.semantic_search.face_recognition.min_area
|
||||
):
|
||||
return
|
||||
|
||||
face_frame = cv2.cvtColor(frame, cv2.COLOR_YUV2BGR_I420)
|
||||
|
||||
Loading…
Reference in New Issue
Block a user