mirror of
https://github.com/blakeblackshear/frigate.git
synced 2026-03-31 12:24:55 +03:00
Handle percentage as int (#22370)
Some checks failed
CI / AMD64 Build (push) Has been cancelled
CI / ARM Build (push) Has been cancelled
CI / Jetson Jetpack 6 (push) Has been cancelled
CI / AMD64 Extra Build (push) Has been cancelled
CI / ARM Extra Build (push) Has been cancelled
CI / Synaptics Build (push) Has been cancelled
CI / Assemble and push default build (push) Has been cancelled
Some checks failed
CI / AMD64 Build (push) Has been cancelled
CI / ARM Build (push) Has been cancelled
CI / Jetson Jetpack 6 (push) Has been cancelled
CI / AMD64 Extra Build (push) Has been cancelled
CI / ARM Extra Build (push) Has been cancelled
CI / Synaptics Build (push) Has been cancelled
CI / Assemble and push default build (push) Has been cancelled
This commit is contained in:
parent
5254bfd00e
commit
a0b8271532
@ -15,7 +15,6 @@ class ReviewMetadata(BaseModel):
|
|||||||
)
|
)
|
||||||
confidence: float = Field(
|
confidence: float = Field(
|
||||||
ge=0.0,
|
ge=0.0,
|
||||||
le=1.0,
|
|
||||||
description="Confidence in the analysis, from 0 to 1.",
|
description="Confidence in the analysis, from 0 to 1.",
|
||||||
)
|
)
|
||||||
potential_threat_level: int = Field(
|
potential_threat_level: int = Field(
|
||||||
|
|||||||
@ -181,6 +181,10 @@ Each line represents a detection state, not necessarily unique individuals. Pare
|
|||||||
try:
|
try:
|
||||||
metadata = ReviewMetadata.model_validate_json(clean_json)
|
metadata = ReviewMetadata.model_validate_json(clean_json)
|
||||||
|
|
||||||
|
# Normalize confidence if model returned a percentage (e.g. 85 instead of 0.85)
|
||||||
|
if metadata.confidence > 1.0:
|
||||||
|
metadata.confidence = min(metadata.confidence / 100.0, 1.0)
|
||||||
|
|
||||||
# If any verified objects (contain parentheses with name), set to 0
|
# If any verified objects (contain parentheses with name), set to 0
|
||||||
if any("(" in obj for obj in review_data["unified_objects"]):
|
if any("(" in obj for obj in review_data["unified_objects"]):
|
||||||
metadata.potential_threat_level = 0
|
metadata.potential_threat_level = 0
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user