mirror of
https://github.com/azaion/annotations.git
synced 2026-04-22 22:26:31 +00:00
fde9a9f418
also restrict detections to be no bigger than in classes.json
75 lines
2.7 KiB
Cython
75 lines
2.7 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,
|
|
|
|
altitude,
|
|
focal_length,
|
|
sensor_width
|
|
):
|
|
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.altitude = altitude
|
|
self.focal_length = focal_length
|
|
self.sensor_width = sensor_width
|
|
|
|
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}, '
|
|
f'altitude: {self.altitude}, '
|
|
f'focal_length: {self.focal_length}, '
|
|
f'sensor_width: {self.sensor_width}'
|
|
)
|
|
|
|
@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("cam_a", 400),
|
|
unpacked.get("cam_fl", 24),
|
|
unpacked.get("cam_sw", 23.5)
|
|
) |