Multi-task image analysis method and system based on producer-consumer mode
By employing a producer-consumer pattern multi-task image analysis method in satellite embedded software and constructing a data computation queue, the multi-task image analysis system achieves efficient and accurate data processing in scenarios with concurrent multi-source data, solving the problems of data analysis result deviation and reception loss.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- SHANGHAI SATELLITE ENG INST
- Filing Date
- 2026-01-04
- Publication Date
- 2026-05-12
AI Technical Summary
In existing satellite embedded software, multi-task image analysis systems are prone to data analysis result deviations and data loss when facing scenarios with concurrent multi-source data and parallel multi-processes, making it impossible to effectively utilize limited resources for rapid analysis.
By adopting a producer-consumer model, a data computing queue is constructed to enable image data receiving and preprocessing tasks (producers) and image data computing and analysis tasks (consumers) to run in parallel. The queue is used to cache data interaction, ensuring the accuracy and efficient execution of data analysis results.
In scenarios where data generation is rapid and analysis is time-consuming, ensuring complete data reception and output of correct results improves the efficiency and accuracy of multi-task image analysis systems.
Smart Images

Figure CN122019080A_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of image data processing technology, and more specifically, to a multi-task image analysis method and system based on a producer-consumer model. Background Technology
[0002] With the rapid development of satellite remote sensing technology, on-board data processing capabilities have become one of the core elements for improving the effectiveness of satellite applications. Among them, embedded software, as the nerve center of the satellite unit, undertakes the real-time analysis and processing of various types of image data. The multi-task image analysis system is embedded software running within the satellite's main unit, performing complex computational functions. This system receives data from multiple sources, and when preset trigger conditions are met, these sources simultaneously generate massive amounts of image data, requiring the system to synchronously initiate multiple analysis processes for parallel processing. However, onboard computing resources are limited, necessitating that the image analysis system, while ensuring the accuracy of the analysis results, utilize these limited resources to output the results as quickly as possible.
[0003] In the current field of satellite embedded software, the scheduling and execution of multiple tasks typically rely on kernel tasks being triggered by timers or specific synchronization objects. This mechanism can meet basic needs when handling simple tasks, but it exposes obvious limitations when facing complex scenarios with concurrent multi-source data and parallel multi-processes: if the processing time of a task exceeds the preset maximum time threshold, it is very easy to cause the loss of subsequently received data, which in turn leads to deviations in data analysis results.
[0004] A patent search revealed invention patent CN111158921B, which discloses a distributed telemetry acquisition method and system based on a multi-task mechanism. The system includes a main task, source tasks, source task locks, and a source telemetry buffer pool. These source tasks, locks, and buffer pools exist as a set of source components. The main task initiates telemetry processing and interacts with the source tasks through the source task locks. Each source task possesses a source task lock and issues telemetry acquisition commands. Each source task acquires telemetry data from multiple sources of the same type and stores the acquired data in its corresponding source telemetry buffer pool. The main task processes all data in the source telemetry buffer pools uniformly according to a set period. This patent focuses on distributed telemetry acquisition and does not involve complex image analysis and processing, limiting its application scenario.
[0005] The invention patent with publication number CN111427671B discloses a pipeline navigation calculation method implemented by multi-task in spaceborne software. The method includes: employing a timed triggering + conditional triggering approach, with the attitude and orbit control task scheduled as a timed task, and the pipeline navigation task determined and awakened by the attitude and orbit control task; prioritizing the correct execution of the attitude and orbit control task, with the task priority order as follows: attitude and orbit control task > pipeline navigation task > background task; protecting read / write operations of shared data between tasks through locking and unlocking, with the current task having the highest priority when reading / writing shared data, and restoring the user-set priority after the read / write operation is completed. This patent addresses pipeline navigation calculation implemented by multi-task in spaceborne software, but does not cover concurrent multi-source image data and parallel multi-process analysis, and cannot solve the problems of data reception integrity and data analysis correctness when the data analysis task execution time is long and uncertain.
[0006] In summary, given the problems of the existing technologies, researching a multi-task image analysis method and system based on the producer-consumer model has become a critical task that urgently needs to be addressed. Summary of the Invention
[0007] To address the shortcomings of existing technologies, the purpose of this invention is to provide a multi-task image analysis method and system based on a producer-consumer model.
[0008] A multi-task image analysis method based on a producer-consumer model, provided by the present invention, includes the following steps: Step S1: Start the image data receiving and preprocessing task, receive externally input image preprocessing data and image feature data, and cache the image preprocessing data to the preprocessing data cache queue and cache the image feature data to the feature data queue. Step S2: The image data receiving and preprocessing task attempts to acquire the ID feature data lock that has already started to be calculated. The ID feature data lock is used to control access to the ID feature data array that has already started to be calculated. The ID feature data array that has already started to be calculated is generated by the image data calculation and analysis task. Step S3: When the image data receiving and preprocessing task successfully acquires the ID feature data lock, it reads the ID feature data array that has started calculation generated by the image data calculation and analysis task, and determines whether the ID feature contained in the current image preprocessing data exists in the ID feature data array that has started calculation; if it exists, the current image preprocessing data is put into the calculation queue; if it does not exist, the current image preprocessing data is kept in the preprocessing data cache queue. Step S4: Start the image data calculation and analysis task. The image data calculation and analysis task is triggered by a timer and runs in parallel with the image data receiving and preprocessing task. Step S5: The image data calculation and analysis task retrieves feature long packet data from the feature data queue and checks whether the feature long packet data has a value. If there is a value, it performs matching calculation on the feature long packet data and the preprocessed data in the preprocessed data cache queue, puts the matching result into the calculation queue, and stores the matched ID feature into the ID feature data array that has started calculation. Step S6: The image data calculation and analysis task checks if there is a value in the calculation queue; if there is a value, it reads the image feature data from the calculation queue, performs the calculation, and assigns the calculation result to the telemetry data. Step S7: The image data calculation and analysis task obtains the system broadcast time and records the time when each calculation is completed as the current time of image data calculation. It then determines whether the difference between the current time of image data calculation and the system broadcast time exceeds a set time. If it exceeds the set time, the calculation end judgment program is started. Step S8: In the calculation end judgment program, it is determined whether the difference between the data receiving update cycle and the current running cycle exceeds a given value; if it exceeds the given value, the corresponding ID feature is cleared from the ID feature data array that has started calculation, and the cached data occupied by the ID feature is released. In this process, the image data receiving and preprocessing task and the image data calculation and analysis task run in parallel through the cyclic execution of steps S1 to S8 until the external input is terminated.
[0009] Preferably, in step S1, the image preprocessing data and the image feature data are stored in their respective first-in-first-out queues. For the image preprocessing data, it is determined whether the ID contained in the data has been calculated. If the calculation has started, the image preprocessing data is placed in the calculation queue; if the calculation has not started, the image preprocessing data is placed in the preprocessing data cache queue, and the image feature data is placed in the feature data queue without any additional processing.
[0010] Preferably, in step S2, the ID feature data array that has begun calculation is generated by the image data calculation and analysis task by matching the feature long packet data with the preprocessed data in the preprocessed data cache queue; after the matching is completed, the successfully matched ID features are stored in the ID feature data array that has begun calculation. When the image data receiving and preprocessing task accesses the ID feature data array that has begun calculation, it must first acquire the ID feature data lock. Preferably, the image data receiving and preprocessing task acts as a producer, storing the data to be calculated into a calculation queue; the image data calculation and analysis task acts as a consumer, retrieving data from the calculation queue for calculation and analysis; the calculation queue is written to by the producer and read by the consumer.
[0011] Preferably, in step S3, after the image data receiving and preprocessing task acquires the ID feature data lock, it first copies the ID feature data array that has already started to be calculated to the local cache, and then determines whether the ID feature of the current image preprocessing data exists in the ID feature data array that has already started to be calculated in the local cache; if it exists, the current image preprocessing data is put into the calculation queue; if it does not exist, the current image preprocessing data is kept in the preprocessing data cache queue.
[0012] Preferably, in step S3, the image data receiving and preprocessing task and the image data calculation and analysis task interact through a synchronization data object. The synchronization data object includes a calculation queue, system broadcast time, an array of ID feature data that has started calculation, and calculation telemetry data. The storage length of the synchronization data object is configured according to the data flow.
[0013] Preferably, in step S6, the image data calculation and analysis task synchronizes the calculated state variables to the image data receiving and preprocessing task via telemetry data, and the image data receiving and preprocessing task receives telemetry data at fixed intervals.
[0014] Preferably, in step S6, the number of data entries read from the computation queue per cycle is set by configuring parameters.
[0015] Preferably, in step S7, the image data calculation and analysis task obtains the system broadcast time through the synchronization data object. The system broadcast time is periodically obtained and updated by the image data receiving and preprocessing task from the external system.
[0016] This invention also provides a multi-task image analysis system based on a producer-consumer model, comprising: Module M1 initiates the image data receiving and preprocessing task, receives externally input image preprocessing data and image feature data, and caches the image preprocessing data to the preprocessing data cache queue and the image feature data to the feature data queue. Module M2, the image data receiving and preprocessing task, attempts to acquire the ID feature data lock that has already started calculation. The ID feature data lock is used to control access to the ID feature data array that has already started calculation. The ID feature data array that has already started calculation is generated by the image data calculation and analysis task. Module M3, when the image data receiving and preprocessing task successfully acquires the ID feature data lock, reads the ID feature data array that has started calculation generated by the image data calculation and analysis task, and determines whether the ID feature contained in the current image preprocessing data exists in the ID feature data array that has started calculation; if it exists, the current image preprocessing data is put into the calculation queue; if it does not exist, the current image preprocessing data is kept in the preprocessing data cache queue. Module M4 initiates the image data calculation and analysis task, which is triggered by a timer and runs in parallel with the image data receiving and preprocessing task. Module M5, the image data calculation and analysis task, retrieves feature long packet data from the feature data queue and checks if the feature long packet data has a value; if it has a value, it performs matching calculations on the feature long packet data and the preprocessed data in the preprocessed data cache queue, puts the matching result into the calculation queue, and stores the matched ID features into the ID feature data array that has started calculation. Module M6, Image Data Calculation and Analysis Task checks if there is a value in the calculation queue; if there is a value, it reads the image feature data from the calculation queue, performs the calculation, and assigns the calculation result to the telemetry data; Module M7, the image data calculation and analysis task, acquires the system broadcast time and records the time when each calculation is completed as the current time of image data calculation. It then determines whether the difference between the current time of image data calculation and the system broadcast time exceeds a set time. If it exceeds the set time, it starts the calculation end judgment program. In the calculation completion judgment program, module M8 determines whether the difference between the data receiving update cycle and the current running cycle exceeds a given value; if it exceeds the given value, it clears the corresponding ID feature from the ID feature data array that has already started calculation and releases the cached data occupied by that ID feature. The image data receiving and preprocessing task and the image data calculation and analysis task run in parallel through the cyclic execution of modules M1 to M8 until the external input is terminated.
[0017] Compared with the prior art, the present invention has the following beneficial effects: This invention constructs a data computing queue as a data interaction carrier between tasks and sets up image data receiving and preprocessing tasks (producers) and image data computing and analysis tasks (consumers), forming a producer-consumer model. This model uses the queue to cache computing objects, effectively adapting to the differences between scenarios where data generation is fast and data analysis tasks are time-consuming and have uncertain analysis times. While ensuring the accuracy of data analysis results, it also achieves efficient execution of image data analysis tasks. Attached Figure Description
[0018] Other features, objects, and advantages of the present invention will become more apparent from the following detailed description of non-limiting embodiments with reference to the accompanying drawings: Figure 1 This is a flowchart illustrating the data interaction and analysis process of a multi-task image analysis method based on a producer-consumer model, as described in an embodiment of the present invention. Figure 2This is a schematic diagram of a multi-task image analysis system based on a producer-consumer model, as described in an embodiment of the present invention. Detailed Implementation
[0019] The present invention will now be described in detail with reference to specific embodiments. These embodiments will help those skilled in the art to further understand the present invention, but do not limit the invention in any way. It should be noted that those skilled in the art can make several changes and improvements without departing from the concept of the present invention. These all fall within the protection scope of the present invention.
[0020] This invention provides a multi-task image analysis method and system based on the producer-consumer model, which can ensure complete data reception and output of correct results in scenarios where data generation is fast and analysis is time-consuming.
[0021] Example 1: Figure 1 This is a flowchart illustrating the data interaction and analysis process of a multi-task image analysis method based on a producer-consumer model, as described in an embodiment of the present invention.
[0022] like Figure 1 As shown, this embodiment provides a multi-task image analysis method based on the producer-consumer model, including the following steps: Step S1: Start the image data receiving and preprocessing task, receive externally input image preprocessing data and image feature data, and cache the image preprocessing data to the preprocessing data cache queue and cache the image feature data to the feature data queue.
[0023] Specifically, image preprocessing data and image feature data are stored in their respective first-in-first-out queues. For image preprocessing data, it is determined whether the ID contained in the data has been calculated. If it has been calculated, the image preprocessing data is placed in the calculation queue; if it has not been calculated, the image preprocessing data is placed in the preprocessing data cache queue, and the image feature data is placed in the feature data queue without any additional processing.
[0024] In step S2, the image data receiving and preprocessing task attempts to acquire the ID feature data lock that has already started to be calculated. The ID feature data lock is used to control access to the ID feature data array that has already started to be calculated. The ID feature data array that has already started to be calculated is generated by the image data calculation and analysis task.
[0025] Specifically, the ID feature data array that has begun computation is generated by the image data computation and analysis task by matching the feature long packet data with the preprocessed data in the preprocessed data cache queue. After the matching is completed, the successfully matched ID features are stored in the ID feature data array that has begun computation. When the image data receiving and preprocessing task accesses the ID feature data array that has begun computation, it must first acquire the ID feature data lock. Furthermore, the image data receiving and preprocessing task acts as a producer, storing the data to be calculated into the calculation queue; the image data calculation and analysis task acts as a consumer, retrieving data from the calculation queue for calculation and analysis; the calculation queue is written to by the producer and read by the consumer.
[0026] Step S3: When the image data receiving and preprocessing task successfully acquires the ID feature data lock, it reads the ID feature data array that has started calculation generated by the image data calculation and analysis task, and determines whether the ID feature contained in the current image preprocessing data exists in the ID feature data array that has started calculation; if it exists, the current image preprocessing data is put into the calculation queue; if it does not exist, the current image preprocessing data is kept in the preprocessing data cache queue. In this embodiment, the data generation rate of the image data receiving and preprocessing tasks is higher than the data processing rate of the image data calculation and analysis tasks. The image data calculation and analysis tasks require feature matching and data analysis during a single cycle of computation, resulting in a longer processing time.
[0027] Specifically, after the image data receiving and preprocessing task acquires the ID feature data lock, in order to minimize the lock's holding time and reduce mutual interference between tasks, it first copies the ID feature data array that has already started calculation to the local cache, and then determines whether the ID feature of the current image preprocessing data exists in the ID feature data array that has already started calculation in the local cache; if it exists, the current image preprocessing data is put into the calculation queue; if it does not exist, the current image preprocessing data is kept in the preprocessing data cache queue.
[0028] Furthermore, the image data receiving and preprocessing tasks and the image data calculation and analysis tasks interact through a synchronization data object. The synchronization data object includes a calculation queue, system broadcast time, an array of ID feature data that has started calculation, and calculation telemetry data. The storage length of the synchronization data object is configured according to the data flow.
[0029] Step S4: Start the image data calculation and analysis task. The image data calculation and analysis task is triggered by a timer and runs in parallel with the image data receiving and preprocessing task. In step S5, the image data calculation and analysis task retrieves feature long packet data from the feature data queue and checks whether the feature long packet data has a value. If a value is found, the feature long packet data and the preprocessed data in the preprocessed data cache queue are matched and calculated. The matching result is placed in the calculation queue, and the matched ID feature is stored in the ID feature data array that has started calculation. This allows the image data receiving and preprocessing task to determine the storage direction of the data when receiving preprocessed data.
[0030] In this embodiment, the number of feature packets processed and the number of data entries analyzed and calculated per cycle of the image data calculation and analysis task are configured according to the processor's processing speed, so as to maximize the use of the remaining time outside of data reception for calculation and improve the efficiency of data calculation.
[0031] Step S6: The image data calculation and analysis task checks if there is a value in the calculation queue; if there is a value, it reads the image feature data from the calculation queue, performs the calculation, and assigns the calculation result to the telemetry data.
[0032] Specifically, in step S6, the image data calculation and analysis task calculates the state variables and synchronizes them to the image data receiving and preprocessing task through telemetry data. The image data receiving and preprocessing task receives telemetry data at fixed intervals.
[0033] Furthermore, the number of data entries read from the computation queue per cycle can be set through configuration parameters. These parameters are determined based on a combination of data reception integrity requirements and computational resource utilization to balance the efficiency of data reception and computational processing.
[0034] Step S7: The image data calculation and analysis task obtains the system broadcast time and records the time when each calculation is completed as the current time of image data calculation. It then determines whether the difference between the current time of image data calculation and the system broadcast time exceeds a set time. If it exceeds the set time, the calculation end judgment program is started. In this embodiment, since the processed data contains time information and the current time is obtained periodically through time broadcasting, the difference between the time contained in the processed data and the current time is compared to determine whether data for a certain ID will continue to be generated. If the time difference reaches a specified time, the cache corresponding to the ID data is cleared, and the specified time is configured according to the data generation situation.
[0035] Furthermore, when time requirements change, the processing flow of image data receiving and preprocessing tasks and image data calculation and analysis tasks can be reallocated, and the cache space and cache data types can be increased to improve data receiving efficiency or calculation efficiency.
[0036] Specifically, in step S7, the image data calculation and analysis task obtains the system broadcast time through the synchronization data object. The system broadcast time is periodically obtained and updated by the image data receiving and preprocessing task from the external system.
[0037] Step S8: In the calculation end judgment program, it is determined whether the difference between the data receiving update cycle and the current running cycle exceeds a given value; if it exceeds the given value, the corresponding ID feature is cleared from the ID feature data array that has started calculation, and the cached data occupied by the ID feature is released. In this embodiment, an upper limit is set for the number of IDs that can be processed simultaneously. This upper limit is related to the size of the allocated cache; the more IDs processed simultaneously, the larger the cache is required. When it is detected that no new data has been generated for a certain ID within a specified time interval, the cache data corresponding to that ID is cleared.
[0038] In this process, the image data receiving and preprocessing task and the image data calculation and analysis task run in parallel through the cyclic execution of steps S1 to S8 until the external input is terminated.
[0039] Example 2: The present invention also provides a multi-task image analysis system based on the producer-consumer model. The multi-task image analysis system based on the producer-consumer model can be implemented by executing the process steps of the multi-task image analysis method based on the producer-consumer model. That is, those skilled in the art can understand the multi-task image analysis method based on the producer-consumer model as a preferred implementation of the multi-task image analysis system based on the producer-consumer model.
[0040] Figure 2 This is a schematic diagram of a multi-task image analysis system based on a producer-consumer model, as described in an embodiment of the present invention.
[0041] like Figure 2 As shown, the system includes image data reception and preprocessing tasks and image data computation and analysis tasks. The former completes the reception, preprocessing, and storage of external data, while the latter analyzes the external data; the former acts as a producer, providing data to be analyzed, while the latter acts as a consumer, performing the analysis, and the two collaborate through a computational data queue.
[0042] Because external data arrives quickly and the integrity of the received data affects the analysis results, while the computational analysis task takes a long time, the receiving preprocessing task is given a high priority and the computational analysis task is given a low priority.
[0043] Both image data receiving and preprocessing tasks and image data calculation and analysis tasks are triggered by timers. The execution cycle of the image data receiving and preprocessing task matches the external data generation rate to ensure no data loss. The image data calculation and analysis task periodically checks multiple data queues and processes them according to a set number of records. Low-priority calculation and analysis tasks can be interrupted by high-priority receiving and preprocessing tasks. That is, during the analysis process, when the timer for the image data receiving and preprocessing task expires, the data calculation and analysis operation will stop, and the data receiving and preprocessing operations will be executed.
[0044] The system involves a preprocessed data cache queue, a feature long packet cache queue, and a computation queue. The enqueue, dequeue, lookup, and deletion operations of these queues are synchronized through protected objects to ensure data consistency among multiple tasks.
[0045] Specifically, this multi-task image analysis system based on the producer-consumer model includes: Module M1 initiates the image data receiving and preprocessing task, receives externally input image preprocessing data and image feature data, and caches the image preprocessing data to the preprocessing data cache queue and the image feature data to the feature data queue. Module M2, the image data receiving and preprocessing task, attempts to acquire the ID feature data lock that has already started calculation. The ID feature data lock is used to control access to the ID feature data array that has already started calculation. The ID feature data array that has already started calculation is generated by the image data calculation and analysis task. Module M3, when the image data receiving and preprocessing task successfully acquires the ID feature data lock, reads the ID feature data array that has started calculation generated by the image data calculation and analysis task, and determines whether the ID feature contained in the current image preprocessing data exists in the ID feature data array that has started calculation; if it exists, the current image preprocessing data is put into the calculation queue; if it does not exist, the current image preprocessing data is kept in the preprocessing data cache queue. In this embodiment, the data generation rate of the image data receiving and preprocessing tasks is higher than the data processing rate of the image data calculation and analysis tasks. The image data calculation and analysis tasks require feature matching and data analysis during a single cycle of computation, resulting in a longer processing time.
[0046] Module M4 initiates the image data calculation and analysis task, which is triggered by a timer and runs in parallel with the image data receiving and preprocessing task. Module M5, the image data calculation and analysis task, retrieves feature long packet data from the feature data queue and checks if the feature long packet data has a value; if it has a value, it performs matching calculations on the feature long packet data and the preprocessed data in the preprocessed data cache queue, puts the matching result into the calculation queue, and stores the matched ID features into the ID feature data array that has started calculation. Module M6, Image Data Calculation and Analysis Task checks if there is a value in the calculation queue; if there is a value, it reads the image feature data from the calculation queue, performs the calculation, and assigns the calculation result to the telemetry data; Module M7, the image data calculation and analysis task, acquires the system broadcast time and records the time when each calculation is completed as the current time of image data calculation. It then determines whether the difference between the current time of image data calculation and the system broadcast time exceeds a set time. If it exceeds the set time, it starts the calculation end judgment program. In the calculation completion judgment program, module M8 determines whether the difference between the data receiving update cycle and the current running cycle exceeds a given value; if it exceeds the given value, it clears the corresponding ID feature from the ID feature data array that has already started calculation and releases the cached data occupied by that ID feature. The image data receiving and preprocessing task and the image data calculation and analysis task run in parallel through the cyclic execution of modules M1 to M8 until the external input is terminated.
[0047] Those skilled in the art will understand that, besides implementing the system and its various devices, modules, and units provided by this invention in the form of purely computer-readable program code, the same functions can be achieved entirely through logical programming of the method steps, making the system and its various devices, modules, and units of this invention function in the form of logic gates, switches, application-specific integrated circuits, programmable logic controllers, and embedded microcontrollers. Therefore, the system and its various devices, modules, and units provided by this invention can be considered as a hardware component, and the devices, modules, and units included therein for implementing various functions can also be considered as structures within the hardware component; alternatively, the devices, modules, and units for implementing various functions can be considered as both software modules implementing the method and structures within the hardware component.
[0048] Specific embodiments of the present invention have been described above. It should be understood that the present invention is not limited to the specific embodiments described above, and those skilled in the art can make various changes or modifications within the scope of the claims, which do not affect the essence of the present invention. Unless otherwise specified, the embodiments and features described in this application can be arbitrarily combined with each other.
Claims
1. A multi-task image analysis method based on the producer-consumer model, characterized in that, Includes the following steps: Step S1: Start the image data receiving and preprocessing task, receive externally input image preprocessing data and image feature data, and cache the image preprocessing data to the preprocessing data cache queue and the image feature data to the feature data queue; In step S2, the image data receiving and preprocessing task attempts to acquire the ID feature data lock that has already started calculation. The ID feature data lock is used to control access to the ID feature data array that has already started calculation. The ID feature data array that has already started calculation is generated by the image data calculation and analysis task. Step S3: When the image data receiving and preprocessing task successfully acquires the ID feature data lock, it reads the ID feature data array that has started to be calculated generated by the image data calculation and analysis task, and determines whether the ID feature contained in the current image preprocessing data exists in the ID feature data array that has started to be calculated. If it exists, the current image preprocessing data is placed in the calculation queue; if it does not exist, the current image preprocessing data is retained in the preprocessing data cache queue. Step S4: Start the image data calculation and analysis task. The image data calculation and analysis task is triggered by a timer and runs in parallel with the image data receiving and preprocessing task. Step S5: The image data calculation and analysis task obtains feature long packet data from the feature data queue and checks whether the feature long packet data has a value; if there is a value, it performs matching calculation on the feature long packet data and the preprocessed data in the preprocessed data cache queue, puts the matching result into the calculation queue, and stores the matched ID feature into the ID feature data array that has started calculation. Step S6: The image data calculation and analysis task checks whether there is a value in the calculation queue; if there is a value, it reads the image feature data from the calculation queue, performs the calculation, and assigns the calculation result to the telemetry data. Step S7: The image data calculation and analysis task obtains the system broadcast time and records the time when each calculation is completed as the current time of calculating image data, and determines whether the difference between the current time of calculating image data and the system broadcast time exceeds a set time. If the set time is exceeded, the calculation end determination procedure will be initiated. Step S8: In the calculation end judgment procedure, it is determined whether the difference between the data receiving update cycle and the current running cycle exceeds a given value; if it exceeds the given value, the corresponding ID feature is cleared from the ID feature data array that has started calculation, and the cached data occupied by the ID feature is released. In this process, through the cyclic execution of steps S1 to S8, the image data receiving and preprocessing task and the image data calculation and analysis task run continuously in parallel until the external input terminates.
2. The multi-task image analysis method based on the producer-consumer model as described in claim 1, characterized in that, In step S1, the image preprocessing data and the image feature data are stored in their respective first-in-first-out queues. For the image preprocessing data, it is determined whether the ID contained in the data has been calculated. If the calculation has started, the image preprocessing data is placed in the calculation queue. If the calculation has not started, the image preprocessing data is placed in the preprocessing data cache queue, and the image feature data is placed in the feature data queue without additional processing.
3. The multi-task image analysis method based on the producer-consumer model as described in claim 1, characterized in that, In step S2, the ID feature data array that has already started calculation is generated by the image data calculation and analysis task by matching feature long packet data with preprocessed data in the preprocessed data cache queue; After matching is completed, the successfully matched ID features are stored in the ID feature data array that has started to be calculated. When the image data receiving and preprocessing task accesses the ID feature data array that has started to be calculated, it must first acquire the ID feature data lock.
4. The multi-task image analysis method based on the producer-consumer model as described in claim 1, characterized in that, The image data receiving and preprocessing task acts as a producer, storing the data to be calculated into a calculation queue; the image data calculation and analysis task acts as a consumer, retrieving data from the calculation queue for calculation and analysis; the calculation queue is written to by the producer and read by the consumer.
5. The multi-task image analysis method based on the producer-consumer model as described in claim 1, characterized in that, In step S3, after the image data receiving and preprocessing task acquires the ID feature data lock, it first copies the already calculated ID feature data array to the local cache, and then determines whether the ID feature of the current image preprocessing data exists in the already calculated ID feature data array in the local cache. If it exists, the current image preprocessing data is placed into the calculation queue; if it does not exist, the current image preprocessing data is retained in the preprocessing data cache queue.
6. The multi-task image analysis method based on the producer-consumer model as described in claim 1, characterized in that, In step S3, the image data receiving and preprocessing task and the image data calculation and analysis task interact through a synchronization data object. The synchronization data object includes a calculation queue, system broadcast time, an array of ID feature data that has started calculation, and calculated telemetry data. The storage length of the synchronization data object is configured according to the data flow.
7. The multi-task image analysis method based on the producer-consumer model as described in claim 1, characterized in that, In step S6, the image data calculation and analysis task calculates state variables and synchronizes them to the image data receiving and preprocessing task via telemetry data. The image data receiving and preprocessing task receives the telemetry data at fixed intervals.
8. The multi-task image analysis method based on the producer-consumer model as described in claim 1, characterized in that, In step S6, the number of data entries read from the computation queue per cycle is set by configuring parameters.
9. The multi-task image analysis method based on the producer-consumer model as described in claim 1, characterized in that, In step S7, the image data calculation and analysis task obtains the system broadcast time through the synchronization data object. The system broadcast time is periodically obtained and updated by the image data receiving and preprocessing task from the external system.
10. A multi-task image analysis system based on the producer-consumer model, employing the multi-task image analysis method based on the producer-consumer model as described in any one of claims 1-9, characterized in that, include: Module M1 initiates the image data receiving and preprocessing task, receives externally input image preprocessing data and image feature data, and caches the image preprocessing data into the preprocessing data cache queue and the image feature data into the feature data queue. Module M2, the image data receiving and preprocessing task attempts to acquire the ID feature data lock that has already started calculation, the ID feature data lock is used to control access to the ID feature data array that has already started calculation, the ID feature data array that has already started calculation is generated by the image data calculation and analysis task; Module M3, when the image data receiving and preprocessing task successfully acquires the ID feature data lock, reads the ID feature data array that has started calculation generated by the image data calculation and analysis task, and determines whether the ID feature contained in the current image preprocessing data exists in the ID feature data array that has started calculation; If it exists, the current image preprocessing data is placed in the calculation queue; if it does not exist, the current image preprocessing data is retained in the preprocessing data cache queue. Module M4 initiates the image data calculation and analysis task, which is triggered by a timer and runs in parallel with the image data receiving and preprocessing task. Module M5: The image data calculation and analysis task obtains feature long packet data from the feature data queue and checks whether the feature long packet data has a value; if there is a value, it performs matching calculation on the feature long packet data and the preprocessed data in the preprocessed data cache queue, puts the matching result into the calculation queue, and stores the matched ID feature into the ID feature data array that has started calculation. Module M6, the image data calculation and analysis task checks whether there is a value in the calculation queue; if there is a value, it reads image feature data from the calculation queue, performs calculations, and assigns the calculation result to the telemetry data; Module M7, the image data calculation and analysis task acquires the system broadcast time, records the time when each calculation is completed as the current time of calculating image data, and determines whether the difference between the current time of calculating image data and the system broadcast time exceeds a set time; If the set time is exceeded, the calculation end determination procedure will be initiated. In the calculation completion judgment program, module M8 determines whether the difference between the data receiving update cycle and the current running cycle exceeds a given value; if it exceeds the given value, the corresponding ID feature is cleared from the ID feature data array that has started calculation, and the cached data occupied by the ID feature is released. In this process, through the cyclic execution of modules M1 to M8, the image data receiving and preprocessing task and the image data calculation and analysis task run continuously in parallel until the external input terminates.