mirror of
https://github.com/azaion/annotations.git
synced 2026-04-22 10:46:30 +00:00
b6b6751c37
put tile size to name and set it dynamically for AI recognition
62 lines
2.3 KiB
Cython
62 lines
2.3 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,
|
|
|
|
big_image_tile_overlap_percent,
|
|
tile_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
|
|
|
|
self.big_image_tile_overlap_percent = big_image_tile_overlap_percent
|
|
self.tile_size = tile_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'big_image_tile_overlap_percent: {self.big_image_tile_overlap_percent}, '
|
|
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"),
|
|
|
|
unpacked.get("ov_p", 20),
|
|
unpacked.get("tile_size", 550),
|
|
) |