mirror of
https://github.com/azaion/annotations.git
synced 2026-04-22 21:36:30 +00:00
6429ad62c2
put model batch size as parameter in config
52 lines
1.9 KiB
Cython
52 lines
1.9 KiB
Cython
from msgpack import unpackb
|
|
|
|
cdef class AIRecognitionConfig:
|
|
def __init__(self,
|
|
frame_period_recognition,
|
|
frame_recognition_seconds,
|
|
probability_threshold,
|
|
|
|
tracking_distance_confidence,
|
|
tracking_probability_increase,
|
|
tracking_intersection_threshold,
|
|
|
|
file_data,
|
|
paths,
|
|
model_batch_size
|
|
):
|
|
self.frame_period_recognition = frame_period_recognition
|
|
self.frame_recognition_seconds = frame_recognition_seconds
|
|
self.probability_threshold = probability_threshold
|
|
|
|
self.tracking_distance_confidence = tracking_distance_confidence
|
|
self.tracking_probability_increase = tracking_probability_increase
|
|
self.tracking_intersection_threshold = tracking_intersection_threshold
|
|
|
|
self.file_data = file_data
|
|
self.paths = paths
|
|
self.model_batch_size = model_batch_size
|
|
|
|
def __str__(self):
|
|
return (f'frame_seconds : {self.frame_recognition_seconds}, distance_confidence : {self.tracking_distance_confidence}, '
|
|
f'probability_increase : {self.tracking_probability_increase}, '
|
|
f'intersection_threshold : {self.tracking_intersection_threshold}, '
|
|
f'frame_period_recognition : {self.frame_period_recognition}, '
|
|
f'paths: {self.paths}, '
|
|
f'model_batch_size: {self.model_batch_size}')
|
|
|
|
@staticmethod
|
|
cdef from_msgpack(bytes data):
|
|
unpacked = unpackb(data, strict_map_key=False)
|
|
return AIRecognitionConfig(
|
|
unpacked.get("f_pr", 0),
|
|
unpacked.get("f_rs", 0.0),
|
|
unpacked.get("pt", 0.0),
|
|
|
|
unpacked.get("t_dc", 0.0),
|
|
unpacked.get("t_pi", 0.0),
|
|
unpacked.get("t_it", 0.0),
|
|
|
|
unpacked.get("d", b''),
|
|
unpacked.get("p", []),
|
|
unpacked.get("m_bs")
|
|
) |