A low-altitude multi-video stream heterogeneous visual detector unified scheduling and isolation method

By creating an independent detection session for each low-altitude video task, identifying the algorithm type, and fixing the computing device, the problem of cross-frame state isolation and unified result output of heterogeneous detectors in low-altitude video analysis is solved, and the stability of computing resources and consistency of results are achieved.

CN123142001APending Publication Date: 2026-11-20YANGZHOU FEIJIE ZHISHAN TECHNOLOGY CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202611257987.4
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2026-08-19
Publication Date
2026-11-20

AI Technical Summary

Technical Problem

In existing technologies, low-altitude video analysis suffers from inconsistent identification of heterogeneous detector types, lack of cross-frame state isolation, insufficient unified result format output, and inadequate session-based device binding management, leading to unstable computing resources and inconsistent results.

Method used

The method of one detection session per low-altitude video task is adopted. The algorithm type is identified by the detector factory, and an independent detection session is created to achieve cross-frame state isolation and unified frame results. The fixed computing device is fixed by load scheduling of the device pool to ensure the stability of the computing context.

Benefits of technology

It achieves independent and continuous algorithm states for each video stream, outputs frame analysis results in a unified format, ensures the stability of computing resources and the consistency of results, and avoids cross-frame state crosstalk and device switching delay.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN123142001A_ABST
    Figure CN123142001A_ABST
Patent Text Reader

Abstract

The present application relates to urban government low-altitude multi-video stream visual analysis. Public safety, urban management, water conservancy inspection, road traffic attention target and rules are different, and a same platform needs to run a stateful rule engine, a closed set target detector, an open term multi-modal detector and a face detector. In view of thread bifurcation, multi-stream crosstalk, field inconsistency, card replacement caused model reloading and unstable context, a model address identification detector is used, and a unified session is established for each task. The stateful engine exclusively occupies cross-frame state, the stateless detector is flatly packaged, and the result is normalized into a frame result containing categories, confidence, bounding box, tracking identifier, event marker and trigger reason. A same session is only used in a corresponding thread in frame order; when a session needs a local device, the device is allocated in rotation or minimum load and fixed, the model cache and inference lock are combined with the model address and the device identifier as a key, and the session is released when the session is closed. Therefore, the output streams are isolated, the fields are consistent and the context is stable.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention belongs to the fields of low-altitude video intelligent analysis, heterogeneous visual algorithm encapsulation, and computing resource scheduling. Specifically, it relates to a method, system, and storage medium that encapsulates a stateful rule engine, a closed-set target detector, an open-term multimodal detector, and a face detector into a unified session, and maintains cross-frame state isolation and session-based computing device stability during concurrent processing of multiple UAV videos. Background Technology

[0002] Urban low-altitude patrol inspections are not a single identification task. Public safety may focus on people and unusual gatherings, urban management may focus on garbage accumulation, illegal parking and road obstruction, water conservancy inspections may focus on floating objects and shoreline anomalies, and road traffic may focus on vehicles and road obstacles. Different operations require different target categories, judgment rules, result fields, and downstream channels. Low-altitude operations also feature multiple concurrent video sources: multiple drones or drones can simultaneously transmit live streams, and different flight records can be analyzed offline in parallel. Within the same video stream, data such as target tracking, duration, area entry status, and event cooldown must be saved across frames; between different video streams, these states must be strictly isolated.

[0003] In existing heterogeneous algorithm access methods, the video worker thread often directly determines the algorithm type and calls different functions, causing the main loop to continuously generate branches as the number of algorithms increases; or, in order to reduce the number of instances, a stateful engine or tracker is shared, which leads to mutual contamination of the video states of different low-altitude UAVs. The objective reality of the faults in the operation of the existing methods is shown in Table 1.

[0004] Table 1 Comparison of Existing Heterogeneous Algorithm Access Methods and Operational Faults

[0005]

[0006] In summary, existing solutions lack mechanisms for unified identification of heterogeneous detector types, cross-frame state isolation for each stream, unified result format output, and unified lifecycle management of session-based device binding and resource release. Therefore, this invention does not aim to simply "allocate tasks to GPUs," but rather to address the lack of unified lifecycle management for heterogeneous detector types, cross-frame state for each stream, unified result format, session-based device binding, and resource release. Summary of the Invention

[0007] This invention aims to solve the problems of interface splitting, cross-stream state crosstalk, and computational context instability when multiple low-altitude video streams run concurrently with heterogeneous visual detectors, so that each video stream has an independent and continuous algorithm state, and outputs frame analysis results in a unified format to event processing and government platforms.

[0008] This invention centers on "one detection session per low-altitude video task," integrating algorithm type identification, state instance creation, unified frame results, computing device allocation, model caching, inference locks, and resource release into a single session lifecycle. The main stream processing thread only interacts with the session interface and no longer with specific algorithm implementations.

[0009] Technical solution

[0010] The detector factory identifies the rule engine, open term detection, face detection, or closed set object detection based on the protocol prefix or file extension of the model address, and uniformly returns a detection session. The session provides interface for category query, frame processing, and closing.

[0011] For stateful rule engines, a session creates a rule framework instance that is only used by the current video stream, storing the target duration, region relationships, stage state, cooldown state, and event state. For stateless detectors, a flattened session encapsulates frame-by-frame functions and can create motion trackers that are only used by the current stream. Cross-frame state isolation is thus achieved.

[0012] The raw outputs from different detectors are normalized into a unified frame result, which includes at least the category identifier, category name, confidence score, bounding box, tracking identifier, event marker, and trigger reason. Each task worker thread creates only one session from start to finish and is called sequentially frame by frame within the same thread; sharing across video streams is prohibited.

[0013] Sessions requiring a local GPU invoke device pool load balancing upon creation, selecting a device based on round-robin or the minimum number of active sessions. The device identifier is written to the session and retained until shutdown. Model caching and inference locks use a (model address, device identifier) ​​key combination to ensure secure serialization of the same model on the same GPU and parallelization of model instances on different devices. Normal termination, video opening failure, user stop, or handling exceptions all enter a unified shutdown path and release device load.

[0014] The present invention provides low-altitude video analysis results with isolated state between output streams, consistent fields, and stable computational context. The technical means and effects are shown in Table 2.

[0015] Table 2 Correspondence between Technical Means and Technical Effects

[0016] Attached Figure Description

[0017] Figure 1 Design an interface for the algorithm to illustrate the different algorithm configurations for different government service scenarios;

[0018] Figure 2 This is the algorithm repository interface, used to explain how heterogeneous model addresses enter the unified session factory;

[0019] Figure 3 This is a test interface used to illustrate that different detectors share the same frame results;

[0020] Figure 4 Provides a system configuration interface to explain the device pool and allocation strategy;

[0021] Figure 5 This is the system monitoring interface used to illustrate session load and computing resources;

[0022] Figure 6 This is the task monitoring interface, used to illustrate the isolation of multiple video sessions;

[0023] Figure 7 This is the interface for low-altitude platforms, used to explain how unified results are transmitted to downstream platforms.

[0024] Figure 8 System architecture diagram for unified session scheduling link;

[0025] Figure 9 Flowchart of the method for closing the session lifecycle;

[0026] Figure 10 A schematic diagram of the algorithm for device pool load scheduling and (model, device) composite key caching. Detailed Implementation

[0027] The technical solutions of the embodiments of the present invention will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of the present invention, and not all embodiments. Based on the embodiments of the present invention, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of the present invention.

[0028] This embodiment uses a government low-altitude patrol platform that simultaneously deploys three types of heterogeneous visual detectors: urban management illegal parking detection (closed-set target detector), river floating object detection (open-entry multimodal detector), and personnel identity verification (face detector) to illustrate the complete session scheduling process of this invention from algorithm configuration to unified result output. Business personnel first select an algorithm suitable for a specific government scenario from the algorithm design or algorithm repository; the flight mission or test mission hands over the video source and model address to the operation service; this invention creates a detection session corresponding one-to-one with the video source and outputs unified frame results frame by frame; the event module then uses the unified frame results for evidence collection, clustering, or pushing to the business platform.

[0029] Step 1: Detector Type Identification and Session Factory Creation: (e.g., ...) Figure 1As shown, the algorithm design interface is used to configure algorithms suitable for low-altitude scenarios. Each algorithm configuration ultimately forms a model address, and the detector factory identifies the detector type based on the protocol prefix or file extension of the model address. The specific identification rules are as follows: when engine: / / is followed by a rule configuration identifier, it is identified as a stateful rule engine; when qwen: / / is followed by an open term hint, it is identified as an open term multimodal detector; when face: / / is followed by a vector library identifier, it is identified as a face detector; other model file paths (e.g., ending with .pt) are identified as closed-set target detectors.

[0030] In this embodiment, the platform registered three algorithm configurations, and their model addresses and detector types are shown in Table 3.

[0031] Table 3 Algorithm Configuration and Detector Type Comparison

[0032]

[0033] The core interface design of the detector factory is shown in Table 4. The factory provides two core interfaces: a type recognition interface and a session creation interface. The type recognition interface identifies the detector type based on the model address and returns a type enumeration value; the session creation interface creates the corresponding detection session based on the type enumeration value and returns a unified detection session interface. Regardless of the original fields used by the internal algorithm, the upper layer only calls the unified interface and does not branch according to the algorithm type. The core value of this design is that when the platform needs to add a new detector type (for example, adding an open scene detector based on a visual language model in the future), it only needs to add a new protocol prefix recognition rule to the type recognition interface and add a corresponding session creation branch to the session creation interface. The main loop of the stream processing and the downstream event module do not need any modification. In contrast, the existing approach of writing branches for worker threads according to algorithm type requires adding a branch to the main loop for each new algorithm. At the same time, the event module, visualization module, and platform output module also need to understand the return fields of the new algorithm separately, resulting in a large scope of modification and easy omissions.

[0034] Table 4 Detector Factory Core Interface

[0035]

[0036] like Figure 2As shown, each model in the algorithm repository interface is registered with a different address. When creating a task, simply select the algorithm and obtain the model address. The detector factory calls the type recognition interface to identify the type, and then calls the session creation interface to create a unified detection session. The rule engine returns a session with an exclusive state framework; the open term detector and face detector return a flat session not bound to the local graphics processor; the closed set detector returns a flat session bound to the computing device and with an in-session tracker. The algorithm repository provides the task with model addresses and type clues, and the session factory selects the internal implementation accordingly, always returning the same session interface to the upper layer.

[0037] The core logic for detector type identification is as follows: match the prefix of the model address. If the model address starts with engine: / / , it is identified as a rule engine type; if it starts with qwen: / / , it is identified as an open term multimodal type; if it starts with face: / / , it is identified as a face detection type; and other cases (i.e., given in the form of local model file path, such as / opt / models / yolo_drone.pt) are identified as closed set object detection types.

[0038]

[0039] In the formula: This is the detector type identification function, which outputs the type enumeration value RULE (rule engine), QMULTI (open term multimodal), FACE (face detection) or CLOSED (closed set object detection, corresponding to the local *.pt model file path); addr is the model address.

[0040] The core logic of the session factory in creating sessions based on type is as follows: First, the aforementioned type identification is called to obtain the detector type, and then the corresponding session object is returned according to the type—the rule engine type returns a stateful rule engine session (which internally occupies a unique cross-frame state instance); the open term multimodal type returns a flat encapsulated session (not bound to the local computing card); the face detection type returns a flat encapsulated session and supplements tracking within the session; the closed set object detection type returns a flat encapsulated session and supplements tracking within the session, while simultaneously requesting a computing card from the device pool and writing the allocated device identifier into the session. Each type of session is created once when the task starts, and subsequently called sequentially frame by frame, and closed uniformly when the task ends or an exception occurs.

[0041] Step 2: One state session per video stream: The session creation interface is called only once upon startup for each low-altitude video task. The returned detection session is stored in a local variable within the task's worker function. Worker threads sequentially call the session's processing methods in the order of video frames, without placing them in a cross-task shared container or allowing concurrent calls from multiple video streams. Upon task completion or abnormal exit, the session's closing method is called in a unified cleanup path.

[0042] In this embodiment, two low-altitude drones simultaneously perform different inspection tasks: Task A uses an urban management illegal parking detection algorithm (model address / opt / models / yolo_drone.pt), and Task B uses a river floating object detection algorithm (model address qwen: / / floating_debris). Each task calls a session creation interface to create an independent detection session, which is stored in local variables within its respective working function; the two detection sessions are not visible to each other and are not placed in any cross-task shared container.

[0043] The implementation of cross-frame state isolation varies depending on the detector type. For stateful rule engines, the session creates a rule framework instance (Framework instance) for use only in the current video stream, storing cross-frame data such as target duration, rule phase, region entry state, cooldown state, and event state. For stateless detectors (closed-set target detectors, open-term multimodal detectors, face detectors), a flat session encapsulates the frame-by-frame detection function, and a moving camera tracker for use only in the current stream can be created to supplement the detection box with a stable tracking identifier within the current session. This tracker is not shared with other video streams, so even if different low-altitude drones simultaneously capture similar targets, they will not inherit each other's identifiers.

[0044] The importance of cross-frame state isolation is illustrated using the example of both Task A and Task B using a stateful rule engine. Assume that a garbage dump target continuously appears in Task A's video stream starting from frame 10, and rule frame instance A accumulates 20 consecutive survival frames for this target between frames 10 and 30. If Task A and Task B share the same rule frame instance, when a garbage dump target appears at a different location in Task B's video stream at frame 15, the consecutive survival frame count in the rule frame instance might be reset or confused by Task B, causing Task A's target to be incorrectly judged as "just appeared" instead of "already survived for 10 frames" at frame 20, thus triggering incorrect candidate events. This invention, by dedicating a rule frame instance to each video stream, ensures that the consecutive survival frame count of Task A's target only progresses with Task A's video stream, and the cessation of Task B does not clear Task A's state.

[0045] The lifecycle and sharing scope of objects within a session are shown in Table 5.

[0046] Table 5. Lifecycle and Sharing Scope of Objects within a Session

[0047]

[0048] Step 3: Unified Frame Result Contract: The process interface of the detection session returns a unified frame result. Regardless of the original fields used by the internal algorithm, the flat session converts the result into a unified format. The unified frame result includes at least the category identifier, category name, confidence score, bounding box, tracking identifier, frame-level event marker, and trigger reason, and generates the number of events by category and the number of events within the frame. As shown in Table 6.

[0049] Table 6. Definition of fields in the unified frame result table

[0050]

[0051] The detection session provides a unified processing interface, which is defined as follows: the `get_classes` method returns all class names supported by the detector; the `process` method receives a video frame along with its frame number, timestamp, and video source identifier, and returns a unified list of frame results; the `close` method is used to close the session and release the resources it occupies. Regardless of the type of internal algorithm, the caller interacts with it using the same interface signature, without needing to be aware of the underlying implementation differences.

[0052] like Figure 3 As shown, the same test entry point in the test run interface can run different algorithm types. The front-end and subsequent event modules only consume the unified frame results and do not need to know whether the results come from the rule engine, closed-set model, open-term model, or face model. The test entry point does not need to understand the internal algorithm type because the outputs of the rule engine, object detection, multimodal detection, and face detection have been converted into unified frame results.

[0053] Step 4: Cross-Frame State Isolation of the Stateful Rule Engine: Within a stateful rule engine session, a single rule framework instance is exclusively used. This instance maintains cross-frame data such as the target's continuous frame count, rule stage, region entry state, and cooldown time. For the video stream of task A, after detecting a garbage dump target in frame 10, rule framework instance A begins accumulating the target's continuous survival frame count. From frames 11 to 19, rule framework instance A continuously updates the target's survival frame count. When the survival frame count reaches the trigger threshold (e.g., 10 frames) in frame 20, the rule is triggered, generating a candidate event and writing the event flag (event flag = True) and the trigger reason (trigger reason = "continuous survival ≥ 10 frames"). Afterward, a cooldown phase begins, where repeated triggering during the cooldown period is suppressed to prevent the same target from generating multiple candidate events in a short time.

[0054] Having independence

[0055]

[0056] In the formula: For the first Low-altitude video detection session; This is a unique cross-frame state instance (such as a rule frame instance). Cross-frame state instances from different sessions do not reference each other at the object level. This ensures cross-frame state isolation at the object level.

[0057] The core guarantee of cross-frame state isolation is that rule framework instance A is only called by the worker thread of task A, while the worker thread of task B calls a separate, independent rule framework instance B. The two instances are different objects in memory and do not share any references. Even if task A and task B use the same model address engine: / / city_mgmt, the session creation interface will create an independent rule framework instance for each task. This design eliminates the possibility of cross-stream state crosstalk at the object level.

[0058] Further analysis reveals the specific manifestations of cross-frame state crosstalk in existing solutions. In implementations where multiple video streams share a state instance, the target duration field in the rule framework instance is a variable integer, incremented or reset each frame based on whether the target has appeared. Assume task A and task B share the same rule framework instance. Task A detects target A in frame 10 and begins accumulating the duration frame count, while task B detects target B in frame 15 and also begins accumulating. Due to the interleaved arrival of video frames from the two tasks at the worker thread, the duration frame count of target A may be incorrectly incremented or reset during task B's frame processing, leading to confusion in rule triggering conditions: target A may be incorrectly judged as "just appeared" (the duration frame count is reset to 1 by task B), or target B may be incorrectly judged as "having existed for a long time" (the duration frame count inherits the accumulated value from task A). The former results in missed triggering of candidate events, while the latter leads to false triggering of candidate events. This invention eliminates this crosstalk at its source by ensuring that each stream exclusively uses a rule framework instance, allowing the cross-frame state of each video stream to progress only with its own video stream.

[0059] Table 7 shows the cross-frame state fields maintained internally by the rule framework instance and their meanings. These fields are initialized when the session is created, updated during each frame's process call, and released along with the instance when the session is closed. Since the instance is not shared with other video streams, the lifecycle of these fields is completely consistent with the lifecycle of the current video stream.

[0060] Table 7 Stateful Rule Engine Cross-Frame State Fields

[0061]

[0062] For stateless detectors (closed-set target detectors, face detectors), cross-frame state isolation is achieved through an in-session tracker. The inference function of a closed-set target detector is stateless—given a single frame of input, it outputs a set of detection results without storing any historical information. However, the tracker is stateful—it needs to maintain the target's position history and identifier assignment across consecutive frames. This invention creates a moving-camera tracker instance for the detector to be tracked at session creation. This instance is only called by the current session's worker thread and is not shared with other video streams. When a target with a tracking identifier of 7 appears in a video frame of task A, even if a similarly appearing target appears in a video frame of task B, it will not be assigned the same tracking identifier 7 because the trackers for the two tasks are independent instances.

[0063] Step 5: Session-based computing device fixation: Sessions requiring a local graphics processor (GPU) are scheduled using a device pool at creation time, selecting a device based on a round-robin or minimum load strategy. In this embodiment, the device pool contains two GPUs, GPU0 and GPU1. Figure 4 As shown, the system configuration interface allows configuration of device pools and scheduling strategies.

[0064]

[0065]

[0066] In the formula: G is the device pool (a collection of graphics processors); Select the device; For equipment Current number of active sessions; For the size of the equipment pool; Count the number of sessions already created. The round-robin strategy allocates sessions sequentially according to their creation order, while the minimum load strategy selects the session with the fewest currently active sessions. Once selected, its load count is incremented and fixed until the session is closed.

[0067]

[0068] In the formula: For equipment The number of active sessions. All four exit paths—normal termination, video source opening failure, user stop, and handling exception—converge to this formula (session heartbeat recycling), ensuring the count is not less than zero and there is no leakage.

[0069] If the strategy is round_robin, the allocator selects devices in a round-robin fashion according to the session creation order: the first session is assigned GPU0, the second session is assigned GPU1, the third session is assigned GPU0 again, and so on. If the strategy is least_loaded, the allocator selects the device with the fewest currently active sessions. Let the set of devices be G, and the number of currently active sessions on device g be... The minimum load is then selected as .

[0070] In this embodiment, the strategy is set to least_loaded, with 3 active sessions for GPU0 and 1 active session for GPU1. When Task A creates a session, the allocator compares L_GPU0=3 and L_GPU1=1, selecting GPU1 as the target device. The allocator increments the load count of GPU1 to 2 and writes the device identifier "GPU1" into the detection session. For each subsequent frame of Task A, the same device identifier "GPU1" is passed to the inference function until the session is closed. This ensures that the continuity of video frames remains consistent with the device where the model resides, avoiding frame-by-frame card switching. When Task B subsequently creates a session, with 3 active sessions for GPU0 and 2 active sessions for GPU1, the allocator selects GPU0. The device allocation process is shown in Table 8.

[0071] Table 8 Equipment Pool Load Scheduling Process

[0072]

[0073] When no device pool is available, an empty device identifier is returned, and the inference implementation selects either the CPU or the default device, without changing the unified session interface. This means that even on servers without GPUs, the closed-set object detector can still run on the CPU, albeit at a slower inference speed. The device pool policy only determines which computing device to select at session creation; once the device is written to the session, it remains unchanged until the video stream ends. The key significance of this constraint is that if GPU selection is allowed frame-by-frame, when GPU0 is selected in the current frame, the model instance is already loaded and cached on GPU0. When GPU1 is selected in the next frame, the model needs to be reloaded on GPU1, which typically takes several seconds to tens of seconds (depending on the model size and disk I / O speed), which is completely unacceptable in a 25fps real-time video stream. Furthermore, even if a cached instance of the model already exists on GPU1, intermediate computation results (such as feature maps, anchor boxes, etc.) in video memory are not shared between model instances on different GPUs. Frame-by-frame card switching would cause these intermediate results to be repeatedly reconstructed, further increasing latency. This invention ensures that the model is loaded once at session creation and reused throughout its entire lifecycle by fixing the device during the session and using a combination key cache, while also maintaining the continuity of intermediate computation results.

[0074] The core logic of device pool load balancing is as follows: During initialization, the device pool registers all available computing devices (e.g., GPU0, GPU1) and sets the active session count of each device to zero, while holding a lock to protect the count. When requesting a device, the process proceeds while the device pool is locked: if the device set is empty, an empty device identifier is returned, and the inference implementation automatically selects a CPU or a default device; if the scheduling strategy is round-robin, devices are selected sequentially according to the session creation order; if the scheduling strategy is minimum load (default), the device with the fewest current active sessions is selected, and the active session count of the selected device is incremented by one, and the device identifier is returned. When releasing a device, the active session count of the device is decremented by one while the device is locked, ensuring that the count is not less than zero.

[0075]

[0076] In the formula: For the first The computing device selected for the frame; The loading / context reconstruction time for a single-card model (several seconds to tens of seconds, depending on model size and I / O). If card selection is dynamic frame-by-frame, frequent card switching between adjacent frames increases... Accumulation in a 25fps real-time stream severely hinders analysis; fixed session duration makes... It is counted only once when the session is created.

[0077] Step 6: Model Caching and Inference Locks: The cache key for the closed-set object detection model is expanded from a single model path to a "model path, device identifier" tuple. Instances of the same model are cached on GPU0 and GPU1 respectively, enabling cross-GPU parallelism. Each tuple corresponds to an inference lock, used to protect non-thread-safe operations such as result objects and visualization processes for the same model on the same GPU. Different devices use different locks, preventing unnecessary serialization due to global locks.

[0078]

[0079] In the formula: A binary key for both caching and inference locks; This indicates that the key has been cached. If the same entity holds the same inference lock, execution will proceed sequentially. Different devices using different locks → cross-card parallelism equals device pool size .

[0080] In this embodiment, task A uses the model ` / opt / models / yolo_drone.pt` and binds it to GPU1, while task C uses the same model but binds it to GPU0. Their cache keys are (model path ` / opt / models / yolo_drone.pt`, device identifier GPU1) and (model path ` / opt / models / yolo_drone.pt`, device identifier GPU0), respectively, each caching an independent model instance. When task A performs inference on GPU1, it holds an inference lock (model path ` / opt / models / yolo_drone.pt`, device identifier GPU1), and when task C performs inference on GPU0, it holds an inference lock (model path ` / opt / models / yolo_drone.pt`, device identifier GPU0). The two locks do not block each other, enabling cross-GPU parallelism. However, if both task A and task D use the same model on GPU1, they share the inference lock (model path ` / opt / models / yolo_drone.pt`, device identifier GPU1), and the inference operation is executed serially, ensuring the correctness of non-thread-safe operations. The correspondence between model caches and inference locks is shown in Table 9.

[0081] Table 9. Correspondence between Model Cache and Inference Lock

[0082]

[0083] Model caching can use a Least Recently Used (LRU) strategy to limit the number of instances. When a cache hit occurs, the access order is updated; when the cache exceeds the limit, the least recently used combined instance is removed. This caching mechanism works in conjunction with session-based device fixation to prevent switching to another device without a loaded model mid-stream within the same video stream. If the device is not fixed (e.g., GPU is reselected every frame), when GPU0 is selected in the current frame and GPU1 in the next frame, the model instance may not yet be cached on GPU1, requiring model reloading, which takes several seconds to tens of seconds, severely impacting real-time analysis. This invention, through session-based device fixation and combined key caching, ensures that the model is loaded once at session creation and reused throughout its entire lifecycle.

[0084]

[0085] In the formula: The number of cached (model, device) combined instances; This sets a maximum cache capacity (LRU strategy). This mechanism works in conjunction with session-based device fixes to prevent switching to a device that has not yet loaded a model midway through the same video stream.

[0086] like Figure 5As shown, the system monitoring interface is used to observe the status of computing resources and services. The device allocator can provide a snapshot of the current device pool, policies, and the number of active sessions on each device to pinpoint load skew. System monitoring reflects the actual session load on each device; monitoring values ​​can only be used as the basis for correct allocation of the next task after the session is closed and the unified release count is completed.

[0087] Step 7: Multi-task operation and lifecycle release: Multiple low-altitude video tasks can run simultaneously, each task having an independent detection session, independent cross-frame state, and fixed computing device. For example... Figure 6 As shown, each video stream in the task monitoring interface holds a detection session, cross-frame status, and device binding. Tasks run concurrently but do not share state objects.

[0088] Normal termination, video source opening failure, user stop, and processing exceptions all enter a unified cleanup process. The session close method calls the device allocator's release interface, decrementing the active session count of the corresponding device by one, ensuring the count is not less than zero. The core logic of the unified shutdown process is as follows: each task's working function creates a detection session and opens the video source through the session factory upon entry. Then, in a loop, it calls the session's process method frame by frame to process video frames and passes the results to downstream processing. The loop body is wrapped in an exception handling structure. Regardless of whether a video source opening failure, processing exception, or user stop signal is encountered, it jumps to the unified shutdown branch. Finally, in the cleanup block, as long as a session has been created, its close method is called. The close method internally calls the device pool's release interface to decrement the active session count of the corresponding device by one. Thus, normal termination and various abnormal exits converge to the same shutdown path, and the device pool load count always reflects the true occupancy status.

[0089] In this embodiment, task A exits due to user-initiated termination. The worker thread of task A calls the shutdown method of the detection session in the cleanup block. Internally, the shutdown method calls the release interface of the device pool (for GPU1), reducing the active session count of GPU1 from 2 to 1. If task A exits due to a processing exception (e.g., a GPU error during inference), it also enters the unified shutdown process of the cleanup block, and the active session count of GPU1 is correctly decremented by one. If task A exits due to a video source failure, although the detection session has been created but the video source is unavailable, the cleanup block will still call the shutdown method to release the load count of GPU1. This unified shutdown across four exit paths ensures that the device pool load count always reflects the actual device occupancy status, allowing subsequent tasks to select the least busy device based on the actual load when creating sessions.

[0090] Table 10 shows a comparison of resource release for the four exit paths.

[0091] Table 10 Comparison of resource release for four exit paths

[0092]

[0093] like Figure 7 As shown, the platform access interface is used to configure the event output connection between the low-altitude service platform and the algorithm service. Because different detectors have already generated unified frame results, the platform output layer can reuse the same event data structure and transmission process. The low-altitude service platform receives fields such as category, confidence level, bounding box, tracking identifier, event marker, trigger reason, and evidence image, without needing to establish a dedicated protocol for each internal algorithm. The unified frame results allow downstream platforms to receive the output of different algorithms using a single event protocol, confining the differences between heterogeneous algorithms within the session.

[0094] The above embodiments are merely illustrative of the technical concept of the present invention and should not be construed as limiting the scope of protection of the present invention. Any modifications made to the technical solutions based on the technical concept proposed in this invention shall fall within the scope of protection of this invention.

Claims

1. A unified session scheduling and state isolation method for heterogeneous visual detectors with multiple video streams at low altitudes, characterized in that, include: It receives multiple low-altitude video stream analysis tasks, each task containing the video source and model address; The detector type is identified based on the protocol prefix or file suffix of the model address. The detector type includes at least a stateful rule engine and a stateless visual detector. The detector type also includes a stateful rule engine identified by the engine: / / prefix, an open term multimodal detector identified by the qwen: / / prefix, a face detector identified by the face: / / prefix, and a closed set target detector identified by the model file suffix. A detection session is created when each analysis task starts. For stateful rule engines, a cross-frame state instance exclusive to that session is created within the detection session. For stateless visual detectors, a flat session is used to encapsulate their frame-by-frame detection functions. The outputs of different detectors are normalized into a unified frame result, which includes at least a category identifier, category name, confidence score, bounding box, tracking identifier, frame-level event marker, and trigger reason. The detection session is confined to the worker thread of the corresponding analysis task, and the detection session is called serially according to the video frame order and is not shared across low-altitude video streams. For detection sessions that require a graphics processor, a target device is allocated from the device pool when the session is created and the target device remains unchanged throughout the session's lifecycle; model instances are cached using a combination of the model address and the target device identifier as the key, and an inference lock is established; the detection session is closed and the load on the target device is released when the analysis task ends or exits abnormally.

2. The method according to claim 1, characterized in that, The detection session provides a category query interface, a frame processing interface, and a shutdown interface; the low-altitude video stream worker thread only calls the unified interface of the detection session and does not set branches according to the detector type.

3. The method according to claim 1, characterized in that, The cross-frame state of the stateful rule engine includes at least one of the following: target duration, region relationship, stage state, cooling state, and event triggering state, and each low-altitude video stream has an independent cross-frame state instance.

4. The method according to claim 1, characterized in that, The flat session of the stateless visual detector can also create an in-session target tracker for the corresponding low-altitude moving camera, supplementing the frame-by-frame detection results with a stable tracking identifier within the session.

5. The method according to claim 1, characterized in that, The unified frame results also include visualized frames, the number of targets by category, the number of intra-frame events, and extended attributes output by the detector.

6. The method according to claim 1, characterized in that, The device pool allocates graphics processors using either a round-robin or minimum load strategy. Under the minimum load strategy, the graphics processor with the fewest currently running sessions is selected, and its load count is incremented. When the device pool is empty, the default device identifier is returned, causing the detection session to run on the central processing unit or the default computing device without altering the unified session processing flow.

7. The method according to claim 1, characterized in that, The same model is cached on different graphics processors (GPUs); the same model address and the same GPU combination correspond to an inference lock, so that non-thread-safe inference operations within the combination are serialized, while model instances on different GPUs can be parallelized. Normal completion of the analysis task, failure to open the video source, processing exceptions, and user-stopped operation all trigger a session closing procedure, which decrements the target device's load count by one and ensures it is not less than zero.

8. A unified session scheduling and state isolation system for heterogeneous visual detectors for low-altitude multi-video streams, characterized in that, It includes a detector type identification module, a session factory module, a result normalization module, an in-stream serial execution module, a computing device allocation module, a model cache and inference lock module, and a session release module, each module being configured to perform the method described in any one of claims 1 to 10.

9. An electronic device comprising a processor, a memory, and an optional graphics processor, characterized in that, The memory stores a computer program that, when executed by the processor, implements the method according to any one of claims 1 to 10.

10. A computer-readable storage medium having a computer program stored thereon, characterized in that, When the computer program is executed by a processor, it implements the method according to any one of claims 1 to 10.