mirror of
https://github.com/azaion/detections.git
synced 2026-04-22 06:46:32 +00:00
64 lines
2.7 KiB
Cython
64 lines
2.7 KiB
Cython
cdef class AIRecognitionConfig:
|
|
def __init__(self,
|
|
frame_period_recognition,
|
|
frame_recognition_seconds,
|
|
probability_threshold,
|
|
|
|
tracking_distance_confidence,
|
|
tracking_probability_increase,
|
|
tracking_intersection_threshold,
|
|
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.model_batch_size = model_batch_size
|
|
|
|
self.big_image_tile_overlap_percent = big_image_tile_overlap_percent
|
|
|
|
self.has_altitude = altitude is not None
|
|
self.altitude = 0.0 if altitude is None else float(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'model_batch_size: {self.model_batch_size}, '
|
|
f'altitude: {self.altitude if self.has_altitude else None}, '
|
|
f'focal_length: {self.focal_length}, '
|
|
f'sensor_width: {self.sensor_width}'
|
|
)
|
|
|
|
@staticmethod
|
|
cdef AIRecognitionConfig from_dict(dict data):
|
|
return AIRecognitionConfig(
|
|
data.get("frame_period_recognition", 4),
|
|
data.get("frame_recognition_seconds", 2),
|
|
data.get("probability_threshold", 0.25),
|
|
|
|
data.get("tracking_distance_confidence", 0.0),
|
|
data.get("tracking_probability_increase", 0.0),
|
|
data.get("tracking_intersection_threshold", 0.6),
|
|
|
|
data.get("model_batch_size", 8),
|
|
|
|
data.get("big_image_tile_overlap_percent", 20),
|
|
|
|
data.get("altitude", None),
|
|
data.get("focal_length", 24),
|
|
data.get("sensor_width", 23.5)
|
|
)
|