from ai_availability_status cimport AIAvailabilityStatus from annotation cimport Annotation, Detection from ai_config cimport AIRecognitionConfig from inference_engine cimport InferenceEngine cdef class Inference: cdef object loader_client cdef InferenceEngine engine cdef object _annotation_callback cdef object _status_callback cdef Annotation _previous_annotation cdef dict[str, list(Detection)] _tile_detections cdef dict[str, int] detection_counts cdef AIRecognitionConfig ai_config cdef bint stop_signal cdef public AIAvailabilityStatus ai_availability_status cdef str model_input cdef int model_width cdef int model_height cdef bytes _converted_model_bytes cdef bytes get_onnx_engine_bytes(self) cdef convert_and_upload_model(self, bytes onnx_engine_bytes, str engine_filename) cdef init_ai(self) cdef bint is_building_engine cdef bint is_video(self, str filepath) cpdef run_detect(self, dict config_dict, object annotation_callback, object status_callback=*) cpdef list detect_single_image(self, bytes image_bytes, dict config_dict) cdef _process_video(self, AIRecognitionConfig ai_config, str video_name) cdef _process_images(self, AIRecognitionConfig ai_config, list[str] image_paths) cdef _process_images_inner(self, AIRecognitionConfig ai_config, list frame_data, double ground_sampling_distance) cdef on_annotation(self, Annotation annotation, int frame_count=*, int total_frames=*) cdef split_to_tiles(self, frame, path, tile_size, overlap_percent) cpdef stop(self) cdef preprocess(self, frames) cdef send_detection_status(self) cdef remove_overlapping_detections(self, list[Detection] detections, float confidence_threshold=?) cdef postprocess(self, output, ai_config) cdef split_list_extend(self, lst, chunk_size) cdef bint is_valid_video_annotation(self, Annotation annotation, AIRecognitionConfig ai_config) cdef bint is_valid_image_annotation(self, Annotation annotation, double ground_sampling_distance, frame_shape) cdef remove_tiled_duplicates(self, Annotation annotation)