mirror of
https://github.com/blakeblackshear/frigate.git
synced 2025-12-16 18:16:44 +03:00
Add cutoff for object classification
This commit is contained in:
parent
c5fec3271f
commit
5064a817c2
@ -35,6 +35,10 @@ except ModuleNotFoundError:
|
|||||||
logger = logging.getLogger(__name__)
|
logger = logging.getLogger(__name__)
|
||||||
|
|
||||||
|
|
||||||
|
MAX_CLASSIFICATION_VERIFICATION_ATTEMPTS = 6
|
||||||
|
MAX_CLASSIFICATION_ATTEMPTS = 12
|
||||||
|
|
||||||
|
|
||||||
class CustomStateClassificationProcessor(RealTimeProcessorApi):
|
class CustomStateClassificationProcessor(RealTimeProcessorApi):
|
||||||
def __init__(
|
def __init__(
|
||||||
self,
|
self,
|
||||||
@ -264,6 +268,26 @@ class CustomObjectClassificationProcessor(RealTimeProcessorApi):
|
|||||||
if obj_data["label"] not in self.model_config.object_config.objects:
|
if obj_data["label"] not in self.model_config.object_config.objects:
|
||||||
return
|
return
|
||||||
|
|
||||||
|
if (
|
||||||
|
obj_data["id"] in self.detected_objects
|
||||||
|
and len(self.detected_objects[obj_data["id"]])
|
||||||
|
>= MAX_CLASSIFICATION_VERIFICATION_ATTEMPTS
|
||||||
|
):
|
||||||
|
# if we are at max attempts after rec and we have a rec
|
||||||
|
if obj_data.get("sub_label"):
|
||||||
|
logger.debug(
|
||||||
|
"Not processing due to hitting max attempts after true recognition."
|
||||||
|
)
|
||||||
|
return
|
||||||
|
|
||||||
|
# if we don't have a rec and are at max attempts
|
||||||
|
if (
|
||||||
|
len(self.detected_objects[obj_data["id"]])
|
||||||
|
>= MAX_CLASSIFICATION_ATTEMPTS
|
||||||
|
):
|
||||||
|
logger.debug("Not processing due to hitting max rec attempts.")
|
||||||
|
return
|
||||||
|
|
||||||
now = datetime.datetime.now().timestamp()
|
now = datetime.datetime.now().timestamp()
|
||||||
x, y, x2, y2 = calculate_region(
|
x, y, x2, y2 = calculate_region(
|
||||||
frame.shape,
|
frame.shape,
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user