Parallel processing method and device for inspection tasks and storage medium

Through the combination of task queues, thread pools and secure file transfer protocols, multi-task parallel processing and data secure transmission in the substation intelligent patrol system are realized, improving the system's parallel processing capability and response efficiency.

CN120388271APending Publication Date: 2025-07-29NR ELECTRIC CO LTD +2
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202510372995.2
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-03-27
Publication Date
2025-07-29

AI Technical Summary

Technical Problem

The prior art has failed to effectively solve the problems of multi-task scheduling and multi-image processing in the intelligent inspection system of substations, and has not fully considered the security of data transmission.

Method used

The task queue, thread pool and polling window are used for multi-task scheduling, and image analysis tasks are processed in parallel. The client object pool is downloaded and uploaded in parallel through the secure file transfer protocol, and image analysis is performed in combination with the defect identification object detection model.

Benefits of technology

It improves the parallel processing rate and response efficiency of data, ensures the security and reliability of data transmission, and enhances the overall performance of the inspection system.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120388271A_ABST
    Figure CN120388271A_ABST
Patent Text Reader

Abstract

The invention discloses a parallel processing method and device for inspection tasks and a storage medium, and belongs to the field of intelligent inspection of substations. The method is applied to an analysis host, and comprises the following steps: receiving a plurality of inspection task requests sent by an inspection host, sequentially adding the inspection task requests to a task queue, and splitting the inspection task requests into a plurality of image analysis tasks; periodically polling the task queue by a polling window through a main thread in the thread pool, and distributing the image analysis task to an idle thread for parallel processing; the method comprises the following steps of: firstly, calling objects in an object pool of a security file transfer protocol client side in parallel by utilizing a sub-thread, and downloading an analysis image; an image analysis request is sent to the application program interface in parallel, an image analysis result is received, drawing is carried out, and an analysis result graph is obtained; and finally, the objects are called in parallel, and an analysis result graph is uploaded. And image analysis results are integrated in parallel through the main thread and are transmitted back to the patrol host. According to the invention, the parallel processing rate and response efficiency of data can be improved, and the security and reliability of transmission are ensured.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention belongs to the field of intelligent inspection of substations, and particularly relates to a method, device, and storage medium for parallel processing of inspection tasks. Background Art

[0002] In order to meet the needs of grid digitization, more and more high-voltage digital substations have been put into use one after another, resulting in a substantial increase in the demand for intelligent inspection of substations. In actual engineering applications, the regional substation intelligent inspection system needs to simultaneously manage the formulation and execution of dozens of substation inspection tasks, so there are often situations where a large number of inspection tasks need to be processed concurrently. Or many inspection devices, such as preset intelligent cameras, intelligent inspection robots, inspection drones, etc., collect pictures to be inspected by executing their respective inspection tasks, thus generating a large number of inspection task requests that need to be processed in parallel. Therefore, how to efficiently and safely process a large number of inspection task requests in parallel and accurately return the inspection results is particularly crucial.

[0003] In response to the above problems, the existing technologies mainly optimize the concurrency performance through hardware upgrades, such as using means like multi-core CPUs, GPUs, FPGAs, and dedicated circuit designs; or improving the object detection model for concurrency support. Although the existing technologies have improved the performance of the substation intelligent inspection system to a certain extent, there are still the following deficiencies: 1. There is no specific implementation plan for multi-task scheduling and multi-image processing at the program design and software levels; 2. The security issues during the data transmission process have not been fully considered. Summary of the Invention

[0004] The purpose of the present invention is to overcome the deficiencies in the existing technologies and provide a method, device, and storage medium for parallel processing of inspection tasks, which can improve the parallel processing rate and response efficiency of data and ensure the security and reliability of transmission.

[0005] To achieve the above object, the present invention is implemented by the following technical solutions: In the first aspect, the present invention provides a method for parallel processing of inspection tasks, which is applied to an analysis host and includes: Receiving a plurality of inspection task requests sent by an inspection host; Sequentially adding the plurality of inspection task requests to a preset task queue, and splitting each inspection task request into a plurality of image analysis tasks; Using the main thread in a preset thread pool to poll the task queue at a polling window regularly, and allocating the image analysis tasks to idle threads for parallel processing according to the number of image analysis tasks in the polling window and the number of idle threads in the thread pool; Using a sub-thread to parallelly call an object in a preset secure file transfer protocol client object pool to download analysis images from the inspection host; Send image analysis requests to the pre-docked application interfaces in parallel through child threads, receive the image analysis results returned by the application interfaces in parallel, and draw pictures according to the image analysis results to obtain analysis result diagrams; Use child threads to call the objects in the secure file transfer protocol client object pool in parallel to upload the analysis result diagrams to the patrol host; Integrate the image analysis results corresponding to each patrol task request in parallel through the main thread and return the image analysis results to the patrol host.

[0006] Combined with the first aspect, further, before receiving multiple patrol task requests sent by the patrol host, it further includes: Select a deployment environment and a deployment framework, deploy various types of trained defect recognition target detection models, and create application interfaces for interaction.

[0007] Combined with the first aspect, further, each patrol task request includes a corresponding task ID, source IP, source port number, and multiple image information. The splitting of each patrol task request into multiple image analysis tasks includes: Assign the task ID, source IP, and source port number corresponding to each patrol task request to each piece of image information included; Split each patrol task request into multiple independent image analysis tasks according to each piece of image information included.

[0008] Combined with the first aspect, further, the main thread in the preset thread pool polls the task queue at a fixed time interval of a polling window, and distributes the image analysis tasks to the idle threads for parallel processing according to the number of image analysis tasks in the polling window and the number of idle threads in the thread pool, including: Set the polling window to poll the patrol task requests in the task queue at a fixed time interval; Count the number of image analysis tasks included in all patrol task requests in the current polling window; Compare the number of image analysis tasks in the polling window with the number of idle threads in the thread pool; In response to the number of image analysis tasks in the polling window being less than or equal to the number of idle threads in the thread pool, distribute all the image analysis tasks included in all patrol task requests in the current polling window to the idle threads for parallel processing; In response to the number of image analysis tasks in the polling window being greater than the number of idle threads in the thread pool, sequentially take out the patrol task requests whose sum of the number of image analysis tasks in the current polling window is less than or equal to the number of idle threads, and distribute all the image analysis tasks included in these patrol task requests to the idle threads for parallel processing.

[0009] In combination with the first aspect, further, the comparison and allocation logic for allocating image analysis tasks to idle threads for parallel processing according to the number of image analysis tasks in the polling window and the number of idle threads in the thread pool can be expressed by the following formula: , In the formula, is the set of image analysis tasks allocated by the task queue to idle threads; is the number of image analysis tasks included in the th inspection task request in the current polling window, ; is the set of all inspection task requests in the current polling window; is the number of idle threads in the thread pool; is the set of image analysis tasks included in the first inspection task requests in the current polling window.

[0010] In combination with the first aspect, further, the use of child threads to parallelly call objects in the preset secure file transfer protocol client object pool to download analysis images from the inspection host, or the use of child threads to parallelly call objects in the secure file transfer protocol client object pool to upload the analysis result images to the inspection host further includes: Downloading analysis images from the inspection host or uploading analysis result images to the inspection host through the secure file transfer protocol; After completing the download of the analysis images or the upload of the analysis result images, returning the called objects to the secure file transfer protocol client object pool.

[0011] In combination with the first aspect, further, the parallel sending of image analysis requests to the pre-connected application programming interface through child threads, parallelly receiving the image analysis results returned by the application programming interface, and drawing according to the image analysis results to obtain the analysis result images includes: Parallelly matching the defect recognition target detection models corresponding to the analysis types through child threads according to the analysis types of the image analysis tasks; Using child threads to parallelly send image analysis requests to the application programming interfaces corresponding to the defect recognition target detection models of various analysis types; Parallelly receiving, through child threads, the image analysis results of various analysis types returned after the defect recognition target detection models analyze and infer the analysis images; Using child threads to integrate the image analysis results of various analysis types and perform drawing to obtain the analysis result images.

[0012] In combination with the first aspect, further, the allocation of image analysis tasks to idle threads for parallel processing further includes: Set a timeout monitor for each sub-thread and record the time when each sub-thread completes the image analysis task; In response to the time when the sub-thread completes the image analysis task being less than or equal to a pre-configured time threshold, return the image analysis result to the main thread; In response to the time when the sub-thread completes the image analysis task being greater than the pre-configured time threshold, forcibly cancel the image analysis task of the sub-thread, release the thread resources, and set the image analysis result corresponding to the task to analysis timeout.

[0013] In a second aspect, the present invention also provides a computer device, including a storage medium and a processor; The storage medium is used to store instructions; The processor is used to operate according to the instructions to execute the steps of the method according to any one of the first aspects.

[0014] In a third aspect, the present invention also provides a computer-readable storage medium, on which a computer program is stored, and when the program is executed by a processor, the steps of the method according to any one of the first aspects are implemented.

[0015] Compared with the prior art, the beneficial effects achieved by the present invention: The parallel processing method for inspection tasks provided by the present invention performs multi-task scheduling by creating a task queue, a thread pool, and a polling window, and performs multi-image processing by parallelly docking with the application program interface; it provides a specific parallel processing mechanism from the program design and software levels, which can improve the parallel processing rate and response efficiency of data, and improve the parallel processing ability of the inspection system. In addition, the secure file transfer protocol is adopted, and the parallel download and upload of images are performed through the secure file transfer protocol client object pool, ensuring the security and reliability of data transmission, thereby enhancing the overall performance of the inspection system. BRIEF DESCRIPTION OF THE DRAWINGS

[0016] In order to more clearly illustrate the technical solutions in the embodiments of the present invention, the following will briefly introduce the drawings required to be used in the embodiments. Obviously, the drawings in the following description are only some embodiments of the present invention, and those of ordinary skill in the art can also obtain other drawings based on these drawings without creative efforts.

[0017] Figure 1 It is a flowchart of a parallel processing method for inspection tasks provided by an embodiment of the present invention; Figure 2 It is a schematic structural diagram of an inspection system provided by an embodiment of the present invention; Figure 3 It is an internal structure diagram of a computer device provided by an embodiment of the present invention. DETAILED DESCRIPTION OF THE INVENTION

[0018] The present invention will be further described below in conjunction with the accompanying drawings. The following embodiments are only used to more clearly illustrate the technical solution of the present invention, and cannot be used to limit the protection scope of the present invention.

[0019] Embodiment 1

[0020] This embodiment provides a method for parallel processing of inspection tasks. As Figure 1 shown, it is a flowchart of the method provided in this embodiment, mainly including the following steps: Step S1: Receive multiple inspection task requests sent by the inspection host; Step S2: Sequentially add multiple inspection task requests to a preset task queue, and split each inspection task request into multiple image analysis tasks; Step S3: Through the main thread in a preset thread pool, poll the task queue at regular intervals with a polling window, and allocate the image analysis tasks to idle threads for parallel processing according to the number of image analysis tasks in the polling window and the number of idle threads in the thread pool; Step S4: Use child threads to parallelly call objects in a preset secure file transfer protocol client object pool to download analysis images from the inspection host; Step S5: Parallelly send image analysis requests to a pre-connected application programming interface through child threads, parallelly receive the image analysis results returned by the application programming interface, and draw pictures according to the image analysis results to obtain an analysis result graph; Step S6: Use child threads to parallelly call objects in the secure file transfer protocol client object pool to upload the analysis result graph to the inspection host; Step S7: Parallelly integrate the image analysis results corresponding to each inspection task request through the main thread, and return the image analysis results to the inspection host.

[0021] It should be noted that the method provided in this embodiment is applied to an analysis host. As Figure 2 shown, it is a schematic structural diagram of the inspection system provided in this embodiment; among them, the inspection system is located in the management information major area, mainly including an inspection host and an analysis host. The inspection host is mainly responsible for dispatching inspection tasks, collecting inspection pictures, managing image analysis task requests, and displaying inspection results. The analysis host mainly provides back-end image analysis support for the inspection host, analyzes after receiving the inspection task request from the inspection host, draws the image analysis result, and returns it to the inspection host.

[0022] As an embodiment, before executing step S1, the following steps also need to be executed: Step S0: Select a deployment environment and a deployment framework, deploy the trained defect recognition object detection models of various types, and create an application programming interface for interaction to receive image analysis requests. Specifically, in combination with Figure 2 , in this embodiment, the torchserve service is used to deploy the environment and framework, and a torchserve docker container is created to deploy and manage the trained object detection models of the YOLO (You Only Look Once) series or the DETR (Detection Transformer) series. The trained defect recognition object detection models of various types are exported in the ONNX (Open Neural Network Exchange) format. After packaging the ONNX format object detection models into the mar format required for torchserve model deployment using the torch-model-archiver tool, executing torchserve--start can complete the model deployment. In addition, the deployed object detection model needs to provide an externally accessible application programming interface Restful API for receiving HTTP (Hyper Text Transfer Protocol) requests for image analysis and returning the image analysis results. It should be noted that the torchserve service is a tool for deploying pytorch models, which can provide Restful API, not only facilitating integration with other systems, but also supporting hot loading, hot updating and parallel execution of models, thus improving the concurrency performance.

[0023] In this embodiment, the inspection host in the inspection system will dispatch a large number of inspection task requests to the analysis host. For example, many inspection devices such as preset intelligent cameras, intelligent inspection robots, and inspection drones execute their respective inspection tasks to collect pictures to be inspected and generate multiple inspection task requests to be sent to the analysis host; or in the intelligent inspection system of regional substations, the inspection task requests of multiple substations are sent to the inspection host in parallel, and the inspection host then forwards them to the analysis host. Refer to Figure 2 , each inspection task request contains information of multiple images to be analyzed, and in addition, it contains the unique task ID, source IP, and source port number corresponding to this request, which is convenient for subsequent integration of image analysis results and returning them to the inspection host.

[0024] Further, after receiving multiple inspection task requests sent by the inspection host, the analysis host will create a task queue, cache the multiple inspection task requests into the task queue in sequence, and at the same time split each inspection task request into multiple image analysis tasks. Specifically, the analysis host assigns the task ID, source IP, and source port number corresponding to each inspection task request in the task queue to each piece of image information it contains; and then splits each inspection task request into multiple independent image analysis tasks according to each piece of image information it contains, which is convenient for subsequent sub-threads to execute the image analysis tasks and integrate the image analysis results according to the assigned task ID, source IP, and source port number.

[0025] As an alternative embodiment, since the number of images to be inspected contained in each inspection task request from different sources is uncertain, and it is the inspection task request composed of a single image analysis task that actually consumes system resources and affects the system concurrency performance; therefore, as Figure 2 shown, in this embodiment, a thread pool is created, and a sub-thread is used to execute an image analysis task, that is, to perform the analysis and processing process of one image; then the main thread uses a polling window to periodically poll the task queue, and according to the number of image analysis tasks in the polling window and the number of idle threads in the thread pool, distributes the image analysis tasks to the idle threads for parallel processing, thereby improving the concurrency performance.

[0026] Specifically, step S3 mainly includes the following processing steps: Set the polling window to poll the inspection task requests in the task queue at a fixed time interval; Count the number of image analysis tasks included in all inspection task requests in the current polling window; Based on the inclusion relationship between the inspection task requests and the image analysis tasks, in order to make all the image analysis tasks in an inspection task request be processed simultaneously as much as possible, it is necessary to compare the number of image analysis tasks in the polling window with the number of idle threads in the thread pool; In response to the number of image analysis tasks in the polling window being less than or equal to the number of idle threads in the thread pool, distribute all the image analysis tasks included in all inspection task requests in the current polling window to the idle threads for parallel processing; In response to the number of image analysis tasks in the polling window being greater than the number of idle threads in the thread pool, sequentially take out the inspection task requests whose sum of the number of image analysis tasks in the current polling window is less than or equal to the number of idle threads, and distribute all the image analysis tasks included in these inspection task requests to the idle threads for parallel processing.

[0027] It should be noted that the polling time interval set in this embodiment is 0.5 seconds, and in actual applications, a reasonable time interval can be set according to the number of inspection task requests.

[0028] Furthermore, the above comparison and allocation logic can be expressed by the following formula: , wherein, is the set of image analysis tasks assigned by the task queue to idle threads; is the number of image analysis tasks included in the th inspection task request within the current polling window, ; is the set of all inspection task requests within the current polling window; is the number of idle threads in the thread pool; is the set of image analysis tasks included in the first inspection task requests within the current polling window.

[0029] In this embodiment, to ensure the security of image transmission, referring to Figure 2 , this embodiment creates a pool of FTPSClient secure file transfer protocol client objects. Through child threads, the objects in the object pool are called in parallel to download analysis images from the inspection host or upload analysis result images to the inspection host using the FTPS secure file transfer protocol; and after completing the download of analysis images or upload of analysis result images, the called objects are returned to the pool of FTPSClient secure file transfer protocol client objects.

[0030] It should be noted that the FTPS secure file transfer protocol adds an encryption layer on the basis of the FTP file transfer protocol and uses SSL / TLS encryption technology to encrypt and authenticate the transmitted data, ensuring the privacy and integrity of the data during transmission and effectively preventing the data from being eavesdropped or tampered with during transmission. In addition, the use of the FTPS secure file transfer protocol is relatively simple, and users do not need to install additional software or perform complex settings to use it, making the FTPS secure file transfer protocol have high availability and popularity in practical applications. In this embodiment, the inspection host is the FTPS server, and the analysis host is the FTPS client. By using the passive connection mode, the server opens ports for the client to connect, and the image transmission between the inspection host and the analysis host is completed.

[0031] Specifically, during the process of image analysis and processing by each sub-thread, the download or upload of each image requires the establishment of an FTPSClient object that connects to the FTPS server. However, when the concurrent demand surges, continuously creating, managing, and destroying a large number of FTPSClient objects may lead to memory jitter, high load on the Java garbage collector, high memory, and high CPU overhead. Therefore, in this embodiment, the Java object pool mechanism is adopted to create an FTPSClient object pool, which contains a certain number of initialized FTPSClient objects. The objects are borrowed and returned through sub-thread calls to achieve multiple reuse of the objects, avoiding frequent creation and destruction of objects, and thus providing stable resource allocation.

[0032] As an alternative embodiment, in combination with Figure 2 , when the sub-threads parallelly call the objects in the FTPSClient object pool and use FTPS to download the analysis images from the inspection host, the following processing steps need to be executed: According to the analysis type of the image analysis task, parallelly match the defect recognition target detection model of the corresponding analysis type through sub-threads; Use sub-threads to parallelly send image analysis HTTP requests to the API application interfaces corresponding to the defect recognition target detection models of various analysis types; Through sub-threads, parallelly receive the image analysis results of various analysis types returned after the defect recognition target detection model analyzes and infers the analysis images; Use sub-threads to integrate the image analysis results of various analysis types and perform drawing to obtain the analysis result graph.

[0033] In this embodiment, the sub-threads parallelly call the objects in the FTPSClient object pool, use FTPS to upload the analysis result graph to the inspection host, and return the image analysis results of the image analysis task to the main thread. The main thread parallelly integrates the image analysis results corresponding to the same inspection task request according to the task ID of each image analysis task and returns the image analysis results to the inspection host. Finally, after receiving the image analysis results returned by the analysis host, the inspection host will count the number of inspection task requests sent, successful image recognition, failed image recognition, and the distribution information of image recognition types, and export the inspection report, thus realizing an efficient and secure parallel inspection process.

[0034] The parallel processing method for inspection tasks provided in this embodiment performs multi-task scheduling by creating a task queue, a thread pool, and a polling window, and performs multi-image processing by parallelly docking with the application programming interface; it provides a specific parallel processing mechanism at the program design and software levels, which can improve the parallel processing rate and response efficiency of data, and enhance the parallel processing ability of the inspection system. In addition, the secure file transfer protocol is adopted, and the parallel download and upload of images are performed through the secure file transfer protocol client object pool, which ensures the security and reliability of data transmission, thereby enhancing the overall performance of the inspection system.

[0035] This flowchart only shows the logical sequence of the method described in this embodiment. On the premise of no conflict, in other possible embodiments of the present invention, the steps shown or described may be completed in a different order from Figure 1 the order shown. The parallel processing method for inspection tasks provided in this embodiment can be applied to a terminal and can be executed by a parallel processing device for inspection tasks. This device can be implemented in software and / or hardware, and this device can be integrated in the terminal, for example: any smart phone, tablet computer or computer device with communication functions.

[0036] Embodiment 2

[0037] The parallel processing method for inspection tasks provided in this embodiment is different from Embodiment 1 in that the process of parallel image analysis and processing by child threads further includes: Set timeout monitoring for each child thread, and record the time when each child thread completes the image analysis task; In response to the time when the child thread completes the image analysis task being less than or equal to the pre-configured time threshold, return the image analysis result to the main thread; In response to the time when the child thread completes the image analysis task being greater than the pre-configured time threshold, forcibly cancel the image analysis task of the child thread, release the thread resources, and set the image analysis result corresponding to the task to analysis timeout.

[0038] Specifically, since the analysis and processing process of an image is relatively complex, it includes processes such as downloading and analyzing the image through FTPS, obtaining the URL of the corresponding defect recognition target detection model according to the analysis type, sending an image analysis request to the URL of the model and waiting for the return of the analysis result, and sorting out the analysis result, etc. Although, in most processes, try-catch exception handling is used; however, if accidental abnormal situations such as a long time for downloading the image or a long time for waiting for the model to return the result occur, the thread resources will be occupied for a long time and cannot be released, thus affecting the subsequent process and causing task blocking. Therefore, the method provided in this embodiment sets timeout monitoring during the execution of each child thread.

[0039] It should be noted that the timeout threshold set in this embodiment is 10 seconds. If the entire image analysis and processing process exceeds 10 seconds, the corresponding image analysis task will be forcibly cancelled and the sub-thread resources will be released. In practical applications, a reasonable time threshold can be set according to the number of inspection task requests.

[0040] Embodiment Three

[0041] This embodiment also provides a computer device, which can be a server, and its internal structure diagram can be as Figure 3 shown. The computer device includes a processor, a memory, an input / output interface (Input / Output, abbreviated as I / O), and a communication interface. Among them, the processor, the memory, and the input / output interface are connected through a system bus, and the communication interface is connected to the system bus through the input / output interface.

[0042] Among them, the processor of the computer device is used to provide computing and control capabilities. The memory of the computer device includes a non-volatile storage medium and an internal memory. The non-volatile storage medium stores an operating system, a computer program, and a database. The internal memory provides an environment for the operation of the operating system and the computer program in the non-volatile storage medium. The database of the computer device is used to store the data obtained and generated in the method for the robot to autonomously enter the packaging container. The input / output interface of the computer device is used to exchange information between the processor and external devices. The communication interface of the computer device is used to communicate with external terminals through a network connection. When the computer program is executed by the processor, it implements the method provided in any one of the foregoing Embodiments 1 to 2.

[0043] Those skilled in the art can understand that Figure 3 the structure shown in

[0044] is only a block diagram of some structures related to the solution of the present application, and does not constitute a limitation on the computer device to which the solution of the present application is applied. The specific computer device may include more or fewer components than those shown in the figure, or combine some components, or have different component arrangements.

[0045] Embodiment Four

[0046] This embodiment also provides a computer-readable storage medium, on which a computer program is stored, and when the program is executed by a processor, it implements the steps of the method described in any one of the foregoing Embodiments 1 to 2.

[0047] The computer-readable storage medium provided by this embodiment can execute the parallel processing method for inspection tasks provided by any embodiment of the present invention, and has the corresponding functional modules and beneficial effects for executing the method.

[0048] Those skilled in the art should understand that the embodiments of the present application can be provided as a method, a system, or a computer program product. Therefore, the present application can take the form of a complete hardware embodiment, a complete software embodiment, or an embodiment combining software and hardware aspects. Moreover, the present application can take the form of a computer program product implemented on one or more computer-usable storage media (including but not limited to disk storage, CD-ROM, optical storage, etc.) containing computer-usable program code.

[0049] The present application is described with reference to the flowcharts and / or block diagrams of methods, apparatuses (systems), and computer program products according to the embodiments of the present application. It should be understood that each flow and / or block in the flowchart and / or block diagram can be implemented by computer program instructions, and the combination of the flows and / or blocks in the flowchart and / or block diagram can also be implemented by computer program instructions. These computer program instructions can be provided to the processor of a general-purpose computer, a special-purpose computer, an embedded processor, or other programmable data processing devices to generate a machine, so that the instructions executed by the processor of the computer or other programmable data processing devices generate a device for realizing the functions specified in one Figure 1 one flow or multiple flows and / or blocks Figure 1 one block or multiple blocks.

[0050] These computer program instructions can also be stored in a computer-readable memory that can direct a computer or other programmable data processing device to work in a specific manner, so that the instructions stored in the computer-readable memory generate a manufactured article including an instruction device, and the instruction device realizes the functions specified in one Figure 1 one flow or multiple flows and / or blocks Figure 1 one block or multiple blocks.

[0051] These computer program instructions can also be loaded onto a computer or other programmable data processing device, so that a series of operation steps are executed on the computer or other programmable device to generate a computer-implemented process, and thus the instructions executed on the computer or other programmable device provide steps for realizing the functions specified in one Figure 1 one flow or multiple flows and / or blocks Figure 1 one block or multiple blocks.

[0052] The embodiments of the present invention have been described above in conjunction with the accompanying drawings. However, the present invention is not limited to the above specific embodiments. The above specific embodiments are merely illustrative and not restrictive. Under the inspiration of the present invention, those of ordinary skill in the art can also make many forms without departing from the spirit of the present invention and the scope protected by the claims. All of these are within the protection scope of the present invention.

Claims

1. A parallel processing method for patrol tasks, characterized in that The method is applied to an analysis host and includes: Receiving multiple inspection task requests sent by an inspection host; Sequentially adding the multiple inspection task requests to a preset task queue, and splitting each inspection task request into multiple image analysis tasks; Using the main thread in a preset thread pool to poll the task queue at regular intervals with a polling window, and allocating the image analysis tasks to idle threads for parallel processing according to the number of image analysis tasks within the polling window and the number of idle threads in the thread pool; Using child threads to parallelly call objects in a preset secure file transfer protocol client object pool to download analysis images from the inspection host; Parallelly sending image analysis requests to a pre-connected application programming interface through child threads, parallelly receiving the image analysis results returned by the application programming interface, and drawing according to the image analysis results to obtain an analysis result graph; Using child threads to parallelly call objects in the secure file transfer protocol client object pool to upload the analysis result graph to the inspection host; Parallelly integrating the image analysis results corresponding to each inspection task request through the main thread, and transmitting the image analysis results back to the inspection host.

2. The parallel processing method for the patrol inspection task according to claim 1, wherein, Before receiving the multiple inspection task requests sent by the inspection host, it further includes: Selecting a deployment environment and a deployment framework, deploying various types of trained defect recognition object detection models, and creating an application programming interface for interaction.

3. The parallel processing method for the patrol inspection task according to claim 1, wherein Each inspection task request includes a corresponding task ID, source IP, source port number, and multiple image information. Splitting each inspection task request into multiple image analysis tasks includes: Allocating the task ID, source IP, and source port number corresponding to each inspection task request to each piece of image information included; Splitting each inspection task request into multiple independent image analysis tasks according to each piece of image information included.

4. The parallel processing method for the patrol inspection task according to claim 1, wherein, Using the main thread in a preset thread pool to poll the task queue at regular intervals with a polling window, and allocating the image analysis tasks to idle threads for parallel processing according to the number of image analysis tasks within the polling window and the number of idle threads in the thread pool includes: Setting the polling window to poll the inspection task requests in the task queue at a fixed time interval; Counting the number of image analysis tasks included in all inspection task requests within the current polling window; Comparing the number of image analysis tasks within the polling window with the number of idle threads in the thread pool; In response to the number of image analysis tasks within the polling window being less than or equal to the number of idle threads in the thread pool, allocating all the image analysis tasks included in all inspection task requests within the current polling window to idle threads for parallel processing; In response to the number of image analysis tasks within the polling window being greater than the number of idle threads in the thread pool, sequentially taking out the inspection task requests whose sum of the number of image analysis tasks within the current polling window is less than or equal to the number of idle threads, and allocating all the image analysis tasks included in these inspection task requests to idle threads for parallel processing.

5. The parallel processing method for the inspection task according to claim 4, wherein The comparison and allocation logic for allocating image analysis tasks to idle threads for parallel processing according to the number of image analysis tasks within the polling window and the number of idle threads in the thread pool can be represented by the following formula: , Wherein, is the set of image analysis tasks assigned by the task queue to idle threads; is the number of image analysis tasks included in the th inspection task request within the current polling window, ; is the set of all inspection task requests within the current polling window; is the number of idle threads in the thread pool; is the set of image analysis tasks included in the first inspection task requests within the current polling window.

6. The parallel processing method for the patrol inspection task according to claim 1, wherein, Parallelly invoking objects in a preset secure file transfer protocol client object pool by using a sub-thread to download an analysis image from a patrol host, or parallelly invoking objects in the secure file transfer protocol client object pool by using a sub-thread to upload the analysis result graph to the patrol host, further includes: Downloading an analysis image from a patrol host or uploading an analysis result graph to a patrol host through the secure file transfer protocol; After completing the download of the analysis image or the upload of the analysis result graph, returning the invoked object to the secure file transfer protocol client object pool.

7. The parallel processing method for the patrol inspection task according to claim 1, wherein Parallelly sending an image analysis request to a pre-docked application programming interface through a sub-thread, parallelly receiving an image analysis result returned by the application programming interface, and performing drawing according to the image analysis result to obtain an analysis result graph, including: Parallelly matching a defect recognition target detection model of a corresponding analysis type through a sub-thread according to the analysis type of the image analysis task; Parallelly sending an image analysis request to the application programming interface corresponding to the defect recognition target detection model of various analysis types by using a sub-thread; Parallelly receiving, through a sub-thread, image analysis results of various analysis types returned after the defect recognition target detection model analyzes and infers the analysis image; Integrating the image analysis results of various analysis types by using a sub-thread and performing drawing to obtain an analysis result graph.

8. The parallel processing method for the patrol inspection task according to any one of claims 1 to 7, characterized in that, Allocating the image analysis task to an idle thread for parallel processing, further includes: Setting a timeout monitor for each sub-thread and recording the time taken by each sub-thread to complete the image analysis task; In response to the time taken by the sub-thread to complete the image analysis task being less than or equal to a pre-configured time threshold, returning the image analysis result to the main thread; In response to the time taken by the sub-thread to complete the image analysis task being greater than the pre-configured time threshold, forcibly canceling the image analysis task of the sub-thread, releasing the thread resources, and setting the image analysis result corresponding to the task to analysis timeout.

9. A computer device, characterized in that, Including a storage medium and a processor; The storage medium is used for storing instructions; The processor is used for operating according to the instructions to execute the steps of the method according to any one of claims 1 to 8.

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