A real-time visual recognition trigger control method and system based on a state machine drive
Patent Information
- Application Number
- CN202611125703.6
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2026-07-28
- Publication Date
- 2026-10-23
AI Technical Summary
[0005]鉴于此,本发明提出了一种基于状态机驱动的实时视觉识别触发控制方法及系统,旨在解决现有技术无法根据目标状态变化动态调整识别任务触发策略的问题
[0015]与现有技术相比,本发明的有益效果在于:为每个跟踪目标建立独立的状态机,通过多重状态变量,实现了识别结果的持久化缓存与智能冷却。单帧识别失败时不清空缓存,而是进入冷却期等待下一次有效识别,确保了界面显示稳定。基于面积变化率、中心点位移、定时刷新三个维度的智能触发机制,仅在目标发生显著变化或达到刷新周期时才触发视觉识别,在目标稳定且近期已识别的情况下,直接使用缓存结果,避免了无效重复识别。引入基于尺寸阈值的自适应预处理机制,对小尺寸目标进行高质量放大,确保了小目标在送入识别引擎前达到合适的识别尺寸。构建了多层次结果过滤体系,包括占位词过滤词库过滤、置信度后缀清理、空结果判定,提升了识别结果的可靠性。通过刷新计时器实现自适应刷新,即使目标仍在画面中,达到刷新周期后也会重新触发识别,以适应摄像头聚焦变化。同时,结合面积变化率检测和中心点位移检测,当目标发生显著移动时也会触发重新识别。实现字段级逐个确认机制,每个字段连续一致后确认锁定,所有字段确认后状态机进入低功耗模式,降低了识别触发频率。
Smart Images

Figure CN122966934A_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of visual recognition technology, and more specifically, to a real-time visual recognition trigger control method and system based on state machine driving. Background Technology
[0002] With the development of computer vision technology, real-time target recognition technology based on video streams has been widely applied in intelligent monitoring, personnel information identification, and industrial site management. Existing real-time visual recognition systems typically include processing steps such as target detection, target region extraction, and visual recognition. Target detection algorithms are used to obtain the target location in video frames, and then OCR (Optical Character Recognition) or visual language models are used to extract information from the target region to achieve target content recognition.
[0003] In existing technologies, visual recognition tasks are typically executed using a fixed triggering method. For example, after a target is detected, recognition operations are continuously performed on the target region in consecutive video frames to ensure timely updates of the recognition results. However, in practical applications, the state of the same target may remain stable across multiple consecutive video frames. If the recognition task is still executed at a fixed frequency, it will result in a large amount of repetitive computation, increasing the computational burden on the system. Furthermore, when the target appears for the first time, its position changes, or the image quality changes, the recognition task needs to be re-executed promptly. Existing real-time visual recognition technologies suffer from the problem of not being able to dynamically adjust the recognition task triggering strategy based on changes in the target's state.
[0004] Therefore, it is necessary to design a real-time visual recognition trigger control method and system based on state machine to solve the problems existing in the current technology. Summary of the Invention
[0005] In view of this, the present invention proposes a real-time visual recognition trigger control method and system based on state machine driving, which aims to solve the problem that the existing technology cannot dynamically adjust the recognition task triggering strategy according to the changes in the target state.
[0006] In one aspect, this invention proposes a real-time visual recognition trigger control method based on state machine driving, comprising: Acquire target detection data and establish a target tracking state machine based on the target detection data; Multi-dimensional change detection is performed on the target detection data to obtain target change state information; Based on the target change state information and the target tracking state machine, a visual recognition trigger decision is determined; When generating the visual recognition trigger decision, throttling control is triggered simultaneously; The target detection data is evaluated for single-frame sharpness based on the visual recognition trigger decision. When the single-frame sharpness evaluation result is qualified for recognition, adaptive image preprocessing is performed on the target detection data; The target detection data after adaptive image preprocessing is input into the visual language model to generate target field recognition results; The validity of the target field identification results is verified, and the consistency of the target field identification results in different identification periods is judged based on the field dimension; when the consistency judgment results are consistent, the target field identification results are temporarily stored in the target tracking state machine. The temporarily stored target field identification results are filtered and verified. The target tracking state machine is updated based on the results of filtering and verification. When the filtering verification is valid, the temporarily stored target field identification result is written into the identification result cache variable. When the filtering verification is invalid, the temporarily stored data is discarded and the failure cooldown timer parameter is updated.
[0007] Furthermore, a target tracking state machine is established based on the target detection data, including: Extract target identification information from the target detection data and establish a target tracking state machine for each target identification information; the target tracking state machine includes identification result cache variables, task execution status identifiers, failure cooldown timer parameters, historical identification timestamps, and field confirmation status identifiers.
[0008] Furthermore, the target tracking state machine also includes a field confirmation count parameter; The field confirmation count parameter is the number of times the field value matches within a continuous recognition period for each independent field in the target field recognition result.
[0009] Furthermore, when obtaining information about the target's changing state, this includes: Change detection is performed based on the position change information, size change information, and time change information of the target detection data; wherein, the target distance change state is determined based on the target area size change; the target motion state is determined based on the target area center position change; the target refresh state is determined based on the time interval from the last valid identification; and target change state information is generated based on the target distance change state, target motion state, and target refresh state.
[0010] Furthermore, determining when visual recognition triggers a decision includes: Provided that the failure cooling timer parameter is not in a cooling state and the task execution status is marked as non-execution, the following judgments are made: When the target tracking state machine has not executed an identification task, a first identification trigger decision is generated; when all fields in the target tracking state machine are in a confirmed state, a low-frequency inspection trigger decision is generated when a first time interval is met; when not all fields in the target tracking state machine are in a confirmed state, and the target change status information includes the target distance change status, a re-identification trigger decision is generated; when not all fields in the target tracking state machine are in a confirmed state, and the target change status information does not include the target distance change status, a regular refresh trigger decision is generated when a second time interval is met. Wherein, the first time interval is greater than the second time interval.
[0011] Furthermore, when throttling control is triggered, it includes: Obtain the current timestamp and calculate the time difference between the current timestamp and the historical identification timestamp in the target tracking state machine; When the time difference is less than the throttling time threshold, the visual recognition trigger decision is blocked; when the time difference is greater than or equal to the throttling time threshold, the visual recognition trigger decision is allowed, and the current timestamp is updated to the historical recognition timestamp.
[0012] Furthermore, when performing single-frame sharpness assessment and adaptive image preprocessing on the target detection data, the process includes: Calculate the Laplacian operator variance of the target region image in the target detection data; when the Laplacian operator variance is less than the sharpness threshold, the result of the single-frame sharpness evaluation is determined to be unqualified; when the Laplacian operator variance is greater than or equal to the sharpness threshold, the result of the single-frame sharpness evaluation is determined to be qualified. When the recognition is deemed successful, the pixel size of the target region image is obtained; when the pixel size is less than a size threshold, a scaling factor is determined based on the size threshold, and the target region image is magnified.
[0013] Furthermore, when generating the target field recognition results, the following are included: Construct a sequence of prompt words with anti-hallucination constraint instructions, wherein the anti-hallucination constraint instructions are used to restrict the visual language model from outputting non-image source characters and placeholder characters; The prompt word sequence and the target detection data after adaptive image preprocessing are input into the visual language model, and structured data is output; the structured data is parsed into target field recognition results of multiple key-value pairs.
[0014] Furthermore, when performing result filtering and verification identification, the following steps are included: The target field identification result is structured and parsed. When parsing fails, the field content is extracted and reconstructed using regular expressions. Invalid character field values are removed, and confidence indicator characters in the field values are cleared. When all field values after removal and clearing are empty, the identification is deemed invalid, the failure cooldown timer parameter is updated, and the identification result cache variable remains unchanged. When there are non-empty field values among the removed and cleared field values, the identification is deemed valid, the identification result cache variable is updated, the failure cooldown timer parameter is reset, the consistency judgment is triggered, and the field confirmation status indicator is updated.
[0015] Compared with existing technologies, the advantages of this invention are as follows: An independent state machine is established for each tracked target, and persistent caching and intelligent cooling of recognition results are achieved through multiple state variables. When a single-frame recognition fails, the cache is not cleared; instead, a cooling-off period is initiated to await the next valid recognition, ensuring stable interface display. An intelligent triggering mechanism based on three dimensions—area change rate, center point displacement, and timed refresh—only triggers visual recognition when the target undergoes significant changes or the refresh cycle is reached. When the target is stable and has recently been recognized, the cached result is used directly, avoiding invalid repeated recognition. An adaptive preprocessing mechanism based on size thresholds is introduced to perform high-quality magnification of small targets, ensuring that small targets reach an appropriate recognition size before being sent to the recognition engine. A multi-level result filtering system is constructed, including placeholder word filtering, confidence suffix cleaning, and empty result determination, improving the reliability of recognition results. Adaptive refresh is achieved through a refresh timer; even if the target is still in the frame, recognition will be retried after the refresh cycle is reached to adapt to changes in camera focus. Simultaneously, combined with area change rate detection and center point displacement detection, re-recognition is triggered when the target moves significantly. A field-level confirmation mechanism is implemented. Confirmation and locking are performed after each field is continuously consistent. After all fields are confirmed, the state machine enters a low-power mode, which reduces the frequency of recognition triggering.
[0016] On the other hand, this application also provides a state machine-driven real-time visual recognition trigger control system for applying the above-mentioned state machine-driven real-time visual recognition trigger control method, including: The target tracking and state machine management module is configured to acquire target detection data and establish a target tracking state machine based on the target detection data; The multi-dimensional change detection module is configured to perform multi-dimensional change detection on the target detection data to obtain target change state information; The intelligent decision engine module is configured to determine the visual recognition trigger decision based on the target change state information and the target tracking state machine; The throttling control module is configured to trigger throttling control synchronously when the visual recognition trigger decision is generated; The sharpness assessment module is configured to perform single-frame sharpness assessment on the target detection data based on the visual recognition trigger decision; An adaptive preprocessing module is configured to perform adaptive image preprocessing on the target detection data when the result of the single-frame sharpness assessment is qualified for recognition. The visual recognition module is configured to input the target detection data after adaptive image preprocessing into the visual language model to generate target field recognition results; The field-level confirmation module is configured to verify the validity of the target field identification results and to make consistency judgments on the target field identification results for different identification periods based on the field dimension; when the consistency judgment results are consistent, the target field identification results are temporarily stored in the target tracking state machine. The result filtering module is configured to perform result filtering and verification on the temporarily stored target field identification results; The cache update module is configured to update the target tracking state machine based on the results of filtering and verification; when the filtering verification is valid, the temporarily stored target field identification result is written into the identification result cache variable; when the filtering verification is invalid, the temporarily stored data is discarded and the failure cooldown timer parameter is updated.
[0017] It is understandable that the above-mentioned state machine-driven real-time visual recognition trigger control method and system have the same beneficial effects, and will not be elaborated further here. Attached Figure Description
[0018] Various other advantages and benefits will become apparent to those skilled in the art upon reading the following detailed description of preferred embodiments. The accompanying drawings are for illustrative purposes only and are not intended to limit the invention. Furthermore, the same reference numerals denote the same parts throughout the drawings. In the drawings: Figure 1 A flowchart illustrating a state machine-driven real-time visual recognition trigger control method provided in an embodiment of the present invention; Figure 2 This is a functional block diagram of a state machine-driven real-time visual recognition triggering control system provided in an embodiment of the present invention. Detailed Implementation
[0019] Exemplary embodiments of the present disclosure will now be described in more detail with reference to the accompanying drawings. While exemplary embodiments of the present disclosure are shown in the drawings, it should be understood that the present disclosure may be implemented in various forms and should not be limited to the embodiments set forth herein. Rather, these embodiments are provided to enable a more thorough understanding of the present disclosure and to fully convey the scope of the disclosure to those skilled in the art. It should be noted that, unless otherwise specified, embodiments and features in the embodiments of the present invention can be combined with each other. The present invention will now be described in detail with reference to the accompanying drawings and embodiments.
[0020] In some embodiments of this application, see Figure 1 As shown, a real-time visual recognition trigger control method based on state machine is proposed, including: S1: Acquire target detection data and establish a target tracking state machine based on the target detection data; S2: Perform multi-dimensional change detection on the target detection data to obtain target change state information; S3: Determine the visual recognition trigger decision based on the target change state information and the target tracking state machine; S4: When generating visual recognition-triggered decisions, throttling control is triggered synchronously; S5: Perform single-frame sharpness assessment on target detection data based on visual recognition-triggered decisions; S6: When the single-frame sharpness assessment result is qualified for recognition, adaptive image preprocessing is performed on the target detection data; S7: Input the target detection data after adaptive image preprocessing into the visual language model to generate target field recognition results; S8: Verify the validity of the target field recognition results and make a consistency judgment on the target field recognition results of different recognition periods based on the field dimension; when the consistency judgment results are consistent, temporarily store the target field recognition results in the target tracking state machine. S9: Filter and verify the results of the temporarily stored target field identification; S10: Update the target tracking state machine based on the results of filtering and verification; when the filtering verification is valid, write the temporarily stored target field identification result into the identification result cache variable; when the filtering verification is invalid, discard the temporarily stored data and update the failure cooldown timer parameter.
[0021] In step S1, continuous video frames are first acquired using a video capture device, and then a target detection model is used to perform target detection on the video frames to obtain target detection data. The target detection data includes at least target identification information and target region location information. The target identification information is used to distinguish different targets in continuous video frames, and the target region location information is used to characterize the spatial position of the target in the current video frame, such as the coordinates of the upper left and lower right corners of the target detection box.
[0022] After obtaining the target detection data, a corresponding target tracking state machine is established for each detected target based on the target identification information, so that each target has an independent state management process. For example, when the target detection model detects a target to be identified for the first time, a target tracking state machine instance is created based on the target identification information corresponding to the target, and the current state of the target is initialized to the state to be identified; when targets with the same target identification information are detected in subsequent video frames, the corresponding target tracking state machine is called to continuously manage the identification process of the target.
[0023] The target tracking state machine records the state information of a target from its appearance, identification, confirmation, to its stable state. This includes identification result cache variables, task execution status flags, failure cooldown timer parameters, historical identification timestamps, and field confirmation status flags. The identification result cache variables store the most recent valid identification result for the target. When a subsequent identification task obtains a valid result, the new valid result replaces the cache variable. If an identification task fails or does not obtain a valid result, the existing cached content is not cleared to avoid flickering of the display results due to a single-frame identification failure, thus improving the stability of the real-time identification process.
[0024] The task execution status flag is used to record whether the target is currently in the process of performing a recognition task. For example, when the target region image has been submitted to the visual recognition model for processing, the task execution status flag is set to the execution state to avoid the same target being repeatedly submitted for recognition tasks within the same time period; when the recognition task is completed, the task execution status flag is updated according to the recognition results.
[0025] The failure cooldown timer parameter is used to record the waiting state after a target recognition failure. When the visual recognition task fails or returns no valid recognition result, the failure cooldown timer parameter is updated, causing the target to enter a failure cooldown state. During the failure cooldown state, the visual recognition task is restricted from being triggered again for that target, thereby avoiding continuous repeated recognition due to low-quality images or temporary occlusion.
[0026] Historical identification timestamps are used to record the time information of the target's most recent effective identification task, so as to determine whether the re-identification conditions are met based on the interval between the current time and the historical identification time.
[0027] The field confirmation status identifier is used to record the confirmation status of the target field. Since the stability of different fields may vary during a single recognition process, this embodiment establishes a confirmation status for each field in the target recognition result, rather than making a unified judgment on the overall recognition result.
[0028] The target tracking state machine also includes a field confirmation count parameter. This parameter counts the number of times each individual field in the target field identification result remains consistent across multiple consecutive identification periods.
[0029] Specifically, when a field obtains a value in the current recognition period, it is compared with the corresponding field value in the historical recognition period: if the current field value matches the historical field value, the field confirmation count parameter corresponding to that field is incremented; if the current field value does not match the historical field value, the field confirmation count parameter is re-recorded. When the number of consecutive matches for a field reaches a preset confirmation condition, the field confirmation status flag corresponding to that field is updated to the confirmed status, and the confirmation result is saved to the target tracking state machine. For example, in a target employee badge recognition scenario, the target fields include a name field, a job title field, and a number field. If the name field outputs the same result for multiple consecutive recognition periods, while the job title field still changes, only the name field is set to the confirmed status, while the job title field continues to be observed.
[0030] In step S2, after establishing the target tracking state machine, the target detection data is subjected to real-time change detection for subsequent video frames continuously acquired by the video acquisition device, in order to determine whether the current target has changed relative to the historical recognition state and needs to be re-executed for visual recognition.
[0031] Specifically, based on the target detection data acquired in the current video frame and the historical state information stored in the target tracking state machine, a comprehensive analysis is performed on the target's position changes, size changes, and time changes to generate target change state information describing the degree of change in the target's current state. The target detection data includes target region location information, which at least includes the boundary coordinates of the target detection box. The target region size and center position are determined based on the boundary coordinates and compared with the historical detection states stored in the target tracking state machine.
[0032] During size change detection, the current target region size is determined based on the width and height of the current target detection bounding box, and compared with the target region size corresponding to historical recognition times stored in the target tracking state machine to obtain the target region size change state. Specifically, when the target region size changes significantly, it indicates that the distance between the target and the video acquisition device may have changed. For example, when the target moves closer to the camera, the target region size gradually increases, and the proportion of text or feature areas inside the target in the image increases; when the target moves away from the camera, the target region size decreases, and the amount of effective information recognized decreases. Therefore, by analyzing the degree of target region size change, it is possible to determine whether the target has significantly moved closer or farther away, and generate the corresponding target distance change state. For example, when the current target region size changes more than a preset range compared to the target region size during historical recognition, the target distance change state is set to a changed state to indicate that the current target may need to undergo visual recognition again.
[0033] When performing position change detection, the center position of the target region is determined based on the current target detection box, and compared with the target center position corresponding to the previous recognition cycle or the previous detection cycle to obtain the target motion state.
[0034] Specifically, by calculating the positional offset between the target's center positions in consecutive video frames, it is determined whether the target has moved significantly. When the change in the target's center position is small, it indicates that the target is in a relatively stable state, and there is no need to frequently trigger the visual recognition task. When the target's center position changes significantly, it indicates that the target may have moved, re-entered the recognition area, or its posture has changed, requiring an increase in the probability of re-recognition. Therefore, the target motion state is generated based on the change in the target's center position, and this motion state is used as part of the target change state information for subsequent visual recognition triggering decisions.
[0035] When performing time change detection, the time interval between the current moment and the most recent valid recognition completion time is obtained based on the historical recognition timestamps recorded in the target tracking state machine, and a target refresh state is generated.
[0036] Specifically, when the target remains stable for a long period, even if the location and size of the target area do not change significantly, the recognition task needs to be re-executed according to a preset time cycle to avoid persistent erroneous recognition results due to insufficient initial recognition quality, changes in camera autofocus, or environmental changes. Therefore, when the interval between the current time and the historical effective recognition time reaches the preset refresh cycle, the target refresh state is set to the trigger state so that subsequent visual recognition trigger decisions can be generated based on the target refresh state.
[0037] The target distance change status, target motion status, and target refresh status are comprehensively correlated to generate target change status information. This information describes the degree of change of the current target relative to its historical recognition status and serves as a crucial basis for the target tracking state machine to perform state transitions and for visual recognition trigger judgments. For example, when the target distance change status is in a changed state, it indicates a significant change in target size, potentially indicating an improvement or deterioration in recognition conditions; when the target motion status is in a changed state, it indicates a significant change in target position, requiring reconfirmation of target information; and when the target refresh status is in a triggered state, it indicates that the preset recognition and maintenance cycle has been reached, necessitating periodic recognition.
[0038] In step S3, after obtaining the target change state information, the target recognition state, field confirmation state, and historical recognition time information recorded in the target tracking state machine are further combined to determine whether the current target needs to perform a visual recognition task, thereby generating a corresponding visual recognition trigger decision. Unlike the existing technology that performs recognition tasks at fixed time intervals or for every video frame, this embodiment records the target lifecycle state through the target tracking state machine and dynamically adjusts the trigger frequency of the visual recognition task according to the target's current state, enabling the visual recognition process to adapt to changes in the target's state.
[0039] Specifically, the first step is to determine whether a valid recognition record exists in the target tracking state machine. If the target tracking state machine has not performed a visual recognition task, it indicates that the current target is entering the recognition process for the first time, and there are no available historical recognition results, making it impossible to determine the reliability of the target field information based on historical states. Therefore, a first-time recognition trigger decision is generated, submitting the current target area image to the subsequent visual recognition process to obtain the initial target field recognition results. Through this first-time recognition trigger mechanism, it can be ensured that newly entered targets in the detection area can complete the establishment of their identity information in a timely manner.
[0040] When a valid recognition result already exists in the target tracking state machine, the target field confirmation status is read. When all target fields are in the confirmation state, it indicates that the recognition fields of the current target have undergone consistency verification through multiple recognition cycles, and the current recognition result has high stability. At this time, to avoid continuously performing high-frequency visual recognition tasks on stable targets, the target tracking state machine enters a low-frequency inspection mode.
[0041] In low-frequency inspection mode, the current time is compared with historical valid recognition times. When the time interval between the two reaches a first time interval, a low-frequency inspection trigger decision is generated, and the visual recognition task is re-executed to maintain the validity of the target recognition result. When the first time interval has not been reached, no recognition trigger instruction is generated, and the current confirmation state is maintained. The first time interval is set to be greater than the normal refresh cycle, ensuring that the recognition frequency of confirmed targets is lower than the normal recognition state. For example, after all target fields are confirmed, the recognition cycle can be extended from the normal refresh cycle to several times its original value, thereby reducing the number of visual recognition model calls and reducing computational resource consumption.
[0042] When not all fields in the target tracking state machine are in a confirmed state, it indicates that some field information of the current target is still unstable and needs to be supplemented and confirmed through the visual recognition process. At this time, it is further determined whether there is a change in target distance in the target change state information. When a change in target distance exists, it means that the size of the target area has changed significantly, which may lead to changes in the clarity of the target image, text size, or identifiable information. For example, when the target moves from a distance to a closer location, the size of the target area increases, and fields that were previously unrecognizable may become clear; when the target moves from a closer location to a more distant location, previously confirmed fields may also be affected. Therefore, when a change in target distance is detected, a re-identification trigger decision is generated, and the target area image is reacquired and visual recognition is performed to update the target field recognition results. At the same time, when the target undergoes a significant state change, the reliability of the fields is re-evaluated based on the field confirmation status in the target state machine to avoid historical confirmation results becoming inapplicable due to changes in target scale.
[0043] When not all fields in the target tracking state machine are in the confirmed state, and the target change state information does not include target distance change, it indicates that the target has not undergone significant scale changes, and the recognition environment is relatively stable. In this case, a periodic refresh judgment is made based on the interval between the current time and the historical effective recognition time. When the time interval reaches the second time interval, a regular refresh trigger decision is generated, and periodic recognition is performed on the target to continue acquiring new field recognition results and completing the field confirmation process. When the time interval does not reach the second time interval, the visual recognition task is not triggered, and the current target state is maintained. The second time interval is shorter than the first time interval, ensuring that targets that have not completed field confirmation maintain a higher recognition frequency, while targets that have completed field confirmation have a lower recognition frequency.
[0044] Through the aforementioned triggering decision-making process, the target tracking state machine can automatically adjust its visual recognition strategy based on the target's lifecycle status: when the target first appears, recognition is triggered quickly; when the target fields are not fully confirmed, the normal recognition frequency is maintained, and re-recognition is performed promptly based on changes in the target; once all target fields are confirmed, a low-frequency inspection state is entered, with maintenance recognition only performed when a longer time interval is reached. By controlling the correlation between the target state and the recognition triggering strategy, the visual recognition task is transformed from a fixed execution mode to a dynamic scheduling mode based on the target state. This ensures the stability of the recognition results while reducing invalid recognition tasks and improving the operational efficiency of real-time visual recognition.
[0045] In step S4, after generating a visual recognition trigger decision based on the target change state information and the target tracking state machine, in order to further avoid repeatedly submitting visual recognition tasks for the same target in a short period of time, recognition throttling control is executed synchronously.
[0046] Because target detection results in real-time video scenarios may remain valid across multiple consecutive video frames, and target state change detection may be affected by detection jitter, camera movement, or minor changes in the target bounding box, multiple visual recognition trigger decisions may be generated consecutively within a short period. Directly executing these trigger decisions would lead to repeated calls to the visual recognition model, increasing computational resource consumption and potentially causing excessively high call frequencies to the visual recognition interface. Therefore, this embodiment further maintains historical recognition timestamps in the target tracking state machine, recording the time of the target's most recent execution of a visual recognition task.
[0047] Specifically, after the target tracking state machine generates a visual recognition trigger decision, it first obtains the current timestamp corresponding to the current time and reads the historical recognition timestamps stored in the target tracking state machine. Based on the difference between the current timestamp and the historical recognition timestamps, it determines the time interval since the completion of the last visual recognition task. The time interval characterizes the time distance between the current target and the most recent recognition task execution.
[0048] The time interval is compared with a preset throttling time threshold. When the time interval is less than the throttling time threshold, it indicates that the target has already performed a visual recognition task within a short period of time, and performing the recognition task again at this time may be considered a duplicate call. Therefore, the currently generated visual recognition trigger decision is intercepted, and recognition requests are not sent to subsequent visual recognition modules, while keeping the recognition result cache and field confirmation status in the target tracking state machine unchanged. For example, when the target meets the recognition trigger condition multiple times in consecutive video frames due to slight changes in the detection box, throttling control can prevent repeated calls to the visual language model or OCR recognition service within a short period of time.
[0049] When the time interval is greater than or equal to the throttling time threshold, it indicates that the current target meets the minimum time requirement for re-executing the visual recognition task. At this point, the visual recognition trigger decision is approved, the current target area image is sent to the subsequent recognition processing flow, and after the recognition task is submitted, the current timestamp is updated to the historical recognition timestamp in the target tracking state machine. By updating the historical recognition timestamp, the subsequent recognition trigger process can re-execute the throttling judgment based on the latest recognition time.
[0050] Throttling control and target state triggering decisions work together. Visual recognition triggering decisions determine "whether recognition is needed" based on the target's state, addressing the issue of recognition requirement judgment caused by changes in target state. Throttling control determines "whether immediate recognition is allowed," preventing high-frequency repetitive recognition when multiple triggering conditions are met consecutively. For example, when a target moves significantly, the target change detection module generates a re-recognition triggering decision. However, if the target has already been recognized once within the throttling time threshold, throttling control temporarily prevents the current recognition task from executing. Once the throttling time threshold is exceeded and the recognition conditions are met again, the visual recognition task is executed.
[0051] In step S5, after the target tracking state machine generates a visual recognition trigger decision based on the target change state information, and the visual recognition trigger decision is throttled, the image of the target region in the current video frame to be recognized is further evaluated for sharpness to determine whether the current image quality meets the visual recognition requirements. Since cameras may experience autofocusing, motion blur, or changes in lighting during real-time video acquisition, directly inputting low-quality images into the visual recognition model can easily lead to inaccurate recognition results. Therefore, before executing the visual recognition task, the quality of the current single-frame image is assessed to filter video frames that meet the recognition conditions, avoiding the execution of invalid recognition tasks.
[0052] Specifically, based on the target region location information in the target detection data, the current video frame is cropped to obtain a target region image containing the target to be identified. The target region image is then converted to grayscale, and a sharpness evaluation parameter is calculated. In this embodiment, the sharpness evaluation parameter adopts an evaluation method based on the degree of change of the Laplacian operator. By calculating the statistical characteristics of edge change information in the target region image, the Laplacian operator variance, reflecting the image sharpness, is obtained. A larger Laplacian operator variance indicates more obvious edge texture changes in the target region image and richer effective detail information; a smaller Laplacian operator variance indicates a smoother target region image, which may contain blur.
[0053] The calculated variance of the Laplacian operator is compared with a preset sharpness threshold to determine whether the current target area image meets the recognition criteria. When the variance of the Laplacian operator is less than the preset sharpness threshold, the current target area image is deemed to have insufficient sharpness, resulting in a recognition failure. In this case, subsequent visual recognition tasks are not performed, and the failure cooldown timer parameters in the target tracking state machine are not updated. Instead, the system continues to wait for subsequent video frames and re-performs the sharpness assessment. This method avoids misjudging low-quality images caused by the camera not yet focusing or target movement as recognition failures, thereby reducing invalid failure state updates.
[0054] When the variance of the Laplacian operator is greater than or equal to a preset sharpness threshold, the current target region image is determined to meet the recognition requirements, and a qualified recognition result is generated. At this point, the current target region image is sent to the subsequent adaptive image preprocessing flow to further improve the input quality of the target region image suitable for the visual recognition model.
[0055] In step S6, after the single-frame sharpness evaluation result is deemed acceptable, the size of the target region image is further detected to determine whether the current target region meets the input size requirements of the visual recognition model. Since the target to be recognized in a real-time video scene may be far from the camera, the target region may occupy a small pixel range in the original video frame. For example, the target nameplate area may only contain a few dozen pixels. When directly input into the visual recognition model, the stroke and character structure information is insufficient, easily reducing the recognition accuracy. Therefore, this embodiment performs adaptive scaling processing based on the target region image size to make the target region image reach a size range suitable for recognition.
[0056] Specifically, the width and height information of the cropped target region image are acquired and compared with preset size thresholds. When the width or height of the target region image is smaller than the size threshold, the current target region is determined to be a small-sized recognition target and needs to be magnified. A scaling factor is determined based on the relationship between the current size of the target region image and the preset size threshold, so that the size of the magnified target region image meets the preset recognition requirements. For example, when the target region image size is small, the magnification ratio is determined based on the minimum side size of the target region, and the maximum magnification is limited to avoid excessive magnification that would increase image noise.
[0057] When performing image magnification, a high-quality interpolation method is used to reconstruct the pixels of the target region image to preserve the text edge and texture information in the target region. By using a high-quality interpolation algorithm, the jagged edges caused by simple pixel duplication can be reduced while enlarging the size of the target region image, thereby improving the feature extraction capability of subsequent visual recognition models for small-sized text regions.
[0058] When the target region image size meets the preset size threshold, the current image size remains unchanged, and the process directly proceeds to the subsequent visual recognition processing. Through the aforementioned single-frame sharpness evaluation and adaptive image preprocessing, low-quality images can be filtered out before the visual recognition task is executed, and size optimization is performed for small targets, giving the target region image input to the visual recognition model a more stable quality foundation. Furthermore, since this process is only executed after the target tracking state machine generates the recognition trigger decision, it does not perform additional processing on all video frames, thus improving recognition reliability while reducing overall computational overhead.
[0059] In step S7, after the target region image undergoes sharpness evaluation and adaptive image preprocessing, the target region image that meets the recognition conditions is input into the visual language model to obtain the field information contained in the target region. Unlike traditional OCR, which only performs text matching based on character texture, this embodiment utilizes the visual language model to understand the visual information of the target image content and combines it with preset prompt word constraints to enable the visual language model to output the target recognition result according to the specified field format.
[0060] Specifically, before inputting the target region image into the visual language model, a sequence of cue words is first constructed to constrain the model's output behavior. This cue word sequence includes a description of the target recognition task, field extraction requirements, and anti-illusion constraints. The field extraction requirements specify the types of target fields the visual language model should output, such as name, job title, ID number, document type, and other extended fields. The anti-illusion constraints restrict the visual language model to generate recognition results only based on information actually present in the input target region image, prohibiting the model from generating character content that does not exist in the image based on semantic inference. For example, when a field cannot be clearly identified in the target region image, the visual language model is required to output an empty field, rather than generating a substitute result based on common names, job titles, or example content. Through these cue word constraints, the probability of the visual language model generating false field content when image information is insufficient can be reduced, thus improving the reliability of the recognition results.
[0061] The prompt word sequence and the target region image after adaptive image preprocessing are input into the visual language model. Based on the image content and the field constraints in the prompt word sequence, the visual language model comprehensively analyzes the text regions, graphic information, and document type information in the target region and outputs structured recognition data. In this embodiment, the structured recognition data is output in key-value pair format; for example, the name field corresponds to one field value; the job title field corresponds to one field value; the ID number field corresponds to one field value; and the document type field corresponds to one field value. Simultaneously, the original text information during the model's recognition process can be retained as data for subsequent result verification.
[0062] The structured data output by the visual language model is parsed and converted into target field recognition results. Specifically, based on a preset field set, the field names in the output data are matched, and the corresponding field values are extracted to form target field recognition results in a unified format. For example, the data output by the visual language model is parsed into: name field; job title field; employee ID field; document type field; extended field; and raw text field. This method ensures that data output from different targets and recognition periods has a unified data structure, providing standardized input for subsequent field validity verification and field consistency judgment.
[0063] In step S8, after obtaining the target field recognition result, the validity of the recognition result is further verified, and the historical field states stored in the target tracking state machine are combined to perform a field-level consistency judgment on the target field recognition results obtained in different recognition cycles. Since the target image quality may fluctuate in real-time video scenes, and some fields of the same target may change in different recognition cycles, this embodiment does not adopt the method of confirming the overall result at once, but establishes a confirmation process for each independent field separately.
[0064] Specifically, the validity of the target field identification results obtained in the current identification cycle is first determined. This determination includes whether the field has a valid value, whether the field format meets preset requirements, and whether the field content is a valid identification result. If a field value in the identification result is empty or does not meet the validity conditions, the identification result is not used as a valid confirmation basis, while maintaining the existing valid field states in the target tracking state machine. If a valid field value exists in the identification result, the corresponding field value is compared with the historical field identification results stored in the target tracking state machine.
[0065] Consistency checks are performed for each target field. Specifically, for a field value obtained in the current recognition period, it is matched against the corresponding field value in the previous recognition period. When the field value corresponding to the same field remains consistent across multiple consecutive recognition periods, the confirmation count parameter for that field is accumulated. For example, if the name field yields the same result in three consecutive recognitions, the name field is considered to have high credibility and is set to a confirmed status. If the job title field changes within consecutive recognition periods, it remains in an unconfirmed status and awaits further verification in subsequent recognition periods.
[0066] When the number of consecutive consistent occurrences of a certain field reaches a preset confirmation condition, the field is written into the field confirmation status flag in the target tracking state machine, and the corresponding field confirmation result is updated. This field-level confirmation method allows different fields to enter the confirmation state according to their own stability, without waiting for all fields to stabilize simultaneously. For example, in a name tag recognition scenario, the name field may be easier to recognize due to its larger font size and can be quickly confirmed; while the number field, due to its smaller characters, may require more recognition cycles to complete confirmation.
[0067] Once the target field identification result has passed validity verification and meets the field consistency judgment condition, the confirmed target field identification result is marked as pending verification and temporarily stored in the target tracking state machine, awaiting the final validity judgment by subsequent result filtering and verification identification steps. The target tracking state machine updates the target's current identification status based on the field confirmation status. When all target fields have reached the confirmation status, the target tracking state machine is switched to a stable confirmation status, and the subsequent visual recognition triggering strategy is adjusted. Specifically, in the stable confirmation status, the triggering frequency of visual recognition tasks is reduced, causing the target to enter a low-frequency inspection mode; when not all target fields are confirmed, the normal recognition frequency is maintained to continue improving the field confirmation process.
[0068] In step S9, after the target field recognition result is temporarily stored in the target tracking state machine after field-level confirmation, to further improve the reliability of the recognition result and avoid the influence of abnormal output format content, invalid field content, or content from non-image sources on subsequent state judgments, multi-level filtering and validity verification are performed on the target field recognition result. Since the output result of the visual language model may be affected by image quality, semantic reasoning, and output format constraints, there may be cases of incomplete field formats, field values containing invalid characters, or generated confidence indicators. Therefore, this embodiment standardizes the model output result through structural parsing, field cleaning, and validity judgment.
[0069] Specifically, the target field recognition results output by the visual language model are first subjected to structured parsing. Based on the preset field structure, fields are extracted from the data returned by the model to determine if the returned results meet the preset data format requirements. For example, when the visual language model outputs key-value pairs according to the preset format, the corresponding field names and values are directly extracted; if the returned results have format errors, missing fields, or unparseable structures, the process proceeds to extracting alternative fields.
[0070] When structured parsing fails, regular expressions are used to extract and reconstruct the field content of the original recognized text. Specifically, based on preset field keywords and field arrangement rules, the corresponding field names and their associated content are matched from the original text, converting the unstructured text into the target field recognition result. Through this method, even if the visual language model does not strictly adhere to the preset format, it can retain as much effective recognition information as possible, improving the usability of the recognition results.
[0071] The parsed target field identification results undergo field content cleaning. First, invalid characters in each field value are removed. Invalid characters include special symbols that affect field judgment, format control characters, and redundant characters unrelated to the target field content. For example, when a field value contains separators, explanatory text, or abnormal symbols from the model output process, these contents are filtered out, and only valid field information is retained.
[0072] The confidence level identifier characters in the field values are removed. Since some visual language models may output results like "field content + confidence level value," such as "doctor.90" or "Zhang San (95%)," this type of confidence level information is not the actual content of the target field. Therefore, this embodiment identifies and deletes the confidence level identifier portion in the field values, restoring the field values to the actual identified content. For example, "doctor.90" is processed into "doctor," and "Zhang San (95%)" is processed into "Zhang San."
[0073] After field cleaning, the validity of the target field recognition results is assessed. If all field values are empty, it indicates that no valid target information was obtained in the current recognition cycle, and the visual recognition result is deemed invalid. In cases of invalid recognition results, the current recognition result is not used to overwrite existing valid recognition results in the target tracking state machine. Simultaneously, the failure cooldown timer parameter in the target tracking state machine is updated, causing the current target to enter a recognition failure cooldown state. This method avoids the deletion of existing correct recognition results due to a single recognition failure, improving the stability of the real-time display process.
[0074] When at least one non-empty field value exists among the filtered field values, the current recognition result is deemed valid. At this point, the valid recognition result is updated to the recognition result cache variable in the target tracking state machine, and the failure cooldown timer parameter is reset. Simultaneously, the current valid recognition result is used as data input for field consistency judgment, further updating the confirmation status of the corresponding field. For example, if both the name and job title fields obtain valid results in the current recognition period, they are compared with the corresponding field values in historical recognition periods, and the field confirmation count parameter is updated based on the continuity of field consistency.
[0075] In step S10, based on the obtained recognition validity judgment result, the state parameters in the target tracking state machine are updated to ensure that the target tracking state machine continuously reflects the current recognition status of the target. Specifically, when the current recognition result is valid, the recognition result cache variable in the target tracking state machine is updated, and the field recognition result after filtering and verification is taken as the latest valid recognition result of the current target. At the same time, the historical recognition timestamp is updated to the current recognition task completion time, and the failure cooldown timer parameter is reset, causing the target to exit the recognition failure waiting state.
[0076] After updating the recognition result cache variables, a field confirmation status update is performed based on the current recognition result. For each individual field in the target field, the current recognized field value is compared with the historical field values stored in the target tracking state machine. When the field value remains consistent for multiple consecutive recognition cycles, the confirmation count for the corresponding field is incremented; when the field value changes, the confirmation count for that field is re-recorded. When the field confirmation count reaches a preset condition, the corresponding field confirmation status is updated to "confirmed." Through this method, the target tracking state machine can gradually accumulate field confidence and adjust subsequent visual recognition triggering strategies based on field confirmation status.
[0077] When the current recognition result is invalid, the pending recognition result temporarily stored in the target tracking state machine is discarded. The recognition result cache variable in the target tracking state machine is not updated; instead, the most recent valid recognition result is retained. Simultaneously, a failure cooldown timer parameter is set to prevent the target from resubmitting the visual recognition task within a preset cooldown period. For example, if the target area is occluded or the camera momentarily blurs, causing recognition failure, the previously confirmed target information is retained, and recognition is re-executed after subsequent video frames that meet the conditions.
[0078] Through the above result filtering and state update process, the target field identification results can be validated before entering the state machine management process, achieving: valid results update the state; invalid results are kept in the cache; failure states trigger cooling; and field confirmations are continuously accumulated.
[0079] In one specific embodiment: This embodiment uses the real-time recognition scenario of employee badges at the entrance of an enterprise office area as an example to illustrate the real-time visual recognition trigger control method based on state machine driving proposed in this invention.
[0080] In this embodiment, an indoor surveillance camera fixedly installed at the entrance of the office area is used to collect real-time video streams. The video stream resolution is 1920×1080, and the acquisition frame rate is 25 frames per second. An object detection model is used to detect the employee badge area in the video stream, obtaining target detection data containing the badge area. The object detection model uses the YOLOv8n model, outputting the target detection box position information and corresponding target identification information. Based on the target identification information in consecutive video frames, the same employee badge target is continuously tracked.
[0081] When an employee enters the monitored area for the first time, the target detection model detects the area of the employee's name tag and outputs the corresponding target identification information. A corresponding target tracking state machine is established based on this identification information to manage the recognition lifecycle of the employee's name tag target. Initially, the target tracking state machine does not contain any valid recognition results, so the recognition result cache is set to empty. Simultaneously, it records the current target area size, recognition task execution status, historical recognition time information, and field confirmation status information. At this time, the target tracking state machine is in an initial recognition waiting state, awaiting subsequent trigger decisions.
[0082] The system continuously acquires target detection data from subsequent video frames and performs change detection on the current employee badge area and historical status information. When an employee first enters the monitored area, the current employee badge area size is basically the same as the initial detection size, the target area size changes little, the target center position does not change significantly, and the time interval since the last effective identification is short. Therefore, the generated target change status information indicates that the current target is in a stable initial state.
[0083] The judgment is made based on the target's changing state information and the current state in the target tracking state machine. Since the employee badge target has not yet undergone a valid recognition task, the target tracking state machine determines that the current target is in the initial recognition state. Therefore, an initial recognition trigger decision is generated, preparing to perform visual recognition on the current badge area.
[0084] Before executing the visual recognition task, throttling control is further performed. The current timestamp is obtained, and the historical recognition time information stored in the target tracking state machine is read. Since the target has not yet performed a recognition task, the current time interval meets the throttling condition, thus allowing the visual recognition trigger decision to continue execution.
[0085] The image of the nameplate area in the current video frame is cropped based on the target detection bounding box position, and a single-frame sharpness evaluation is performed. The calculated sharpness evaluation parameter for the current nameplate area image is 25, which is less than the preset sharpness threshold of 30. Since the current video frame is in the camera's autofocus adjustment phase, the edge information of the text area in the image is insufficient; therefore, the current frame is determined not to meet the recognition conditions. At this point, no subsequent visual recognition task is performed, the target failure status is not updated, and no failure cooldown timer parameter is set. Instead, the system continues to wait for subsequent video frames to re-evaluate the sharpness.
[0086] As the employee continues to approach the camera, the size of the name tag area changes significantly within the video frame. For example, the name tag detection area changes from 80×60 pixels initially to 300×200 pixels. Based on this change in target area size, the target change state is calculated, indicating a significant change in target distance. Simultaneously, the target tracking state machine detects that the current target has not yet completed field confirmation, and therefore generates a re-identification trigger decision based on the target change state information.
[0087] After re-identification triggering, the current video frame is re-evaluated for sharpness. At this point, since the camera has focused, the target region sharpness evaluation parameter increases to 45, exceeding the preset sharpness threshold of 30, thus determining that the current image meets the recognition criteria. Subsequently, the target region image size is detected. Because the target region size is still smaller than the input size requirement for the visual recognition model, adaptive image preprocessing is performed. The scaling ratio is determined based on the target region size, and a high-quality interpolation method is used to enlarge the target region image, bringing it within the preset recognition size range. The processed target region image is then input into the visual language model. Simultaneously, a sequence of prompts containing field extraction requirements and anti-hallucination constraints is generated, ensuring that the visual language model outputs recognition results based solely on the actual information present in the image. The visual language model outputs structured recognition results: Name field: Wang Wu; Position field: Software Engineer; Employee ID field: EMP2025001.
[0088] The output of the visual language model is validated. After structured parsing, the recognition result format meets the requirements, and there are no missing fields. Subsequently, the field content is filtered. Specifically, the name field "Wang Wu" is not a preset invalid placeholder; the job title field contains no abnormal characters; and the employee ID field format meets the requirements. Therefore, the current recognition result is deemed valid. Further, the current recognition result is input into the field consistency judgment process. Within three consecutive recognition cycles: First recognition: the confirmation counts for the name, job title, and employee ID fields are all 1; Second recognition: the recognition results for all fields are consistent, and the confirmation count is updated to 2; Third recognition: the recognition results for all fields are consistent again, and the confirmation count reaches the preset confirmation condition. Therefore, the name, job title, and employee ID fields are all updated to the confirmed state and temporarily stored in the target tracking state machine.
[0089] With all fields of the current target confirmed, the target tracking state machine switches from normal recognition state to stable confirmation state. The recognition result cache is updated, saving "Wang Wu," "Software Engineer," and "EMP2025001" as currently valid recognition results. Simultaneously, historical recognition time information is reset, and the subsequent visual recognition triggering strategy is adjusted. Specifically, the original regular refresh cycle is increased from 90 frames to 270 frames, adjusting the subsequent recognition task trigger interval from approximately 3 seconds to approximately 9 seconds. At this point, a low-frequency inspection state is entered, re-executing visual recognition only when a longer time interval is reached or when the target state undergoes a significant change.
[0090] During subsequent inspections, if a visual recognition fails to yield a valid result due to occlusion, blurring, or other reasons, the existing recognition cache will not be immediately cleared. The target tracking state machine retains the most recent valid recognition result and updates the failure cooldown timer parameters, causing the target to enter a short-term recognition restriction state. Therefore, even if the current frame recognition fails, it can still continuously display: "Wang Wu", "Software Engineer", and "EMP2025001" to avoid flickering of recognition results due to single-frame anomalies.
[0091] Based on another preferred embodiment described above, see [link to preferred embodiment]. Figure 2 As shown, this embodiment provides a state machine-driven real-time visual recognition trigger control system for applying the above-described state machine-driven real-time visual recognition trigger control method, including: The target tracking and state machine management module is configured to acquire target detection data and establish a target tracking state machine based on the target detection data; The multi-dimensional change detection module is configured to perform multi-dimensional change detection on the target detection data to obtain target change status information; The intelligent decision engine module is configured to determine the visual recognition trigger decision based on the target change state information and the target tracking state machine; The throttling control module is configured to trigger throttling control synchronously when generating a visual recognition-triggered decision; The sharpness assessment module is configured to perform single-frame sharpness assessment on target detection data based on visual recognition-triggered decisions; The adaptive preprocessing module is configured to perform adaptive image preprocessing on the target detection data when the result of the single-frame sharpness assessment is qualified for recognition. The visual recognition module is configured to input the target detection data after adaptive image preprocessing into the visual language model to generate target field recognition results; The field-level confirmation module is configured to verify the validity of the target field recognition results and to make consistency judgments on the target field recognition results for different recognition periods based on the field dimension; when the consistency judgment results are consistent, the target field recognition results are temporarily stored in the target tracking state machine. The result filtering module is configured to perform result filtering and verification on the temporarily stored target field recognition results. The cache update module is configured to update the target tracking state machine based on the results of filtering and verification; when the filtering verification is valid, the temporarily stored target field identification result is written into the identification result cache variable; when the filtering verification is invalid, the temporarily stored data is discarded and the failure cooldown timer parameter is updated.
[0092] In summary, an independent state machine is established for each tracked target, and persistent caching and intelligent cooling of recognition results are achieved through multiple state variables. When a single frame recognition fails, the cache is not cleared; instead, a cooling-off period is initiated to await the next valid recognition, ensuring stable interface display. An intelligent triggering mechanism based on three dimensions—area change rate, center point displacement, and timed refresh—only triggers visual recognition when the target undergoes significant changes or the refresh cycle is reached. When the target is stable and has recently been recognized, the cached result is used directly, avoiding invalid repeated recognition. An adaptive preprocessing mechanism based on size thresholds is introduced to perform high-quality magnification of small targets, ensuring that small targets reach an appropriate recognition size before being sent to the recognition engine. A multi-layered result filtering system is constructed, including placeholder word filtering, confidence suffix cleaning, and empty result determination, improving the reliability of recognition results. Adaptive refresh is achieved through a refresh timer; even if the target is still in the frame, recognition is retried after the refresh cycle is reached to adapt to changes in camera focus. Simultaneously, combined with area change rate detection and center point displacement detection, re-recognition is triggered when the target moves significantly. A field-level confirmation mechanism is implemented. Confirmation and locking are performed after each field is continuously consistent. After all fields are confirmed, the state machine enters a low-power mode, which reduces the frequency of recognition triggering.
[0093] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of the present invention and not to limit it. Although the present invention has been described in detail with reference to the above embodiments, those skilled in the art should understand that modifications or equivalent substitutions can still be made to the specific implementation of the present invention. Any modifications or equivalent substitutions that do not depart from the spirit and scope of the present invention should be covered within the protection scope of the present invention.
Claims
1. A real-time visual recognition trigger control method based on state machine driving, characterized in that, include: Acquire target detection data and establish a target tracking state machine based on the target detection data; Multi-dimensional change detection is performed on the target detection data to obtain target change state information; Based on the target change state information and the target tracking state machine, a visual recognition trigger decision is determined; When generating the visual recognition trigger decision, throttling control is triggered simultaneously; The target detection data is evaluated for single-frame sharpness based on the visual recognition trigger decision. When the single-frame sharpness evaluation result is qualified for recognition, adaptive image preprocessing is performed on the target detection data; The target detection data after adaptive image preprocessing is input into the visual language model to generate target field recognition results; The validity of the target field identification results is verified, and the consistency of the target field identification results in different identification periods is judged based on the field dimension; when the consistency judgment results are consistent, the target field identification results are temporarily stored in the target tracking state machine. The temporarily stored target field identification results are filtered and verified. The target tracking state machine is updated based on the results of filtering and verification. When the filtering verification is valid, the temporarily stored target field identification result is written into the identification result cache variable. When the filtering verification is invalid, the temporarily stored data is discarded and the failure cooldown timer parameter is updated.
2. The real-time visual recognition trigger control method based on state machine driving according to claim 1, characterized in that, Establish a target tracking state machine based on the target detection data, including: Extract target identification information from the target detection data and establish a target tracking state machine for each target identification information; the target tracking state machine includes identification result cache variables, task execution status identifiers, failure cooldown timer parameters, historical identification timestamps, and field confirmation status identifiers.
3. The real-time visual recognition trigger control method based on state machine driving according to claim 2, characterized in that, The target tracking state machine also includes a field confirmation count parameter; The field confirmation count parameter is the number of times the field value matches within a continuous recognition period for each independent field in the target field recognition result.
4. The real-time visual recognition trigger control method based on state machine driving according to claim 3, characterized in that, When obtaining information about the target's changing state, the following is included: Change detection is performed based on the position change information, size change information, and time change information of the target detection data; wherein, the target distance change state is determined based on the target area size change; the target motion state is determined based on the target area center position change; the target refresh state is determined based on the time interval from the last valid recognition; and target change state information is generated based on the target distance change state, target motion state, and target refresh state.
5. The real-time visual recognition trigger control method based on state machine driving according to claim 4, characterized in that, When determining whether visual recognition triggers a decision, the following should be included: Provided that the failure cooling timer parameter is not in a cooling state and the task execution status is marked as non-execution, the following judgments are made: When the target tracking state machine has not executed an identification task, a first identification trigger decision is generated; when all fields in the target tracking state machine are in a confirmed state, a low-frequency inspection trigger decision is generated when a first time interval is met; when not all fields in the target tracking state machine are in a confirmed state, and the target change status information includes the target distance change status, a re-identification trigger decision is generated; when not all fields in the target tracking state machine are in a confirmed state, and the target change status information does not include the target distance change status, a regular refresh trigger decision is generated when a second time interval is met. Wherein, the first time interval is greater than the second time interval.
6. The real-time visual recognition trigger control method based on state machine driving according to claim 5, characterized in that, When throttling control is triggered, it includes: Obtain the current timestamp and calculate the time difference between the current timestamp and the historical identification timestamp in the target tracking state machine; When the time difference is less than the throttling time threshold, the visual recognition trigger decision is blocked; when the time difference is greater than or equal to the throttling time threshold, the visual recognition trigger decision is allowed, and the current timestamp is updated to the historical recognition timestamp.
7. The real-time visual recognition trigger control method based on state machine driving according to claim 6, characterized in that, When performing single-frame sharpness assessment and adaptive image preprocessing on the target detection data, the following steps are included: Calculate the Laplacian operator variance of the target region image in the target detection data; when the Laplacian operator variance is less than the sharpness threshold, the result of the single-frame sharpness evaluation is determined to be unqualified; when the Laplacian operator variance is greater than or equal to the sharpness threshold, the result of the single-frame sharpness evaluation is determined to be qualified. When the recognition is deemed successful, the pixel size of the target region image is obtained; when the pixel size is less than a size threshold, a scaling factor is determined based on the size threshold, and the target region image is magnified.
8. The real-time visual recognition trigger control method based on state machine driving according to claim 7, characterized in that, When generating the target field recognition results, the following are included: Construct a sequence of prompt words with anti-hallucination constraint instructions, wherein the anti-hallucination constraint instructions are used to restrict the visual language model from outputting non-image source characters and placeholder characters; The prompt word sequence and the target detection data after adaptive image preprocessing are input into the visual language model, and structured data is output; the structured data is parsed into target field recognition results of multiple key-value pairs.
9. The real-time visual recognition trigger control method based on state machine driving according to claim 8, characterized in that, When performing result filtering and verification identification, the following are included: The target field identification result is structured and parsed. When parsing fails, the field content is extracted and reconstructed using regular expressions. Invalid character field values are removed, and confidence level identifier characters in the field values are cleared. When all field values after removal and clearing are empty, the identification is deemed invalid, the failure cooldown timer parameter is updated, and the identification result cache variable remains unchanged. When there are non-empty field values among the removed and cleared field values, the identification is deemed valid, the identification result cache variable is updated, the failure cooldown timer parameter is reset, the consistency judgment is triggered, and the field confirmation status identifier is updated.
10. A state machine-driven real-time visual recognition trigger control system, used to apply the state machine-driven real-time visual recognition trigger control method as described in any one of claims 1-9, characterized in that, include: The target tracking and state machine management module is configured to acquire target detection data and establish a target tracking state machine based on the target detection data; The multi-dimensional change detection module is configured to perform multi-dimensional change detection on the target detection data to obtain target change state information; The intelligent decision engine module is configured to determine the visual recognition trigger decision based on the target change state information and the target tracking state machine; The throttling control module is configured to trigger throttling control synchronously when the visual recognition trigger decision is generated; The sharpness assessment module is configured to perform single-frame sharpness assessment on the target detection data based on the visual recognition trigger decision; An adaptive preprocessing module is configured to perform adaptive image preprocessing on the target detection data when the result of the single-frame sharpness assessment is qualified for recognition. The visual recognition module is configured to input the target detection data after adaptive image preprocessing into the visual language model to generate target field recognition results; The field-level confirmation module is configured to verify the validity of the target field identification results and to make consistency judgments on the target field identification results for different identification periods based on the field dimension; when the consistency judgment results are consistent, the target field identification results are temporarily stored in the target tracking state machine. The result filtering module is configured to perform result filtering and verification on the temporarily stored target field identification results; The cache update module is configured to update the target tracking state machine based on the results of filtering and verification; when the filtering verification is valid, the temporarily stored target field identification result is written into the identification result cache variable; when the filtering verification is invalid, the temporarily stored data is discarded and the failure cooldown timer parameter is updated.