mirror of
https://github.com/blakeblackshear/frigate.git
synced 2026-04-27 17:17:40 +03:00
Update device to be an override, keep core logic in place if value of device is None.
This commit is contained in:
parent
2cc42db8b8
commit
ade32c5c8b
@ -130,10 +130,10 @@ class SemanticSearchConfig(FrigateBaseModel):
|
|||||||
model_size: str = Field(
|
model_size: str = Field(
|
||||||
default="small", title="The size of the embeddings model used."
|
default="small", title="The size of the embeddings model used."
|
||||||
)
|
)
|
||||||
device: str = Field(
|
device: Optional[str] = Field(
|
||||||
default="CPU",
|
default=None,
|
||||||
title="The device to use for semantic search.",
|
title="The gpu id to use for semantic search.",
|
||||||
description="Use 'cpu' or 'gpu', to target a specific gpu use: '0', '1', etc.",
|
description="This is an override, to target a specific gpu use: '0', '1', etc.",
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
@ -201,10 +201,10 @@ class FaceRecognitionConfig(FrigateBaseModel):
|
|||||||
blur_confidence_filter: bool = Field(
|
blur_confidence_filter: bool = Field(
|
||||||
default=True, title="Apply blur quality filter to face confidence."
|
default=True, title="Apply blur quality filter to face confidence."
|
||||||
)
|
)
|
||||||
device: str = Field(
|
device: Optional[str] = Field(
|
||||||
default="CPU",
|
default=None,
|
||||||
title="The device to use for face recognition.",
|
title="The gpu id to use for face recognition.",
|
||||||
description="Use 'cpu' or 'gpu', to target a specific gpu use: '0', '1', etc.",
|
description="This is an override, to target a specific gpu use: '0', '1', etc.",
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
@ -264,10 +264,10 @@ class LicensePlateRecognitionConfig(FrigateBaseModel):
|
|||||||
default=False,
|
default=False,
|
||||||
title="Save plates captured for LPR for debugging purposes.",
|
title="Save plates captured for LPR for debugging purposes.",
|
||||||
)
|
)
|
||||||
device: str = Field(
|
device: Optional[str] = Field(
|
||||||
default="CPU",
|
default=None,
|
||||||
title="The device to use for license plate recognition.",
|
title="The gpu id to use for license plate recognition.",
|
||||||
description="Use 'cpu' or 'gpu', to target a specific gpu use: '0', '1', etc.",
|
description="This is an override, to target a specific gpu use: '0', '1', etc.",
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@ -112,7 +112,8 @@ class Embeddings:
|
|||||||
self.embedding = JinaV2Embedding(
|
self.embedding = JinaV2Embedding(
|
||||||
model_size=self.config.semantic_search.model_size,
|
model_size=self.config.semantic_search.model_size,
|
||||||
requestor=self.requestor,
|
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(
|
self.text_embedding = lambda input_data: self.embedding(
|
||||||
input_data, embedding_type="text"
|
input_data, embedding_type="text"
|
||||||
@ -129,7 +130,8 @@ class Embeddings:
|
|||||||
self.vision_embedding = JinaV1ImageEmbedding(
|
self.vision_embedding = JinaV1ImageEmbedding(
|
||||||
model_size=config.semantic_search.model_size,
|
model_size=config.semantic_search.model_size,
|
||||||
requestor=self.requestor,
|
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:
|
def update_stats(self) -> None:
|
||||||
|
|||||||
@ -150,7 +150,12 @@ class ArcfaceEmbedding(BaseEmbedding):
|
|||||||
|
|
||||||
self.runner = ONNXModelRunner(
|
self.runner = ONNXModelRunner(
|
||||||
os.path.join(self.download_path, self.model_file),
|
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):
|
def _preprocess_inputs(self, raw_inputs):
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user