A band calculation method, device and storage medium suitable for distributed architecture
By computing satellite image data in blocks in a distributed architecture, the problem of low processing efficiency of single-machine software is solved, efficient band calculation is realized, and multi-node resources are utilized to improve the processing speed.
Patent Information
- Application Number
- CN202011223862.2
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2020-11-05
- Publication Date
- 2024-10-01
- Estimated Expiration
- 2040-11-05
AI Technical Summary
When existing desktop stand-alone software processes massive satellite image data, band calculation efficiency is reduced and it cannot fully utilize the advantages of clusters, resulting in a processing speed bottleneck.
Using a distributed architecture band calculation method, the image is divided into blocks and assigned to multiple sub-processes for parallel calculation. The pixel values of the block images are processed recursively. The allocation strategy and calculation strategy are used to optimize the process allocation and operation sequence to achieve efficient Band calculation.
It significantly improves the calculation speed and efficiency of massive remote sensing data, makes full use of cluster hardware resources, solves the problem of block process allocation, and improves the processing efficiency of band calculation.
Smart Images

Figure CN112446001B_ABST
Abstract
Description
Technical Field
[0001] The present invention belongs to the field of image processing technology, and in particular relates to a band calculation method, device and storage medium suitable for a distributed architecture. Background Art
[0002] With the rapid development of earth observation technology, it is becoming easier and easier to obtain remote sensing images. Today's remote sensing images are developing towards higher spatial resolution, higher spectral resolution, higher clarity, and greater information content. Current satellite images generally have the characteristics of large amount of information, high resolution, and rich spectral information, and can be used to calculate various remote sensing indexes. In the field of remote sensing, remote sensing indexes have been widely used in the quantitative and qualitative evaluation of relevant indicators in various industries such as land, agriculture, forestry, grassland, and water conservancy. Therefore, for massive remote sensing image data, how to calculate various remote sensing indexes more quickly, efficiently, and flexibly has become an urgent problem to be solved.
[0003] The band calculator is a flexible image processing tool. Since each user has unique needs, users can customize remote sensing indexes or processing algorithms with this tool. Users can customize simple or complex processing programs according to their needs. The band calculation tool can easily perform mathematical function calculations such as addition, subtraction, multiplication, division, trigonometric functions, exponentials, and logarithms for each band in the image. However, due to the continuous development of satellite sensor manufacturing, the amount of satellite image data has shown an exponential growth trend. Therefore, the band calculation tools and calculation methods integrated in the desktop stand-alone software can no longer meet the needs. There are the following technical problems: (1) With the increase in the amount of satellite image data, the efficiency of band calculation is significantly reduced; (2) The system architecture has developed from a single machine to a cluster and distributed system. The band calculation tool cannot fully utilize the advantages of the cluster and break through the bottleneck of processing speed. Summary of the invention
[0004] The present invention aims to solve the above problems and provides a band calculation method, device and storage medium suitable for a distributed architecture.
[0005] In a first aspect, the present invention provides a band calculation method applicable to a distributed architecture, comprising: according to a set block size, dividing an image into a plurality of blocks in length and width directions, and obtaining a total number of blocks;
[0006] Based on the total number of processes and the total number of blocks, the total process includes a number of sub-processes; each block is allocated to each sub-process according to an allocation strategy;
[0007] Each subprocess calculates the starting position and block size information of the corresponding block according to the calculation strategy, and reads the pixel value of the current block of the input image;
[0008] Each subprocess parses the calculation formula and stores the operators and constant variables in the formula in the operation processing class according to the priority order of the operators;
[0009] Each sub-process recursively substitutes the pixel values of the corresponding block image into the calculation formula, and performs the formula operation in the order of priority from low to high;
[0010] After each subprocess is finished processing, the end status is synchronized to ensure that the status of each process is known to each other;
[0011] If any child process returns failure, the process will exit and write out the failure status file; otherwise, it will exit successfully, completing the band calculation.
[0012] Preferably, the band calculation method applicable to the distributed architecture and the allocation strategy include:
[0013] The total number of processes is greater than or equal to the total number of blocks, and each block is allocated one-to-one to the corresponding sub-process;
[0014] The total number of processes is less than the total number of blocks. After all blocks are allocated to all child processes in sequence, the remaining blocks are allocated to all child processes again in the same order; this cycle continues until all blocks are allocated.
[0015] Preferably, the band calculation method applicable to the distributed architecture, wherein each sub-process calculates the starting position and block size information of the corresponding block according to the calculation strategy, and reads the pixel value of the current block of the input image, includes, according to the allocation strategy, extracting the comparison relationship between the sub-process number and each block, and dynamically calculating the information of each block processed by each sub-process within each sub-process; including the following steps:
[0016] Calculate the total number of blocks based on the number of row blocks and column blocks:
[0017] Total number of blocks = number of row blocks × number of column blocks
[0018] According to the total number of blocks and the total number of processes, calculate the number of times the process needs to be reused in each process:
[0019] Number of repetitions = total number of blocks ÷ number of processes
[0020] Dynamically obtain all block numbers assigned to each subprocess according to the following formula:
[0021] Block number = iTotalID×i+iID
[0022] Where iTotalID is the total number of processes, i is the number of subprocess cycles, and iID is the sequence number of the subprocess;
[0023] According to the obtained block number, calculate the offset of the block in the row direction and column direction respectively; read the pixel value of the corresponding block of the image according to the offset:
[0024] Row offset = block number / total number of blocks
[0025] Column offset = block number % total number of blocks.
[0026] Preferably, the band calculation method suitable for distributed architecture, each sub-process parses the calculation formula, including: converting a custom formula expressed in an infix expression into a formula expressed in a postfix expression; by introducing a stack, the processing process only needs to read in sequence, push numbers into the stack when encountering them, and take out two stacks for calculation when encountering operators.
[0027] Preferably, the band calculation method suitable for distributed architecture, the conversion of the custom formula expressed in infix expression into a formula expressed in postfix expression, includes: if the operand is read in, it is directly placed in the output expression; if the general operator is read in, it is placed in the stack; before placing in the stack, the top of the stack must be checked, and it is determined that the priority of the top operator is lower than the priority of the operator placed in; if the priority placed in is lower, the operator at the top of the stack is placed in the output expression; if the left bracket ( is read in, the left bracket has the highest priority and is placed in the stack; when the left bracket is placed in the stack, the priority is the lowest; if the right bracket) is read in, the operator in the stack is taken out and placed in the output expression until the left bracket ( is taken out; after reading the infix expression in sequence, if there are operators in the stack, they are popped out one by one and placed in the output expression.
[0028] Preferably, the band calculation method applicable to the distributed architecture, wherein each subprocess recursively substitutes each pixel value of the corresponding block image into the calculation formula, and performs the formula operation in the order of priority from low to high, including: the calculation formula is a formula represented by a suffix expression;
[0029] The calculation of the formula represented by the suffix expression includes: traversing each number, pixel value corresponding to the band identifier and symbol of the expression from left to right, pushing the pixel value corresponding to the number or band identifier into the stack when encountering it, and popping the top number of the stack when encountering an operator.
[0030] Preferably, the band calculation method suitable for a distributed architecture, when encountering an operator, pops the top number of the stack, including: if it is a binocular operator, pops the two numbers or band pixel values at the top of the stack; if it is a monocular operator, pops the top number of the stack, performs calculation, and pushes the calculation result into the stack until the result is finally obtained.
[0031] In a second aspect, the present invention provides a band calculation device suitable for a distributed architecture, comprising: a block division unit, the block division unit being used to divide an image into a plurality of blocks in length and width directions according to a set block size, and obtain a total number of blocks;
[0032] An allocation unit, the allocation unit is used to allocate each block to each sub-process according to an allocation strategy based on the total number of processes and the total number of blocks, the total process including a plurality of sub-processes;
[0033] A subprocess processing unit, the subprocess processing unit is used to calculate the starting position and block size information of the corresponding block according to the calculation strategy, and read the pixel value of the current block of the input image; parse the calculation formula and store the operators and constant variables in the formula in the operation processing class according to the priority order of the operators; recursively substitute the pixel values of the corresponding block images into the calculation formula respectively, and perform the formula operation in the order of priority from low to high;
[0034] A synchronization output unit is used to synchronize the status of each sub-process after the processing is completed; if any sub-process returns failure, the process is exited and the failure status file is written at the same time, otherwise it is exited smoothly, that is, the band calculation is completed.
[0035] In a third aspect, the present invention provides a band computing electronic device suitable for a distributed architecture, comprising a processor and a memory; the memory is used to store executable instructions of the processor; the processor is configured to execute the band computing method suitable for a distributed architecture described in the first invention content by executing the executable instructions.
[0036] In a fourth aspect, the present invention provides a computer storage medium having a computer program stored thereon; when the computer program is executed by a processor, the band calculation method applicable to a distributed architecture described in the first aspect is implemented.
[0037] The band calculation method, device and storage medium suitable for distributed architecture described in the present invention decompose massive remote sensing data into multiple subtasks and assign them to different processors. The processors are independent of each other and execute the subtasks in parallel, thereby accelerating the solution speed and improving the execution efficiency; supporting multi-machine / multi-node processing of cluster architecture, which can make full use of the hardware resources on each node and greatly improve the processing efficiency of band calculation; and the present invention constructs a block process allocation strategy, which can effectively solve the block process allocation problem when the number of blocks is greater than the number of processes. BRIEF DESCRIPTION OF THE DRAWINGS
[0038] Figure 1 It is a schematic diagram of the flow chart of the band calculation method of the distributed architecture of the present invention;
[0039] Figure 2 This is a schematic diagram of dividing an image into rows and columns according to this embodiment;
[0040] Figure 3 This is a schematic diagram of the cyclic allocation strategy described in this embodiment;
[0041] Figure 4 This is a schematic diagram of the band processing task distribution described in this embodiment. DETAILED DESCRIPTION
[0042] The band calculation method, device and storage medium applicable to the distributed architecture described in the present invention are described in detail below through the accompanying drawings and embodiments.
[0043] Example embodiments can be implemented in a variety of forms and should not be construed as being limited to the examples set forth herein; rather, these embodiments are provided so that the present disclosure will be more comprehensive and complete, and the concepts of the example embodiments are fully conveyed to those skilled in the art. The described features, structures, or characteristics may be combined in any suitable manner in one or more embodiments. In the following description, many specific details are provided to provide a full understanding of the embodiments of the present disclosure. However, those skilled in the art will appreciate that the technical solutions of the present disclosure may be practiced while omitting one or more of the specific details, or other methods, devices, steps, etc. may be employed. In other cases, known technical solutions are not shown or described in detail to avoid obscuring various aspects of the present disclosure.
[0044] The terms "one", "all" and "the" are used in this specification to indicate the presence of one or more elements / components / etc.; the terms "including" and "having" are used to indicate an open-ended inclusion and mean that there may be additional elements / components / etc. in addition to the listed elements / components / etc. In addition, the drawings are only schematic illustrations of the present disclosure and are not necessarily drawn to scale. The same reference numerals in the figures represent the same or similar parts, and thus their repeated description will be omitted. Some of the block diagrams shown in the drawings are functional entities and do not necessarily correspond to physically or logically independent entities.
[0045] Embodiment 1
[0046] The present disclosure first provides a distributed architecture band calculation method, such as Figure 1 The steps shown include:
[0047] Step S1, according to the set block size, the image is divided into a plurality of blocks in the length and width directions, and the total number of blocks is obtained;
[0048] Step S2, based on the total number of processes and the total number of blocks, the total process includes a number of sub-processes; each block is allocated to each sub-process according to the allocation strategy;
[0049] Step S3, each subprocess calculates the starting position and block size information of the corresponding block according to the calculation strategy, and reads the pixel value of the current block of the input image;
[0050] Step S4, each subprocess parses the calculation formula and stores the operators and constant variables in the formula in the operation processing class according to the priority order of the operators;
[0051] Step S5, each sub-process recursively substitutes the pixel values of the corresponding block images into the calculation formula, and performs the formula calculation in the order of priority from low to high;
[0052] Step S6, after each sub-process is finished processing, the end status is synchronized to ensure that the status of each process is known to each other;
[0053] Step S7, if any sub-process returns failure, then exit the process and write out the failure status file, otherwise exit smoothly, that is, complete the band calculation.
[0054] In the embodiments of the present disclosure, Figure 2 As shown, in step 1, the image is divided into several blocks in length and width directions respectively; the image is divided into 4 blocks in row direction and 6 blocks in column direction according to a given block size, and each rectangular grid of the grid is used as an image block to be processed.
[0055] In the embodiment of the present disclosure, the allocation strategy described in step 2 is: the total number of processes is less than the total number of blocks, and each block is allocated to all sub-processes in sequence, and then the remaining blocks are allocated to all sub-processes again in the same order; the cycle continues until all blocks are allocated.
[0056] like Figure 3 As shown in the figure, there are 24 blocks in the block image, and the total number of processes is 5. The blocks are first distributed from one row, and from the first column to each process. If block 1 is given to process 1, block 2 is given to process 2, block 3 is given to process 3, block 4 is given to process 4, and block 5 is given to process 5; after all processes are cycled, block 6 is distributed to process 1, block 7 is distributed to process 2, and so on. The distribution is repeated in this order until all blocks are distributed. The numbers in the figure are process numbers.
[0057] According to the allocation strategy described in the embodiment of the present disclosure, the numerical correspondence between the process number and the number of blocks is extracted, and the sequence number of each block processed by each process can be dynamically calculated by the following formula, and the relevant block information can be obtained. The process of step S3 includes the following:
[0058] Step S31, calculating the total number of blocks according to the number of row blocks and the number of column blocks:
[0059] Total number of blocks = number of row blocks × number of column blocks;
[0060] In this embodiment, the total number of blocks is 24, that is,
[0061] Total number of blocks = 4 × 6 = 24;
[0062] Step S32: According to the total number of blocks and the total number of processes, the number of times a process needs to be reused can be calculated in each process:
[0063] Number of repetitions = total number of blocks ÷ number of processes;
[0064] In this embodiment, the process is reused 5 times, that is,
[0065] Number of repetitions = 24 ÷ 5 = 4.8 ≈ 5;
[0066] Step S33, for a certain process, all the block numbers assigned to it can be dynamically obtained according to the following formula: When the process loops for the first time:
[0067] The block number processed by the process with sequence number 1 is 1;
[0068] The block number processed by the process with sequence number 2 is 2;
[0069] The block number processed by the process with sequence number 3 is 3;
[0070] The block number processed by the process with sequence number 4 is 4;
[0071] The block number processed by the process with sequence number 5 is 5.
[0072] When the process loops for the second time:
[0073] The block number processed by the process with sequence number 1 is 6;
[0074] The block number processed by the process with sequence number 2 is 7;
[0075] The block number processed by the process with sequence number 3 is 8;
[0076] The block number processed by the process with sequence number 4 is 9;
[0077] The block number processed by the process with sequence number 5 is 10.
[0078] …
[0079] Based on the above rules, the total number of processes is iTotalID. When the process loops for the i-th time, the block number processed by the process with the serial number iID is:
[0080] Block number = iTotalID×i+iID
[0081] Step S34, according to the obtained block number, the offset of the block in the row direction and the column direction is calculated, and the pixel value of the block at the corresponding position of the image can be read according to the offset.
[0082] Row offset = block number / total number of blocks
[0083] Column offset = block number % total number of blocks
[0084] In the embodiment of the present disclosure, based on OpenMPI band computing processing task distribution and status feedback; based on OpenMPI mosaic processing task distribution mechanism such as Figure 4 As shown in the figure, the band calculation tool is started through the MPI framework. After the tool is started, according to the process allocation rule of the above-mentioned image blocks, each process processes the corresponding multiple blocks in parallel, and the parallel MPI framework submits tasks, and the MPI framework allocates tasks to computer A, computer B, ..., computer N. After all computer subprocesses complete the task, the task end status is summarized to the OpenMPI framework, and the OpenMPI framework distributes status information to ensure that all process states are aware of each other, and all processes delegate process 1 to generate the final result based on the feedback task results.
[0085] Step S4, parsing the calculation formula, is the process of converting the custom formula expressed in infix expression into a postfix expression. Postfix expression makes computer operation very convenient. By introducing the stack, the computer processing process only needs to read in sequence, push numbers into the stack when encountering them, and take out the two stacks for operation when encountering operators. The specific steps of converting the infix expression into the postfix expression are as follows:
[0086] Step S41, if the operand is read, it is directly put into the output expression;
[0087] Step S42: if a general operator is read, it is put into the stack. However, before putting it into the stack, the top of the stack must be checked to determine whether the priority of the operator at the top of the stack is lower than that of the operator being put into the stack. If the priority of the operator being put into the stack is lower, the operator at the top of the stack needs to be put into the output expression.
[0088] Step S43, if a left bracket ( is read, the left bracket has the highest priority, so it is put into the stack, but note that when the left bracket is put into the stack, it has the lowest priority.
[0089] Step S44, if the right bracket is read in, then the operators in the stack are taken out and put into the output expression until the left bracket is taken out;
[0090] Step S45, read the infix expression in sequence, and if there are operators in the stack, pop them out in sequence and put them into the output expression.
[0091] In the embodiment of the present disclosure, the process of converting the suffix expression using an infix expression of a normalized difference vegetation index (NDVI): (b4-b3) / (b4+b3) is as follows:
[0092]
[0093]
[0094] Step S5 is to calculate the suffix expression obtained in step S4. The suffix expression calculation process is to traverse each number, pixel value and symbol corresponding to the band identifier in the expression from left to right. When a pixel value corresponding to a number or band identifier is encountered, it is pushed into the stack. When an operator is encountered, the top number of the stack is popped out: if it is a binocular operator, the two numbers or band pixel values at the top of the stack are popped out; if it is a unary operator, the one at the top of the stack is popped out, and the calculation is performed, and the calculation result is pushed into the stack until the result is finally obtained.
[0095] The following steps are described in detail using the suffix expression of the normalized vegetation obtained above: b4 b3–b4 b3+ / , where b3 and b4 are the pixel values of bands 3 and 4.
[0096] 1) Initialize an empty stack. This stack is used to enter and exit the numbers to be calculated.
[0097] 2) If the first two in the suffix expression are both non-operators, the band pixel matrices corresponding to b4 and b3 are pushed into the stack in sequence.
[0098]
[0099] 3) Next is the minus sign "-", so the b3 band pixel matrix in the stack is popped off as the subtrahend, the b4 band pixel matrix is popped off as the minuend, and b4-b3 is calculated to get the result, and then b4-b3 is pushed onto the stack.
[0100]
[0101] 4) Then, the band pixel matrices corresponding to b4 and b3 are stacked in sequence.
[0102]
[0103] 5) Next is the minus sign “+”, so the b3 band pixel matrix and the b4 band pixel matrix in the stack are popped out, b4+b3 is calculated to get the result, and then b4+b3 is pushed into the stack.
[0104]
[0105] 6) Next is the division sign " / ", so the result matrix of b4-b3 and the result matrix of b4+b3 in the stack are popped off the stack, and (b4-b3) / (b4+b3) is calculated to get the result, and the final result is obtained.
[0106] After each subprocess is finished, the end status is synchronized to ensure that the status of each process is known to each other; if any subprocess returns failure, it exits the process and writes the failure status file, otherwise it exits smoothly, that is, the band calculation is completed.
[0107] Embodiment 2
[0108] Based on the same inventive concept as the distributed architecture band calculation method described in the aforementioned embodiment 1, this embodiment discloses a distributed architecture band calculation device. The distributed architecture band calculation device described in the embodiment of the present disclosure includes a block unit, a distribution unit, a sub-process processing unit and a synchronous output unit.
[0109] In the embodiment of the present disclosure, the block division unit is used to divide the image into a plurality of blocks in the length and width directions according to the set block size, and obtain the total number of blocks;
[0110] In the embodiment of the present disclosure, the allocation unit is used to allocate each block to each sub-process according to the allocation strategy based on the total number of processes and the total number of blocks, wherein the total process includes a number of sub-processes;
[0111] In the embodiment of the present disclosure, the subprocess processing unit is used to calculate the starting position and block size information of the corresponding block according to the calculation strategy, and read the pixel value of the current block of the input image; parse the calculation formula and store the operators and constant variables in the formula in the operation processing class according to the priority order of the operators; recursively substitute the pixel values of the corresponding block images into the calculation formula respectively, and perform the formula operation in the order of priority from low to high;
[0112] In the embodiment of the present disclosure, the synchronization output unit is used to synchronize the status of each sub-process after the processing is completed; if any sub-process returns failure, the process is exited and the failure status file is written, otherwise it exits smoothly, that is, the band calculation is completed.
[0113] The specific examples in the aforementioned embodiment 1 are also applicable to a distributed architecture band calculation device of the present embodiment. Through the detailed description of the aforementioned distributed architecture band calculation method, technical personnel in this field can clearly know the implementation method of the distributed architecture band calculation device of the present embodiment, so for the sake of brevity of the specification, it will not be repeated here.
[0114] Embodiment 3
[0115] Based on the same inventive concept as the band calculation method of a distributed architecture described in the aforementioned embodiment 1, this embodiment also discloses a band calculation electronic device of a distributed architecture, including a processor and a memory; the memory is used to store executable instructions of the processor; the electronic device is expressed in the form of a general computing device. The components of the electronic device may include but are not limited to: the at least one processor mentioned above, the at least one memory mentioned above, and a bus connecting different system components. In the specific implementation process, the processor is configured to execute the band calculation method of the distributed architecture described in the aforementioned embodiment 1 by executing the executable instructions.
[0116] It should be understood by those skilled in the art that the embodiments of the present invention may be provided as methods, systems, or computer program products. Therefore, the embodiments disclosed in the present invention may be implemented by software, or by software combined with necessary hardware. Therefore, the technical solution according to the embodiments of the present invention may be embodied in the form of a software product, which may be stored in a non-volatile storage medium (which may be a CD-ROM, a USB flash drive, a mobile hard disk, etc.) or on a network, and includes a number of instructions to enable a computing device (which may be a personal computer, a server, a terminal device, or a network device, etc.) to execute the method described in the embodiments disclosed in the present invention.
[0117] Embodiment 4
[0118] Based on the same inventive concept as the distributed architecture band calculation method described in the aforementioned embodiment 1, the present embodiment further discloses a computer storage medium on which a computer program is stored; in the embodiment of the present disclosure, the computer program is executed by a processor to implement the distributed architecture band calculation method described in the aforementioned embodiment 1, and the execution process includes: according to the set block size, the image is divided into a plurality of blocks in the length and width directions, and the total number of blocks is obtained; based on the total number of processes and the total number of blocks, the total process includes a plurality of sub-processes; each block is allocated to each sub-process according to the allocation strategy; each sub-process is allocated according to The calculation strategy calculates the starting position and block size information of the corresponding block, and reads the pixel value of the current block of the input image; each sub-process parses the calculation formula and stores the operators and constant variables in the formula in the operation processing class according to the priority order of the operators; each sub-process recursively substitutes the pixel values of the corresponding block image into the calculation formula, and performs the formula operation in the order of priority from low to high; after each sub-process is processed, the end status is synchronized to ensure that the status of each process is known to each other; if any sub-process returns failure, it exits the process and writes the failure status file, otherwise it exits smoothly, that is, the band calculation is completed.
[0119] The above are only preferred embodiments of the present invention, and are not intended to limit the patent scope of the present invention. Any equivalent structure or equivalent process transformation made using the contents of the present invention specification and drawings, or directly or indirectly applied in other related technical fields, are also included in the patent protection scope of the present invention.
Claims
1. A band calculation method suitable for distributed architecture, characterized in that include: According to the set block size, the image is divided into several blocks in the length and width directions, and the total number of blocks is obtained; Based on the total number of processes and the total number of blocks, the total process includes a number of sub-processes; each block is allocated to each sub-process according to an allocation strategy; Each subprocess calculates the starting position and block size information of the corresponding block according to the calculation strategy, and reads the pixel value of the current block of the input image; including: According to the allocation strategy, the comparison relationship between the sub-process number and each block is extracted; the steps include: Calculate the total number of blocks based on the number of row blocks and column blocks: Total number of blocks = number of row blocks × number of column blocks According to the total number of blocks and the total number of processes, calculate the number of times the process needs to be reused in each process: Number of repetitions = total number of blocks ÷ number of processes Dynamically obtain all block numbers assigned to each subprocess according to the following formula: Block number = iTotalID×i+iID Where iTotalID is the total number of processes, i is the number of subprocess cycles, and iID is the sequence number of the subprocess; According to the obtained block number, calculate the offset of the block in the row direction and column direction respectively; read the pixel value of the corresponding block of the image according to the offset: Row offset = block number / total number of blocks Column offset = block number % total number of blocks; Each subprocess parses the calculation formula and stores the operators and constant variables in the formula in the operation processing class according to the priority order of the operators; Each sub-process recursively substitutes the pixel values of the corresponding block image into the calculation formula, and performs the formula operation in the order of priority from low to high; After each subprocess is finished processing, the synchronous end state is reached; If any child process returns failure, the process will exit and write out the failure status file; otherwise, it will exit successfully, completing the band calculation.
2. The band calculation method applicable to a distributed architecture according to claim 1, characterized in that: The allocation strategy includes: If the total number of processes is greater than or equal to the total number of blocks, each block is allocated one-to-one to the corresponding child process; if the total number of processes is less than the total number of blocks, each block is allocated to all child processes in sequence, and then the remaining blocks are allocated to all child processes again in the same order; the cycle continues until all blocks are allocated.
3. The band calculation method applicable to a distributed architecture according to claim 1, characterized in that: Each sub-process parses the calculation formula, including: converting a custom formula expressed in an infix expression into a formula expressed in a postfix expression; by introducing a stack, the processing process only needs to read in sequence, push numbers into the stack when encountering them, and take out two stacks for calculation when encountering operators.
4. The band calculation method applicable to a distributed architecture according to claim 3, characterized in that: The step of converting the user-defined formula represented by an infix expression into a formula represented by a postfix expression includes: if an operand is read in, directly putting it into an output expression; If a general operator is read, it is put into the stack. Before putting it into the stack, the top of the stack must be checked to make sure that the priority of the operator at the top of the stack is lower than that of the operator being put into the stack. If the priority of the operator being put into the stack is lower, the operator at the top of the stack is put into the output expression. If a left bracket ( is read, the left bracket has the highest priority and is placed on the stack; when a left bracket is placed on the stack, it has the lowest priority; If a right parenthesis is read, the operators in the stack are taken out and put into the output expression until a left parenthesis is taken out; After reading the infix expression sequentially, if there are operators in the stack, pop them out one by one and put them into the output expression.
5. The band calculation method applicable to a distributed architecture according to claim 4, characterized in that: Each sub-process recursively substitutes the pixel values of the corresponding block images into the calculation formula, and performs the formula operation in the order of priority from low to high, including: The calculation formula is a formula represented by a suffix expression; The calculation of the formula represented by the suffix expression includes: traversing each number, pixel value corresponding to the band identifier and symbol of the expression from left to right, pushing the pixel value corresponding to the number or band identifier into the stack when encountering it, and popping the top number of the stack when encountering an operator.
6. The band calculation method applicable to a distributed architecture according to claim 5, characterized in that: When an operator is encountered, the top number of the stack is popped, including: if it is a binocular operator, the two numbers or band pixel values at the top of the stack are popped; if it is a monocular operator, the one at the top of the stack is popped, calculation is performed, and the calculation result is pushed into the stack until the result is finally obtained.
7. A band calculation device suitable for a distributed architecture, characterized in that: include: A block division unit, the block division unit is used to divide the image into a plurality of blocks in the length and width directions according to a set block size, and obtain a total number of blocks; An allocation unit, the allocation unit is used to allocate each block to each sub-process according to an allocation strategy based on the total number of processes and the total number of blocks, the total process including a plurality of sub-processes; A sub-process processing unit, the sub-process processing unit is used to calculate the starting position and block size information of the corresponding block according to the calculation strategy, and read the pixel value of the current block of the input image; Parse the calculation formula and store the operators and constant variables in the formula in the operation processing class according to the priority order of the operators; By recursion, the pixel values of the corresponding block images are respectively substituted into the calculation formula, and the formula is operated in the order of priority from low to high; A synchronization output unit is used to synchronize the status of each sub-process after the processing is completed; if any sub-process returns failure, the process is exited and the failure status file is written at the same time, otherwise it is exited smoothly, that is, the band calculation is completed.
8. A band computing electronic device suitable for a distributed architecture, characterized in that: It comprises a processor and a memory; the memory is used to store executable instructions of the processor; the processor is configured to execute the band calculation method suitable for a distributed architecture as described in any one of claims 1 to 6 by executing the executable instructions.
9. A computer storage medium having a computer program stored thereon, characterized in that: When the computer program is executed by a processor, the band calculation method applicable to a distributed architecture as described in any one of claims 1 to 6 is implemented.
