A DSP-based Ship Template Matching Acceleration Method and System
By adopting DSP multi-core parallel computing ship template matching method on the embedded platform, the problems of slow data access speed and long calculation time are solved, and more efficient ship template matching is achieved.
Patent Information
- Application Number
- CN202111227569.8
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2021-10-21
- Publication Date
- 2025-07-29
- Estimated Expiration
- 2041-10-21
AI Technical Summary
The existing ship template matching technology has the problem of slow data access speed and long calculation time for matching algorithms, especially on embedded platforms, which is difficult to effectively accelerate.
Using a multi-core parallel computing method based on DSP, the longest contour line and Fourier descriptor of the image and template are extracted in parallel by dividing the shared memory area, and the final matching result is obtained in combination with the Euclidean distance calculation.
It speeds up data access speed, shortens matching calculation time, optimizes parallel computing of data structures, and improves the overall efficiency of matching algorithms.
Smart Images

Figure CN113920337B_ABST
Abstract
Description
Technical Field
[0001] The present invention belongs to the technical field of image target matching, and particularly relates to a method and system for accelerating ship template matching based on DSP. Background Art
[0002] With the development of artificial intelligence and computer vision technologies, more and more related technologies are being applied to ship detection, recognition, and tracking. The contour matching algorithm based on feature descriptors has high cost performance in many practical applications because it does not require training and has a simple feature extraction process. However, for the current ship template matching technology, there are defects such as slow data access speed and long calculation time of the matching algorithm.
[0003] Embedded platforms (DSP) are mainly divided into four types: CPU, GPU, FPGA, and DSP. Among them, the CPU platform is mainly designed for general tasks and has limited computing power. The GPU platform has high computing performance and is the main deep learning inference platform, but its high power consumption limits some applications. The FPGA platform has low power consumption and a flexible computing architecture, but its working frequency is generally low, usually 100 - 300 MHz, the on-chip resources are limited, and the design difficulty is relatively large. DSP, that is, Digital Signal Processor, is an embedded platform with a special structure. The internal of the DSP chip adopts the Harvard structure with separate programs and data, has a dedicated hardware multiplier, adopts pipeline operation, and provides some functions optimized by assembly. Due to its strong computing performance and low power consumption, it has been widely used in embedded systems for a long time. It is precisely because of its wide application in existing embedded systems that many algorithms need to be optimized and deployed for the DSP platform.
[0004] Therefore, how to combine the embedded platform (DSP) with image matching technology to accelerate the data access speed in the image matching process and at the same time shorten the matching calculation time has become a key issue in current research. Summary of the Invention
[0005] In view of the above problems, the present invention provides a method and system for accelerating ship template matching based on DSP that can at least solve some of the above technical problems. The shared memory area MSM is divided according to different storage requirements, and then the Fourier descriptors FD1 and FD2 of the longest contour line C0 of the input image, the template image T1, and the template image T2 are simultaneously extracted by three different DSP multi-cores; then the DSP multi-core is used to slide and calculate the Fourier descriptors FD01, FD02,..., FD0N of the longest contour line C0 of the input image; calculate the Fourier descriptors of the ship template image and the Euclidean distance from the Fourier descriptors of the longest contour line C0 of the ship image to obtain the final matching result.
[0006] On the one hand, an embodiment of the present invention provides a method for accelerating ship template matching based on DSP, including:
[0007] S0. Divide the data storage space for the DSP multi-core; initialize the data storage space and the IPC interrupt; input the ship image, the ship template image, and the ship position data into the data storage space, and perform calculations by the DSP multi-core;
[0008] S1. Use the DSP multi-core to calculate the longest contour line C0 of the ship image and the Fourier descriptor of the ship template image in parallel;
[0009] S2. Use the DSP multi-core to calculate the set of Fourier descriptors obtained by circularly shifting the longest contour line C0 in parallel;
[0010] S3. Calculate the Euclidean distance between the Fourier descriptor of the ship template image in step S1 and the set of Fourier descriptors obtained by circularly shifting the longest contour line C0 in step S2; the ship template image corresponding to the minimum value of the Euclidean distance is the final matching result.
[0011] Further, the S0 specifically includes:
[0012] S01. For each DSP core, divide a corresponding storage space on the shared memory MSM in the data storage space; the undivided space of the shared memory MSM serves as the shared storage area for the DSP multi-core, that is, the MSM multi-core shared storage area;
[0013] S02. The DSP multi-core enables the global interrupt and registers the interrupt function;
[0014] S03. The DSP multi-core receives the ship image, the ship template image, and the ship position data, triggers the IPC interrupt, and starts to execute step S1; the DSP multi-core includes DSP Core0, DSP Core1, and DSP Core2.
[0015] Further, the S1 specifically includes:
[0016] Calculate the longest contour line C0 of the ship image through the DSP Core0; at the same time, calculate the Fourier descriptors of the ship template image through the DSP Core1 and DSP Core2; the ship template image includes the ship template image T1 and the ship template image T2.
[0017] Further, calculating the longest contour line of the ship image through the DSP Core0 specifically includes:
[0018] S11. The DSP Core0 crops the region of interest of the ship on the ship image according to the ship position data, rotates the region of interest of the ship to the horizontal direction, and extracts the boundary of the rotated region of interest of the ship to obtain a boundary contour map;
[0019] S12. The DSP Core0 performs a Dilation expansion operation on the boundary contour map, and extracts the longest contour line C0 from the boundary contour map processed by the Dilation expansion operation; and stores the longest contour line C0 in the MSM multi-core shared storage area; the longest contour line C0 includes N contour points;
[0020] S13. The DSP Core0 ends step S1 and issues an interrupt S1 end signal; after receiving the interrupt S1 end signals sent by the DSP Core1 and DSP Core2, the DSP Core0 triggers an IPC interrupt and starts to execute step S2.
[0021] Further, calculating the Fourier descriptor of the ship template image by the DSP Core1 specifically includes:
[0022] S11. The DSP Core1 extracts the longest contour line C1 from the ship template image T1;
[0023] S12. The DSP Core1 optimizes the data structure of the longest contour line C1 and accelerates the construction of the descriptor through the SIMD instruction set; performs an FFT transform on the descriptor to obtain the Fourier descriptor FD1; stores the Fourier descriptor FD1 in the MSM multi-core shared storage area;
[0024] S13. The DSP Core1 ends step S1 and issues an interrupt S1 end signal; after receiving the interrupt S1 end signals sent by the DSP Core0 and DSP Core2, the DSP Core1 triggers an IPC interrupt and starts to execute step S2.
[0025] Further, calculating the Fourier descriptor of the ship template image by the DSP Core2 specifically includes:
[0026] S11. The DSP Core2 extracts the longest contour line C2 from the ship template image T2;
[0027] S12. The DSP Core2 optimizes the data structure of the longest contour line C2, accelerates the construction of descriptors through the SIMD instruction set; performs FFT transformation on the descriptors to obtain Fourier descriptors FD2; stores the Fourier descriptors FD2 into the MSM multi-core shared storage area;
[0028] S13. The DSP Core2 ends step S1 and sends an interrupt S1 end signal; after receiving the interrupt S1 end signals sent by the DSP Core0 and DSP Core1, the DSP Core2 triggers an IPC interrupt and starts to execute S2.
[0029] Further, the S2 specifically includes:
[0030] S21. For the longest contour line C0, starting from the first contour point, slide and select N contour points to obtain a set of N contour points; use the DSP multi-core to perform parallel calculation on the set of N contour points to obtain Fourier descriptors FD01, FD02,..., FD0N; and store the Fourier descriptors FD01, FD02,..., FD0N into the MSM multi-core shared storage area;
[0031] S22. After the DSP multi-core finishes the calculation, it triggers an IPC interrupt and starts to execute step S3.
[0032] Further, the S3 specifically includes:
[0033] S31. The DSP Core0 obtains the Fourier descriptor FD1 and Fourier descriptors FD01, FD02,..., FD0N from the MSM multi-core shared storage area, and calculates the Euclidean distances between the Fourier descriptor FD1 and Fourier descriptors FD01, FD02,..., FD0N respectively; selects the minimum value among them and records it as OD1MIN;
[0034] S32. The DSP Core0 obtains the Fourier descriptor FD2 and Fourier descriptors FD01, FD02,..., FD0N from the MSM multi-core shared storage area, and calculates the Euclidean distances between the Fourier descriptor FD2 and Fourier descriptors FD01, FD02,..., FD0N respectively; selects the minimum value among them and records it as OD2MIN;
[0035] S33. Compare OD1MIN and OD2MIN, and the ship template image corresponding to the minimum value is the final matching result.
[0036] On the other hand, an embodiment of the present invention also provides a DSP-based ship template matching acceleration system, including an initialization module, a function multi-core parallel acceleration module, a data parallel acceleration module, and a post-processing module;
[0037] The initialization module is used to initialize the data storage space and IPC interrupt; receive input images and detection results;
[0038] The function multi-core parallel acceleration module is used to use the DSP multi-core to parallelly calculate the longest contour line C0 of the ship image and the Fourier descriptors of the ship template image;
[0039] The data parallel acceleration module is used to use the DSP multi-core to parallelly calculate the Fourier descriptors of the longest contour line C0;
[0040] The post-processing module is used to calculate the Euclidean distance between the Fourier descriptors of the ship template image and the Fourier descriptors of the longest contour line C0 of the ship image to obtain the final matching result.
[0041] Compared with the prior art, a ship template matching acceleration method and system based on DSP recorded in the present invention have the following beneficial effects:
[0042] In view of the multi-computation structure characteristics of the matching algorithm, the present invention combines the size and access frequency of variables to manage the storage resources of DSP in a partitioned manner, which speeds up the data access speed of the multi-core DSP;
[0043] From the perspective of function, the present invention multi-core parallelly calculates the Fourier descriptors of the longest contour lines C0, T1, and T2 of the input image. From the data perspective, the present invention multi-core parallelly calculates the set of Fourier descriptors of C0, which shortens the overall time consumption of the matching algorithm;
[0044] The present invention optimizes the data structure of the longest contour line and uses the DSP SIMD instruction to complete twice the data calculation in a single instruction cycle.
[0045] Other features and advantages of the present invention will be described in the subsequent specification, and part of them will become obvious from the specification or will be understood by implementing the present invention. The objectives and other advantages of the present invention can be achieved and obtained through the structures specifically pointed out in the written specification, claims, and drawings.
[0046] The technical solutions of the present invention will be further described in detail below through the drawings and embodiments. Description of the Drawings
[0047] The drawings are used to provide a further understanding of the present invention, and constitute a part of the specification. They are used together with the embodiments of the present invention to explain the present invention, but do not constitute a limitation to the present invention. In the drawings:
[0048] Figure 1It is a framework diagram of a ship template matching acceleration method based on DSP provided by an embodiment of the present invention.
[0049] Figure 2 It is the overall flowchart of a ship template matching acceleration method based on DSP provided by an embodiment of the present invention.
[0050] Figure 3 It is the DSP storage space allocation diagram provided by an embodiment of the present invention.
[0051] Figure 4 It is the binary image and the longest contour image of the input ship region of interest ROI, ship template image T1 and ship template image T2 provided by an embodiment of the present invention.
[0052] Figure 5 It is the schematic diagram of the calculation process of the Fourier operator of the input image provided by an embodiment of the present invention. Detailed implementation manners
[0053] Hereinafter, exemplary embodiments of the present disclosure will be described in more detail with reference to the accompanying drawings. Although the exemplary embodiments of the present disclosure are shown in the drawings, it should be understood that the present disclosure can be implemented in various forms and should not be limited by the embodiments set forth herein. On the contrary, these embodiments are provided so that the present disclosure can be more thoroughly understood and the scope of the present disclosure can be fully conveyed to those skilled in the art.
[0054] See Figure 1 As shown, an embodiment of the present invention provides a ship template matching acceleration method based on DSP, which specifically includes the following steps:
[0055] S0. Divide the data storage space for the DSP multi-core; initialize the data storage space and the IPC interrupt; input the ship image, ship template image and ship position data into the data storage space, and perform calculations by the DSP multi-core (DSP Core0, DSP Core1 and DSP Core2);
[0056] S1. Use the DSP multi-core to parallelly calculate the longest contour line C0 of the ship image and the Fourier descriptor of the ship template image;
[0057] S2. Use the DSP multi-core to parallelly calculate the set of Fourier descriptors obtained by circularly shifting the longest contour line C0 to the right;
[0058] S3. Calculate the Euclidean distance between the Fourier descriptor of the ship template image in step S1 and the set of Fourier descriptors obtained by circularly shifting the longest contour line C0 to the right in step S2; the ship template image corresponding to the minimum Euclidean distance value is the final matching result.
[0059] The following is a detailed description of each of the above steps based on the TMS320C6678-EVM evaluation board. The specific results are as Figure 2 and Figure 3 shown.
[0060] Step S0 specifically includes the following steps:
[0061] S01. First, the DSP multi-core divides the data storage space; there are various storage resources on the DSP chip, including L1, L2, MSM (shared memory), and off-chip storage DDR3; the storage space sizes are in the order of: L1 < L2 < MSM < DDR3, and the access speeds are the opposite; for each DSP core, a corresponding storage space of a certain size is divided on the MSM and DDR3 respectively, and each core has an independent L1 and L2 storage space; the undivided spaces of the MSM and DDR3 are used as multi-core mutually exclusive access shared storage areas, namely the MSM multi-core shared storage area and the DDR3 multi-core shared storage area. The DDR3 is configured with a cache to accelerate access;
[0062] The TMS320C6678-EVM evaluation board mainly includes a TMS320C6678 chip and 4 DDR3 memory chips of 512MB each. The TMS320C6678 chip contains eight cores from Core0 to Core7, and each core contains a 32KB first-level data cache L1D, a 32KB first-level program cache L1P, and a 512KB second-level memory L2. The TMS320C6678 chip also has a 4MB shared memory MSM, and all DSP multi-cores can read and write the MSM area. The access speeds of these storage units are as follows: L1 > L2 > MSM > DDR3.
[0063] In this embodiment, the address spaces of the MSM memory from 0x0C000000 to 0x0C200000 and the DDR3 memory area from 0x80000000 to 0x87000000 are evenly divided into the private use spaces of Core0 to Core7. The area of the MSM memory from 0x0C200000 to 0x0C400000 is a multi-core data sharing area, which is used to store variables such as C0, FD1, FD2, FD01... FD0N, and the multi-cores access these variables in a mutually exclusive manner. In this embodiment, the image data is stored in a one-dimensional array form in a continuous space.
[0064] S02. The DSP multi-core enables the global interrupt and registers the interrupt function;
[0065] S03. The DSP Core receives the ship image, the ship template image, and the ship position data, triggers the IPC interrupt, and starts to execute step S1;
[0066] In the above step S1, the DSP Core0 calculates the longest contour line C0 of the ship image; meanwhile, the DSP Core1 and DSP Core2 calculate the Fourier descriptors of the ship template image. Among them, the ship template image includes the ship template image T1 and the ship template image T2. The specific steps are as follows:
[0067] Calculating the longest contour line of the ship image by DSP Core0 specifically includes:
[0068] S11. The DSP Core0 clips the region of interest ROI of the ship in the ship image according to the ship position data and rotates the region of interest ROI of the ship to the horizontal direction, which can reduce the computational amount of the matching algorithm and improve the matching accuracy at the same time. Then, the DSP Core0 extracts the boundary of the rotated region of interest ROI of the ship, that is, extracts the Canny operator to obtain the boundary contour map. Among them, the region of interest ROI is an area that needs to be processed outlined in the processed image in the form of a square, circle, ellipse, irregular polygon, etc.
[0069] S12. The DSP Core0 performs Dilation operation on the boundary contour map to obtain a binary-image; and extracts the longest contour line C0 from the boundary contour map processed by the Dilation operation, that is, extracts the longest boundary line of the binary-image; and stores the longest contour line C0 in the MSM multi-core shared storage area. Among them, the longest contour line C0 includes N contour points. The specific operation of extracting the longest contour line C0 is as follows:
[0070] (1) Scan each row. Whenever crossing a specified height (whether upward or downward), mark this point as a crossing point.
[0071] (2) Starting from the crossing point found in (1), check whether its adjacent points are crossing points (in a fixed order: up, upper right, right, lower right, down, lower left, left, upper left). If so, continue to find the next adjacent crossing point until there are no adjacent crossing points or a full circle has been searched (that is, the next crossing point has been recorded in the sequence), which means the extraction of a boundary line is completed.
[0072] (3) Repeat the operations in (1) and (2) until the entire binary-image has been scanned and ended, as shown in Figure 3.
[0073] (4) Compare the lengths of the found boundary lines, save the longest boundary line and record it as C0, and copy C0 to the memory area from 0x0C200000 to 0x0C400000.
[0074] S13, DSP Core0 ends step S1 and sends an interrupt S1 end signal; after receiving the interrupt S1 end signals sent by DSP Core1 and DSP Core2, DSP Core0 triggers an IPC interrupt and starts executing step S2.
[0075] The Fourier descriptor of the ship template image is calculated by DSP Core1, specifically including:
[0076] S11, DSP Core1 extracts the longest contour line C1 from the ship template image T1; the specific operation method of extracting the longest contour line C1 can refer to the specific operation method of extracting the longest contour line C0 mentioned above. The result is as follows: Figure 4 As shown;
[0077] S12, DSP Core 1 optimizes the data structure of the longest contour line C1 and accelerates the construction of the descriptor through the SIMD instruction set; performs FFT transformation on the descriptor to obtain the Fourier descriptor FD1; stores the Fourier descriptor FD1 in the MSM multi-core shared memory area. In this embodiment, DSP Core 1 copies FD1 to the memory area 0x0C200000 to 0x0C400000;
[0078] The calculation formula for obtaining the Fourier descriptor FD1 is as follows:
[0079]
[0080]
[0081]
[0082]
[0083] Among them, P i Indicates that the horizontal axis is x i , the vertical coordinate is y i For example, P1 represents a point with abscissa x1 and ordinate y1; gij Indicates that the horizontal axis is x gij , the vertical coordinate is y gij Points, such as p g11 Indicates that the horizontal axis is x g11 , the vertical coordinate is y g11 point; FFT function is the fast Fourier transform function;
[0084] Dist(.) means to find the Euclidean distance of the values in the brackets, for example Dist=(p1,p g11 ) represents the point P1 and point p g11 The Euclidean distance of
[0085] x i and y i are elements in C1; x G and y G represent the X and Y axis coordinates of the geometric center of C1; x i , y i , x j , y j are the coordinates of the point set of C1; N represents the number of contour points in the contour line; x G and y G represent the X and Y axis coordinates of the geometric center of C1.
[0086] S13, DSP Core1 ends step S1 and issues an interrupt S1 end signal; after receiving the interrupt S1 end signals sent by DSP Core0 and DSP Core2, DSP Core1 triggers an IPC interrupt and starts to execute step S2.
[0087] Calculate the Fourier descriptors of the ship template image through DSP Core2, specifically including:
[0088] S11, DSP Core2 extracts the longest contour line C2 from the ship template image T2;
[0089] S12, DSP Core2 optimizes the data structure of the longest contour line C2 and accelerates the construction of descriptors through the SIMD instruction set; performs an FFT transform on the descriptors to obtain the Fourier descriptors FD2; stores the Fourier descriptors FD2 in the MSM multi-core shared storage area, that is, copies FD2 to the memory area from 0x0C200000 to 0x0C400000;
[0090] S13, DSP Core2 ends step S1 and issues an interrupt S1 end signal; after receiving the interrupt S1 end signals sent by DSP Core0 and DSP Core1, DSP Core2 triggers an IPC interrupt and starts to execute S2.
[0091] The above step S2 specifically includes the following steps:
[0092] S21, use DSP 8 to slide and calculate the N - element longest contour line C0 N times, such as Figure 5As shown in the figure, starting from the first contour point, slide and select N contour points, and extract the Fourier descriptors for these N contour points respectively. Slide N times to obtain the Fourier descriptors FD01, FD02, …, FD0N; the N slides use DSP multi-core parallel computing, and store the Fourier descriptors FD01, FD02, …, FD0N in the MSM multi-core shared storage area, that is, copy them to the memory area from 0x0C200000 to 0x0C400000; in this step, C0 has N contour points, each time it slides and moves a point to the right, and it moves N times in total to obtain N sets containing N contour points (the first set: N0, N1…Nn-1; the second set N1, N2…Nn-1, N0; and so on); then calculate N Fourier descriptors for these N sets respectively: FD01, FD02, …, FD0N. The content of multi-core parallel computing is: use 8 cores to parallelly compute these N sets, which can be understood as each core computing N / 8 sets;
[0093] S22. After the DSP multi-core finishes the calculation, trigger an IPC interrupt and start to execute step S3.
[0094] The above step S3 specifically includes the following steps:
[0095] S31. DSP Core0 obtains the Fourier descriptor FD1 and the Fourier descriptors FD01, FD02, …, FD0N from the MSM multi-core shared storage area, and calculates the Euclidean distances between the Fourier descriptor FD1 and the Fourier descriptors FD01, FD02, …, FD0N respectively; select the minimum value among them and denote it as OD1MIN;
[0096] S32. DSP Core0 obtains the Fourier descriptor FD2 and the Fourier descriptors FD01, FD02, …, FD0N from the MSM multi-core shared storage area, and calculates the Euclidean distances between the Fourier descriptor FD2 and the Fourier descriptors FD01, FD02, …, FD0N respectively; select the minimum value among them and denote it as OD2MIN;
[0097] S33. DSP Core0 compares OD1MIN and OD2MIN, and the ship template image corresponding to the minimum value is the final matching result.
[0098] The embodiment of the present invention also provides a ship template matching acceleration system based on DSP, including an initialization module, a function multi-core parallel acceleration module, a data parallel acceleration module, and a post-processing module;
[0099] Among them, the initialization module is used to initialize the data storage space and IPC interrupts; receive input images and detection results; when receiving input images, the image storage method is a one-dimensional array continuous address space; the initialization storage space is used to allocate MSM space for multiple cores as private spaces and as a shared space for multi-core mutual exclusion access, and is also used to allocate external DDR space for multiple cores as private spaces to store larger variables; the initialization IPC interrupt is used to initialize the inter-core communication interrupt and register interrupt functions; after the initialization module ends, the IPC interrupt S1 is triggered to enter the function multi-core parallel acceleration module;
[0100] The function multi-core parallel acceleration module is used to use DSP multi-core parallel computing to calculate the longest contour line C0 of the ship image and the Fourier descriptors of the ship template images, that is, the Fourier descriptor FD1 of the ship template image T1 and the Fourier descriptor FD2 of the ship template image T2; when the function parallel acceleration module extracts the Fourier descriptors, it combines the x and y coordinate numbers to form a __float2_t type and uses SIMD intrinsic related functions for parallel computing; in the function parallel acceleration module, each core copies the calculation result to the MSM multi-core shared storage area; after each core in this module ends the task, the IPC interrupt S2 is triggered to enter the data parallel acceleration module;
[0101] The data parallel acceleration module is used to use DSP multi-core parallel computing to calculate the set of Fourier descriptors obtained by circularly shifting the longest contour line C0, that is, FD01, FD02,..., FD0N; when the data parallel acceleration module extracts the Fourier descriptors, it combines the x and y coordinate data to form a __float2_t type and uses SIMD intrinsic related functions for parallel computing; each core in this module copies the calculation result to the MSM multi-core shared storage area; and after each core ends the task, the IPC interrupt S3 is triggered to enter the post-processing module.
[0102] The post-processing module is used to calculate the Euclidean distance between the Fourier descriptors of the ship template image and the set of Fourier descriptors obtained by circularly shifting the longest contour line C0 of the ship image to obtain the final matching result.
[0103] Obviously, those skilled in the art can make various changes and modifications to the present invention without departing from the spirit and scope of the present invention. Thus, if these modifications and variations of the present invention fall within the scope of the claims of the present invention and their equivalent technologies, the present invention also intends to include these changes and modifications.
Claims
1. A method for accelerating ship template matching based on DSP, characterized in that, Including: S0, partitioning the data storage space for the DSP multi-core; Initializing the data storage space and the IPC interrupt; Inputting the ship image, the ship template image, and the ship position data into the data storage space, and performing calculations by the DSP multi-core; S1, using the DSP multi-core to calculate the longest contour line C0 of the ship image and the Fourier descriptors of the ship template image in parallel; S2, using the DSP multi-core to calculate the set of Fourier descriptors obtained by circularly shifting the longest contour line C0 in parallel; S3, calculating the Euclidean distance between the Fourier descriptors of the ship template image in step S1 and the set of Fourier descriptors obtained by circularly shifting the longest contour line C0 in step S2; the ship template image corresponding to the minimum value of the Euclidean distance is the final matching result; The specific content of S0 includes: S01, for each DSP core, partitioning a corresponding storage space of a corresponding size on the shared memory MSM in the data storage space; the unpartitioned space of the shared memory MSM is used as the shared storage area of the DSP multi-core, that is, the MSM multi-core shared storage area; S02, enabling the global interrupt of the DSP multi-core and registering the interrupt function; S03, the DSP multi-core receives the ship image, the ship template image, and the ship position data, triggers the IPC interrupt, and starts to execute step S1; the DSP multi-core includes DSP Core0, DSP Core1, and DSP Core2; The specific content of S1 includes: Calculating the longest contour line C0 of the ship image through the DSP Core0; at the same time, calculating the Fourier descriptors of the ship template image through the DSP Core1 and DSP Core2; the ship template image includes the ship template image T1 and the ship template image T2.
2. The method for accelerating ship template matching based on DSP according to claim 1, wherein Calculating the longest contour line of the ship image through the DSP Core0 specifically includes: S11, the DSP Core0 clips the ship region of interest on the ship image according to the ship position data, rotates the ship region of interest to the horizontal direction, and extracts the boundary of the rotated ship region of interest to obtain the boundary contour map; S12, the DSP Core0 performs Dilation operation on the boundary contour map, and extracts the longest contour line C0 from the boundary contour map after the Dilation operation; and stores the longest contour line C0 in the MSM multi-core shared storage area; the longest contour line C0 includes N contour points; S13, the DSP Core0 ends step S1 and sends an interrupt S1 end signal; after receiving the interrupt S1 end signals sent by the DSP Core1 and DSP Core2, the DSP Core0 triggers the IPC interrupt and starts to execute step S2.
3. The ship template matching acceleration method based on DSP according to claim 1, characterized in that Calculating the Fourier descriptors of the ship template image through the DSP Core1 specifically includes: S11, the DSP Core1 extracts the longest contour line C1 from the ship template image T1; S12. The DSP Core1 optimizes the data structure of the longest contour line C1, accelerates the construction of descriptors through the SIMD instruction set, performs FFT transformation on the descriptors to obtain the Fourier descriptor FD1, and stores the Fourier descriptor FD1 into the MSM multi-core shared storage area. S13. The DSP Core1 ends step S1 and issues an interrupt S1 end signal. After receiving the interrupt S1 end signals sent by the DSP Core0 and DSP Core2, the DSP Core1 triggers an IPC interrupt and starts to execute step S2.
4. A method for accelerating ship template matching based on DSP according to claim 1, characterized in that, Calculating the Fourier descriptor of the ship template image by the DSP Core2 specifically includes: S11. The DSP Core2 extracts the longest contour line C2 from the ship template image T2. S12. The DSP Core2 optimizes the data structure of the longest contour line C2, accelerates the construction of descriptors through the SIMD instruction set, performs FFT transformation on the descriptors to obtain the Fourier descriptor FD2, and stores the Fourier descriptor FD2 into the MSM multi-core shared storage area. S13. The DSP Core2 ends step S1 and issues an interrupt S1 end signal. After receiving the interrupt S1 end signals sent by the DSP Core0 and DSP Core1, the DSP Core2 triggers an IPC interrupt and starts to execute S2.
5. The method for accelerating ship template matching based on DSP according to claim 2, wherein The specific content of S2 includes: S21. For the longest contour line C0, starting from the first contour point, slide to select N contour points to obtain N sets of contour points. Use the DSP multi-core to perform parallel calculation on the N sets of contour points to obtain the Fourier descriptors FD01, FD02,..., FD0N, and store the Fourier descriptors FD01, FD02,..., FD0N into the MSM multi-core shared storage area. S22. After the DSP multi-core finishes the calculation, it triggers an IPC interrupt and starts to execute step S3.
6. The method for accelerating ship template matching based on DSP according to claim 2, characterized in that, The specific content of S3 includes: S31. The DSP Core0 obtains the Fourier descriptor FD1 and the Fourier descriptors FD01, FD02,..., FD0N from the MSM multi-core shared storage area, and calculates the Euclidean distances between the Fourier descriptor FD1 and the Fourier descriptors FD01, FD02,..., FD0N respectively. Select the minimum value and denote it as OD1MIN. S32. The DSP Core0 obtains the Fourier descriptor FD2 and the Fourier descriptors FD01, FD02,..., FD0N from the MSM multi-core shared storage area, and calculates the Euclidean distances between the Fourier descriptor FD2 and the Fourier descriptors FD01, FD02,..., FD0N respectively. Select the minimum value and denote it as OD2MIN. S33. Compare OD1MIN and OD2MIN, and the ship template image corresponding to the minimum value is the final matching result.
7. A ship template matching acceleration system based on DSP, comprising an initialization module, a function multi-core parallel acceleration module, a data parallel acceleration module, and a post-processing module; The initialization module is used to initialize the data storage space and IPC interrupts; receive the input image and the detection result; The function multi-core parallel acceleration module is used to use the DSP multi-core parallel computing to calculate the longest contour line C0 of the ship image and the Fourier descriptor of the ship template image; The data parallel acceleration module is used to use the DSP multi-core parallel computing to calculate the set of Fourier descriptors obtained by circularly shifting the longest contour line C0; The post-processing module is used to calculate the Euclidean distance between the Fourier descriptor of the ship template image and the set of Fourier descriptors obtained by circularly shifting the longest contour line C0 of the ship image, and obtain the final matching result; Among them, the working content of the initialization module includes: For each DSP core, divide the corresponding storage space on the shared memory MSM in the data storage space; the unallocated space of the shared memory MSM is used as the DSP multi-core shared storage area, that is, the MSM multi-core shared storage area; The DSP multi-core enables the global interrupt and registers the interrupt function; The DSP multi-core receives the ship image, the ship template image, and the ship position data, triggers the IPC interrupt, and starts to execute the function multi-core parallel acceleration module; the DSP multi-core includes DSP Core0, DSP Core1, and DSP Core2; Among them, the working content of the function multi-core parallel acceleration module includes: Calculate the longest contour line C0 of the ship image through the DSP Core0; at the same time, calculate the Fourier descriptors of the ship template image through the DSP Core1 and DSP Core2; the ship template image includes the ship template image T1 and the ship template image T2.
Citation Information
Patent Citations
Automatic building identification method based on Fourier descriptor
CN104331682A
A method for developing and debugging a multi-core DSP program, a program document and a loading method
CN109032938A