mirror of
https://github.com/blakeblackshear/frigate.git
synced 2025-08-13 13:47:36 +02:00
Update device to be an override, keep core logic in place if value of device is None.
This commit is contained in:
parent
d00a58c7f2
commit
1667aac581
@ -47,10 +47,10 @@ class SemanticSearchConfig(FrigateBaseModel):
|
||||
model_size: str = Field(
|
||||
default="small", title="The size of the embeddings model used."
|
||||
)
|
||||
device: str = Field(
|
||||
default="CPU",
|
||||
title="The device to use for semantic search.",
|
||||
description="Use 'cpu' or 'gpu', to target a specific gpu use: '0', '1', etc.",
|
||||
device: Optional[str] = Field(
|
||||
default=None,
|
||||
title="The gpu id to use for semantic search.",
|
||||
description="This is an override, to target a specific gpu use: '0', '1', etc.",
|
||||
)
|
||||
|
||||
|
||||
@ -92,10 +92,10 @@ class FaceRecognitionConfig(FrigateBaseModel):
|
||||
blur_confidence_filter: bool = Field(
|
||||
default=True, title="Apply blur quality filter to face confidence."
|
||||
)
|
||||
device: str = Field(
|
||||
default="CPU",
|
||||
title="The device to use for face recognition.",
|
||||
description="Use 'cpu' or 'gpu', to target a specific gpu use: '0', '1', etc.",
|
||||
device: Optional[str] = Field(
|
||||
default=None,
|
||||
title="The gpu id to use for face recognition.",
|
||||
description="This is an override, to target a specific gpu use: '0', '1', etc.",
|
||||
)
|
||||
|
||||
|
||||
@ -155,10 +155,10 @@ class LicensePlateRecognitionConfig(FrigateBaseModel):
|
||||
default=False,
|
||||
title="Save plates captured for LPR for debugging purposes.",
|
||||
)
|
||||
device: str = Field(
|
||||
default="CPU",
|
||||
title="The device to use for license plate recognition.",
|
||||
description="Use 'cpu' or 'gpu', to target a specific gpu use: '0', '1', etc.",
|
||||
device: Optional[str] = Field(
|
||||
default=None,
|
||||
title="The gpu id to use for license plate recognition.",
|
||||
description="This is an override, to target a specific gpu use: '0', '1', etc.",
|
||||
)
|
||||
|
||||
|
||||
@ -180,4 +180,4 @@ class CameraLicensePlateRecognitionConfig(FrigateBaseModel):
|
||||
le=10,
|
||||
)
|
||||
|
||||
model_config = ConfigDict(extra="forbid", protected_namespaces=())
|
||||
model_config = ConfigDict(extra="forbid", protected_namespaces=())
|
||||
|
@ -107,7 +107,8 @@ class Embeddings:
|
||||
self.embedding = JinaV2Embedding(
|
||||
model_size=self.config.semantic_search.model_size,
|
||||
requestor=self.requestor,
|
||||
device=self.config.semantic_search.device,
|
||||
device=config.semantic_search.device
|
||||
or ("GPU" if config.semantic_search.model_size == "large" else "CPU"),
|
||||
)
|
||||
self.text_embedding = lambda input_data: self.embedding(
|
||||
input_data, embedding_type="text"
|
||||
@ -124,7 +125,8 @@ class Embeddings:
|
||||
self.vision_embedding = JinaV1ImageEmbedding(
|
||||
model_size=config.semantic_search.model_size,
|
||||
requestor=self.requestor,
|
||||
device=self.config.semantic_search.device,
|
||||
device=config.semantic_search.device
|
||||
or ("GPU" if config.semantic_search.model_size == "large" else "CPU"),
|
||||
)
|
||||
|
||||
def update_stats(self) -> None:
|
||||
@ -414,4 +416,4 @@ class Embeddings:
|
||||
finally:
|
||||
with self.reindex_lock:
|
||||
self.reindex_running = False
|
||||
self.reindex_thread = None
|
||||
self.reindex_thread = None
|
||||
|
@ -148,7 +148,12 @@ class ArcfaceEmbedding(BaseEmbedding):
|
||||
|
||||
self.runner = ONNXModelRunner(
|
||||
os.path.join(self.download_path, self.model_file),
|
||||
device=self.config.face_recognition.device,
|
||||
device=self.config.face_recognition.device
|
||||
or (
|
||||
"GPU"
|
||||
if self.config.face_recognition.model_size == "large"
|
||||
else "CPU"
|
||||
),
|
||||
)
|
||||
|
||||
def _preprocess_inputs(self, raw_inputs):
|
||||
@ -184,4 +189,4 @@ class ArcfaceEmbedding(BaseEmbedding):
|
||||
|
||||
frame = np.transpose(frame, (2, 0, 1))
|
||||
frame = np.expand_dims(frame, axis=0)
|
||||
return [{"data": frame}]
|
||||
return [{"data": frame}]
|
||||
|
Loading…
Reference in New Issue
Block a user