CN116416442A - Hyperspectral image abnormal target detection method based on CUDA acceleration - Google Patents
Hyperspectral image abnormal target detection method based on CUDA acceleration Download PDFInfo
- Publication number
- CN116416442A CN116416442A CN202310263730.XA CN202310263730A CN116416442A CN 116416442 A CN116416442 A CN 116416442A CN 202310263730 A CN202310263730 A CN 202310263730A CN 116416442 A CN116416442 A CN 116416442A
- Authority
- CN
- China
- Prior art keywords
- matrix
- kernel function
- data
- hyperspectral image
- abnormal
- Prior art date
- Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
- Pending
Links
- 238000001514 detection method Methods 0.000 title claims abstract description 38
- 230000002159 abnormal effect Effects 0.000 title claims abstract description 31
- HPTJABJPZMULFH-UHFFFAOYSA-N 12-[(Cyclohexylcarbamoyl)amino]dodecanoic acid Chemical compound OC(=O)CCCCCCCCCCCNC(=O)NC1CCCCC1 HPTJABJPZMULFH-UHFFFAOYSA-N 0.000 title claims abstract description 24
- 230000001133 acceleration Effects 0.000 title claims abstract description 14
- 239000011159 matrix material Substances 0.000 claims abstract description 166
- 238000000034 method Methods 0.000 claims abstract description 41
- 238000004364 calculation method Methods 0.000 claims abstract description 28
- 238000012545 processing Methods 0.000 claims abstract description 9
- 238000000354 decomposition reaction Methods 0.000 claims description 13
- 230000005856 abnormality Effects 0.000 claims description 11
- 238000001228 spectrum Methods 0.000 claims description 11
- 239000013598 vector Substances 0.000 claims description 10
- 230000003595 spectral effect Effects 0.000 claims description 9
- 230000008569 process Effects 0.000 claims description 8
- 238000005259 measurement Methods 0.000 claims description 2
- 230000006870 function Effects 0.000 abstract description 52
- 230000011218 segmentation Effects 0.000 abstract 1
- 238000005516 engineering process Methods 0.000 description 5
- 230000009467 reduction Effects 0.000 description 4
- 238000006467 substitution reaction Methods 0.000 description 3
- 238000004458 analytical method Methods 0.000 description 2
- 238000000701 chemical imaging Methods 0.000 description 2
- 238000013461 design Methods 0.000 description 2
- 238000009826 distribution Methods 0.000 description 2
- 238000002474 experimental method Methods 0.000 description 2
- 229940050561 matrix product Drugs 0.000 description 2
- 238000007781 pre-processing Methods 0.000 description 2
- 238000011897 real-time detection Methods 0.000 description 2
- 238000012271 agricultural production Methods 0.000 description 1
- 238000011161 development Methods 0.000 description 1
- 238000010586 diagram Methods 0.000 description 1
- 230000007613 environmental effect Effects 0.000 description 1
- 238000003384 imaging method Methods 0.000 description 1
- 238000012986 modification Methods 0.000 description 1
- 230000004048 modification Effects 0.000 description 1
- 238000003672 processing method Methods 0.000 description 1
- 239000004065 semiconductor Substances 0.000 description 1
- 239000000126 substance Substances 0.000 description 1
- 238000012360 testing method Methods 0.000 description 1
Images
Classifications
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06V—IMAGE OR VIDEO RECOGNITION OR UNDERSTANDING
- G06V10/00—Arrangements for image or video recognition or understanding
- G06V10/40—Extraction of image or video features
- G06V10/58—Extraction of image or video features relating to hyperspectral data
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F17/00—Digital computing or data processing equipment or methods, specially adapted for specific functions
- G06F17/10—Complex mathematical operations
- G06F17/11—Complex mathematical operations for solving equations, e.g. nonlinear equations, general mathematical optimization problems
- G06F17/12—Simultaneous equations, e.g. systems of linear equations
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F17/00—Digital computing or data processing equipment or methods, specially adapted for specific functions
- G06F17/10—Complex mathematical operations
- G06F17/16—Matrix or vector computation, e.g. matrix-matrix or matrix-vector multiplication, matrix factorization
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06V—IMAGE OR VIDEO RECOGNITION OR UNDERSTANDING
- G06V10/00—Arrangements for image or video recognition or understanding
- G06V10/94—Hardware or software architectures specially adapted for image or video understanding
- G06V10/955—Hardware or software architectures specially adapted for image or video understanding using specific electronic processors
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06V—IMAGE OR VIDEO RECOGNITION OR UNDERSTANDING
- G06V2201/00—Indexing scheme relating to image or video recognition or understanding
- G06V2201/07—Target detection
-
- Y—GENERAL TAGGING OF NEW TECHNOLOGICAL DEVELOPMENTS; GENERAL TAGGING OF CROSS-SECTIONAL TECHNOLOGIES SPANNING OVER SEVERAL SECTIONS OF THE IPC; TECHNICAL SUBJECTS COVERED BY FORMER USPC CROSS-REFERENCE ART COLLECTIONS [XRACs] AND DIGESTS
- Y02—TECHNOLOGIES OR APPLICATIONS FOR MITIGATION OR ADAPTATION AGAINST CLIMATE CHANGE
- Y02A—TECHNOLOGIES FOR ADAPTATION TO CLIMATE CHANGE
- Y02A40/00—Adaptation technologies in agriculture, forestry, livestock or agroalimentary production
- Y02A40/10—Adaptation technologies in agriculture, forestry, livestock or agroalimentary production in agriculture
Abstract
The invention discloses a hyperspectral image abnormal target detection method based on CUDA acceleration, and relates to the field of abnormal target detection. The invention aims to solve the problem that the real-time performance of abnormal target detection by utilizing hyperspectral images is poor at present. The detection method based on CUDA acceleration is provided, and mainly comprises the following steps: 1. the CPU host acquires and preprocesses the hyperspectral image through data reconstruction; 2. copying the preprocessed data from the memory of the CPU host to the video memory of the GPU equipment; 3. designing a matrix mean value and a differential kernel function to perform data decentralization, and designing a matrix multiplication kernel function, a generalized matrix inversion kernel function, a Hadamard product kernel function and a row summation kernel function to perform calculation of a covariance matrix, an inverse covariance matrix and an anomaly detection result; 4. and performing threshold segmentation on the CPU host end and storing the detection result to the memory end. The method is realized based on the heterogeneous programming model, and can meet the real-time processing requirement of hyperspectral image data.
Description
Technical Field
The invention relates to the field of abnormal target detection, in particular to a hyperspectral image abnormal target detection method based on CUDA acceleration.
Background
Hyperspectral imaging sensors typically measure the energy of received light in tens or hundreds of narrow spectral bands at each spatial location of an image, and as different substances typically exhibit differentiated spectral characteristics, objects in an observed scene can be classified and identified using hyperspectral imaging techniques, which have been widely used in the fields of environmental detection, agricultural production, military detection, and the like. When the spectral characteristics of the target are unknown, the target detection is generally performed by searching pixels deviating from the typical spectrum of the image, and the method is generally called abnormal target detection.
The existing anomaly detection technology for hyperspectral images is mostly derived from an anomaly value detection method in statistics, spectral features in the images are dominated by the background under the condition that targets occupy a small proportion of the whole images, at the moment, the anomaly value detection can calculate the deviation degree between a sample to be detected and background distribution through a preset measurement form, so that objects unlikely to be the background are detected. Each pixel in the hyperspectral image can be expressed as a high-dimensional vector composed of a sampled spectrum, so that the anomaly detection method based on the principle above generally needs to measure the deviation value of each vector to judge the anomaly degree.
In the current anomaly detection method for hyperspectral images, the most classical is an RX algorithm based on generalized likelihood test, which finds outliers by comparing the mahalanobis distance of the current position and the background position on the basis of modeling the image as a Gaussian distribution. The modeling of the RX algorithm is simple, the problems of correlation among spectrums and the like are not considered, RX based on a kernel function, a background joint sparse representation method and the like are derived, and the computational complexity of the method is higher than that of a reference RX algorithm. With the rapid development of imaging technology, the band number and the space size of hyperspectral data are continuously increased, and on a common CPU platform, even the RX algorithm with the lowest operation complexity cannot meet the requirement of real-time operation. With the progress of semiconductor technology in recent years, the computing power of GPUs has been rapidly increased, and GPUs are increasingly applied to intensive computation of large-scale image matrices due to the superior parallel computing power. The method carries out deep analysis on each step of the current detection algorithm, converts the computation intensive steps which are executed in series into a matrix computation mode with higher efficiency, designs a plurality of kernel functions based on CUDA to improve the parallel granularity of the algorithm, reasonably allocates computing resources, plays respective computing advantages of a CPU and a GPU platform, and realizes real-time detection of abnormal targets in hyperspectral images.
Disclosure of Invention
The invention aims to solve the problems that the existing hyperspectral image abnormal target detection method is low in operation speed and cannot meet the real-time performance when being implemented by a hardware platform, and provides a hyperspectral image abnormal target detection method based on CUDA acceleration. Aiming at a hyperspectral image processing task, the heterogeneous operation advantages of a CPU and a GPU in a CUDA model are fully utilized, a serial processing instruction is put into a CPU host end for operation, and an operation instruction containing a large number of intensive numerical operations is put into a GPU equipment end with more computing units for operation, so that high-speed operation is realized.
In order to achieve the above object, the present invention is realized by the following technical scheme:
the hyperspectral image abnormal target detection method based on CUDA acceleration comprises the following steps:
step one, hyperspectral image data acquisition and reconstruction;
CPU host reads hyperspectral image data D from device memory H×W×B Will input data D H×W×B The elements in the data matrix are rearranged according to the order of band dimension priority and reconstructed into a two-dimensional data matrix I N×B The instruction is placed in a memory band having a higher memoryThe wide CPU host executes, where H is the image height, W is the image width, B is the number of image bands, and n=h×w is the number of pels of the single-band image.
Step two, the differential matrix R after the decentralization is carried out N×B Copying the memory from the CPU host end to the video memory of the GPU equipment end.
Step three, the two-dimensional data matrix is decentered;
(3.1) first calculate a two-dimensional data matrix I N×B Mean vector in spectral dimensionThe calculation formula is as follows:
wherein I is ij The method comprises the steps of representing the numerical value of a two-dimensional matrix at an ith pixel position and a jth wave band, calculating the mean value of a kernel function at a device end by adopting the idea of reduction summation, distributing N data contained in a single wave band to different data blocks, adding the data belonging to different thread blocks into one thread block correspondingly, adding the data reduction in the thread blocks, and calculating the mean value vector of the data in the spectrum dimension according to a formula (1).
(3.2) subtracting the mean value of the corresponding band from the data matrix to obtain a decentered differential matrix R N×B The matrix is defined as follows:
the number of bands B of real hyperspectral data is typically several hundred, and a general GPU device can ensure that enough thread resources are allocated to each band of data, where a differential kernel function sets a single thread as a corresponding single data point, and the function subtracts the corresponding band average value from all data values in the corresponding band of the original data according to formula (2).
Calculating the abnormal degree of each pixel position in the hyperspectral image, wherein the step is realized by designing a matrix multiplication kernel function, a generalized matrix inversion kernel function, a matrix Hadamard product kernel function and a matrix row summation kernel function at the GPU equipment end, and the solving process comprises the following steps:
(4.1) covariance matrix solution, which is realized by matrix multiplication kernel function, the differential matrix R after decentralization N×B The covariance matrix C is calculated as follows:
wherein (R) N×B ) T Representation matrix R N×B The matrix multiplication in this step involves a number of identically operating floating point multiplication and addition operations, and for a matrix of input size N x B, the solution of a single element in the resulting matrix involves N times floating point multiplication and N-1 times floating point addition, with N in the actual hyperspectral data up to 10 4 And if the number of the floating point number sets is more than the number of the threads supported by the GPU equipment, the floating point number can not be directly multiplied and added to be correspondingly allocated to one thread of the GPU. Therefore, the input matrix R of the kernel function needs to be set under the constraint of hardware resources N×B Dividing into a plurality of small blocks, wherein each block is used as an independent CUDA thread block, each thread block executes a calculation task in parallel, each small matrix is distributed to a GPU (graphic processing unit) for calculation, and the calculation results of all the small matrices are combined to obtain a final matrix product C.
(4.2) solving an inverse covariance matrix by a generalized matrix inversion kernel function for calculating an inverse matrix C of the covariance matrix C -1 The matrix inversion is solved by LU decomposition, which converts matrix inversion operation into multiplication operation among triangular matrices, and firstly, the covariance matrix is decomposed into two triangular matrices:
wherein comprises L ij (1<i,j,<B) Is a lower triangular matrix comprising U ij (1<i,j,<B) The inverse of the upper triangular matrix L and the lower triangular matrix U can be obtained through an iterative formula, and then the inverse of the original matrix C is calculated as follows:
C -1 =(LU) -1 =U -1 L -1 (5)
the LU decomposition inversion kernel function consists of two subfunctions, getrfBatched and getricBatched: the getrfpatched function first blocks the matrix C to be inverted. For each block, performing LU decomposition by using a CUDA parallel programming technology to decompose the covariance matrix C into a lower triangular matrix L and an upper triangular matrix U; because LU decomposition may have the problem of unstable numerical value, getriBatched firstly judges whether LU decomposition is successful or not, then converts the inverse problem of solving the matrix into the problem of solving a series of linear equations, each matrix block uses the function to solve the linear equations, and finally, the inverse matrix C of the complete matrix C is obtained by splicing the inverse matrix of each block together -1 。
(4.3) solving an abnormality degree matrix, wherein the abnormality degree matrix is obtained through a matrix multiplication kernel function, a matrix Hadamard product kernel function and a matrix row summation kernel function, and the characteristic of the abnormality degree of each pixel position in a reference RX algorithm is Mahalanobis distance, namely:
wherein the method comprises the steps ofFor the spectrum vector of the i pixel position in the hyperspectral image, the method optimizes the solution of an anomaly operator from serial calculation of the Mahalanobis distance of each pixel to matrix multiplication, matrix point multiplication and matrix row summation operation through formula substitution, wherein the formula (6) is equivalent to:
wherein is the operation of matrix multiplication,for matrix Hadamard products, i.e. multiplication of two matrix corresponding position elements, sum (1) means summing each row of the matrix at the position. The matrix multiplication operation in the formula (7) can multiplex the matrix multiplication kernel function in the step (4.1), the floating point number multiplication times related to the matrix Hadamard product operation is equal to the product of the pixel number and the spectrum band number of the hyperspectral image, namely N multiplied by B, and each operation cannot be independently endowed with a thread under the limitation of GPU hardware resources, so that the matrix Hadamard product kernel function firstly divides a data matrix into blocks, each block is used as an independent CUDA thread block, the results are combined after the multiplication calculation is completed, the matrix line summation operation is a sub-function of the matrix mean kernel function in the step (3.1), the matrix multiplication kernel function can be multiplexed, and the result matrix D can be finally obtained through the calculation RX 。
Step five, the result matrix D RX Copying the data from the GPU equipment end to the CPU host end, applying for a memory space at the CPU host end, and storing the result matrix data.
Step six, counting the detection rate and the false alarm rate under different threshold conditions according to the abnormality degree of each sample to be detected, and determining a corresponding global threshold T according to the acceptable false alarm alpha to obtain a final detection result as follows:
wherein RD (x) =1 represents that the pixel is an abnormal pixel, RD (x) =0 represents that the pixel is not abnormal, the part relates to a large number of branch judgment logic operations, the operation complexity is low, the operation is finished at a CPU host end, and after the CPU finishes the abnormal judgment, the result is stored in the memory device.
Compared with the prior art, the invention has the following advantages:
according to the method, by utilizing the characteristic of high GPU parallel processing speed, matrix mean and difference kernel functions are designed at a GPU equipment end, the kernel functions are solved by covariance matrixes, the kernel functions are solved by generalized matrix inversion based on LU decomposition, and the calculation speed is improved by matrix multiplication kernel functions in a multithread mode at the GPU equipment end;
the data in the steps are stored in a single-precision floating point number form so as to meet the calculation precision;
and (3) optimizing an anomaly detection operator solving method through formula substitution, optimizing the Mahalanobis distance of each pixel from serial calculation into matrix point multiplication operation, designing an anomaly detection operator solving kernel function, remarkably improving the calculation efficiency compared with the traditional reference RX method running at a CPU host end, and being capable of meeting the operation instantaneity of detecting the anomaly target of the hyperspectral image.
Drawings
FIG. 1 is a reference RX algorithm flow chart;
FIG. 2 is a diagram of a data processing and heterogeneous programming model design of the method of the present invention;
FIG. 3 is a truth chart of a hyperspectral image to be detected;
FIG. 4a is a graph of the results of a process employing a reference RX algorithm;
FIG. 4b is a graph of the results of a process employing the method of the present invention;
Detailed Description
The hyperspectral image abnormal target detection method based on CUDA acceleration comprises the following steps:
step one, hyperspectral data acquisition and reconstruction;
CPU host reads hyperspectral image data D from device memory H×W×B Will input data D H×W×B The elements in the data matrix are rearranged according to the order of band dimension priority and reconstructed into a two-dimensional data matrix I N×B The instruction is put into a CPU host end with higher memory bandwidth for execution, wherein H is the image height, W is the image width, B is the image band number, and N=H×W is the pixel number of the single-spectrum image.
Step two, the differential matrix R after the decentralization is carried out N×B Copying from a CPU host end to a GPU equipment end, firstly applying for a video memory space at the GPU equipment end, and then copying input differential matrix data according to a video memory space address.
Step three, the two-dimensional data matrix is decentered;
for a two-dimensional data matrix I N×B Calculating the average value of hyperspectral data in each spectral dimensionThe calculation method is that
Wherein I is ij The method comprises the steps of representing the numerical value of a two-dimensional matrix at an ith pixel position and a jth wave band, calculating the mean value of a kernel function at a device end by adopting the idea of reduction summation, distributing N data contained in a single wave band to different data blocks, adding the data belonging to different thread blocks into one thread block correspondingly, adding the data reduction in the thread blocks, and calculating the mean value vector of the data in the spectrum dimension according to a formula (1).
The second step of decentralization is to subtract the mean value of the corresponding wave bands from the data matrix to obtain a differential matrix R after regional decentralization N ×B The matrix is defined as follows:
the number of bands B of real hyperspectral data is typically several hundred, and a general GPU device can ensure that enough thread resources are allocated to each band of data, where a differential kernel function sets a single thread as a corresponding single data point, and the function subtracts the corresponding band average value from all data values in the corresponding band of the original data according to formula (2).
Calculating the abnormal degree of the position of each pixel of the hyperspectral image, wherein the step is realized by designing a matrix multiplication kernel function, a generalized matrix inversion kernel function, a matrix Hadamard product kernel function and a matrix line summation kernel function at the GPU equipment end, and the solving process comprises the following steps:
(4.1) covariance momentMatrix solving, which is realized by matrix multiplication kernel function, and the differential matrix R after decentralization N×B The covariance matrix C is calculated as follows:
wherein (R) N×B ) T Representation matrix R N×B The matrix multiplication in this step involves a number of identically operating floating point multiplication and addition operations, and for a matrix of input size N x B, the solution of a single element in the resulting matrix involves N times floating point multiplication and N-1 times floating point addition, with N in the actual hyperspectral data up to 10 4 And if the number of the floating point number sets is more than the number of the threads supported by the GPU equipment, the floating point number can not be directly multiplied and added to be correspondingly allocated to one thread of the GPU. Therefore, the input matrix R of the kernel function needs to be set under the constraint of hardware resources N×B Dividing into a plurality of small blocks, wherein each block is used as an independent CUDA thread block, each thread block parallelly executes a calculation task, each small matrix is distributed to a GPU calculation unit for calculation, meanwhile, data stored in a global memory of a GPU equipment end are copied into a shared memory of the thread block in a block mode, so that the data access speed is improved, and finally, the calculation results of all the small matrices are combined to obtain a final matrix product C.
(4.2) solving an inverse covariance matrix by a generalized matrix inversion kernel function for calculating an inverse matrix C of the covariance matrix C -1 The matrix inversion is solved by LU decomposition, matrix inversion operation is converted into multiplication operation among triangular matrixes, and covariance matrixes are decomposed into two triangular matrixes firstly:
wherein comprises L ij (1<i,j,<B) Is a lower triangular matrix comprising U ij (1<i,j,<B) Is an upper triangular matrix, an upper triangular matrix L and a lower triangular matrix UThe inverse can be obtained by an iterative formula, and then the inverse of the original matrix C is calculated as follows:
C -1 =(LU) -1 =U -1 L -1 (5)
the LU decomposition inversion kernel function consists of two subfunctions, getrfBatched and getricBatched: the getrfpatched function first blocks the matrix C to be inverted. For each block, performing LU decomposition by using a CUDA parallel programming technology to decompose the covariance matrix C into a lower triangular matrix L and an upper triangular matrix U; because LU decomposition may have the problem of unstable numerical value, getriBatched firstly judges whether LU decomposition is successful or not, then converts the problem of solving matrix inversion into the problem of solving a series of linear equations, each matrix block uses the function to solve the linear equations, and finally, the inverse matrix C of the complete matrix C is obtained by splicing the inverse matrix of each block together -1 。
(4.3) solving an abnormality degree matrix, wherein the abnormality degree matrix is obtained through matrix multiplication kernel function, matrix Hadamard product kernel function and matrix row summation kernel function calculation, and the characteristic of the abnormality degree of each pixel position in a reference RX algorithm is Mahalanobis distance, namely:
wherein the method comprises the steps ofFor the spectral vector of the i-th pixel position in the hyperspectral image, the spectral vector of each pixel position in the hyperspectral data needs to be accessed in series by the calculation of an anomaly degree matrix according to the formula (6), the time cost is high, the method optimizes the solution of an anomaly operator from the serial calculation of the Mahalanobis distance of each pixel into matrix multiplication, matrix point multiplication and matrix row summation operation through formula substitution, and the formula (6) is equivalent to:
wherein is the operation of matrix multiplication,for matrix Hadamard products, i.e. multiplication of two matrix corresponding position elements, sum (1) represents summing each row of the matrix at the position. The matrix multiplication operation in the formula (7) can multiplex the matrix multiplication kernel function in the step (4.1), the floating point number multiplication times related to the matrix Hadamard product operation is equal to the product of the pixel number and the spectrum band number of the hyperspectral image, namely N multiplied by B, and each operation cannot be independently endowed with a thread under the limitation of GPU hardware resources, so that the matrix Hadamard product kernel function firstly divides a data matrix into blocks, each block is used as an independent CUDA thread block, the results are combined after the multiplication calculation is completed, the matrix line summation operation is a sub-function of the matrix mean kernel function in the step (3.1), the matrix multiplication kernel function can be multiplexed, and the result matrix D can be finally obtained through the calculation RX 。
Step five, the result matrix D RX Copying from the GPU equipment end to the CPU host end, firstly applying for a memory space at the CPU host end, and then copying data of a result matrix according to a memory address.
Step six, counting the detection rate and the false alarm rate under different threshold conditions according to the abnormality degree of each sample to be detected, and determining a corresponding global threshold T according to the acceptable false alarm alpha to obtain a final detection result as follows:
wherein RD (x) =1 indicates that the pel is an abnormal pel, RD (x) =0 indicates that the pel is not abnormal, and then the result is copied from the memory of the CPU host to the data memory.
Referring to fig. 2, the above implementation method is related to the process of processing the real hyperspectral data and the related memory device, CPU host device and GPU device.
True hyperspectral image processing experiment
The effectiveness of the invention is further illustrated by the comparison experiment which is carried out based on the CPU serial realization of the abnormality detection algorithm and the CUDA parallel realization algorithm.
1. Experimental conditions
Data: a true hyperspectral image dataset HYDICE urban dataset, image height h=80, width w=100, band number b=162;
hardware conditions: GPU model GTX3070, CPU model Intel i7-11800H;
2. experimental details
Based on a real hyperspectral image data set uban dataset, a reference RX processing program only running on a CPU host side and a heterogeneous programming processing program adopting the method are respectively realized, the calculation time consumption of two implementation modes is counted through segment timing, and the result is shown in a table 1.
Table 1 time-consuming comparison table of CPU-based serial implementation method and CUDA-based parallel implementation method
Step (a) | Executing operation names | CPU operation is time-consuming | GPU operation is time consuming |
1 | Data preprocessing | 0.024 | 0.024 |
2 | Data de-centering | 0.003 | 0.001 |
3 | Covariance matrix calculation | 0.551 | 0.003 |
4 | Covariance matrix inversion | 0.016 | 0.011 |
5 | Mahalanobis distance calculation | 0.636 | 0.017 |
Total (S) | 1.230 | 0.056 |
The data preprocessing in the step 1 comprises hyperspectral data acquisition and reconstruction in the method, and the step needs to be executed at the CPU equipment side in both processing methods.
3. Analysis of results
Referring to fig. 3, a truth chart indicating the location of an abnormal target in hyperspectral data to be detected is shown. Referring to fig. 4a and fig. 4b, the result graphs obtained by adopting the CPU serial method and the GPU parallel method are respectively consistent in calculation result;
table 1 shows the time consumption comparison table of the CPU-based serial implementation method and the CUDA-based parallel implementation method, and the time consumption of the method provided by the invention is reduced from 1.230 to 0.056, the acceleration ratio is 22 times, and the time consumption of 0.056 can meet the task requirement of real-time detection of abnormal targets by utilizing hyperspectral images.
The present invention is capable of other and further embodiments and its several details are capable of modification and variation in light of the present invention, as will be apparent to those skilled in the art, without departing from the spirit and scope of the invention as defined in the appended claims.
Claims (5)
1. The hyperspectral image abnormal target detection method based on CUDA acceleration is characterized by comprising the following steps of:
step one, a CPU host reads hyperspectral image data D from a memory device H×W×B And reconstruct it into two-dimensional data matrix I at host side N×B Wherein H is the image height, W is the image width, B is the number of image bands, n=h×w is the number of single band image pixels;
step two, the differential matrix R after the decentralization is carried out N×B Copying from a CPU host end to a GPU equipment end;
step three, the two-dimensional data matrix is decentered, and the two-dimensional data matrix I is N×B Calculating the average mu of hyperspectral data in the spectrum dimension i 1×B Subtracting the average value of the corresponding wave bands from the data matrix to obtain a differential matrix R B×N ;
Step four, solving the abnormal degree of each pixel position of the hyperspectral image according to a differential matrix R N×B The GPU side is configured with a multithread kernel function to calculate an integral covariance matrix C, and an LU decomposition method is used for calculating an inverse covariance matrix C -1 Improving a process of calculating Mahalanobis distance by traversing and accessing spectrum vectors of each pixel in a reference RX algorithm, optimizing the process into matrix multiplication and matrix point multiplication operation, and establishing a corresponding kernel function at a device end for parallel processing to obtain an anomaly detection result;
copying the result matrix from the GPU equipment end to the CPU host end;
step six, counting the detection rate and the false alarm rate under different threshold conditions according to the abnormality degree of each sample to be detected, and determining a corresponding global threshold T according to the acceptable false alarm alpha to obtain a final detection result as follows:
2. the method for detecting the abnormal target of the hyperspectral image based on CUDA acceleration according to claim 1, wherein the data matrix in the third step is decentered, a matrix mean and difference kernel function is established at the equipment end, threads are allocated according to the data size and hardware resource constraint, and a result is obtained through parallel calculation.
3. The method for detecting the abnormal target of the hyperspectral image based on CUDA acceleration according to claim 1, wherein the calculation process of the Mahalanobis distance of each pixel is optimized and calculated in the fourth step, and the spectral vector of each pixel is optimized from serial access to matrix multiplication operation, matrix dot multiplication operation and matrix row summation operation.
4. The method for detecting abnormal targets in hyperspectral images based on CUDA acceleration according to claim 1, wherein in the fourth step, in order to obtain abnormal detection results, a covariance matrix is established at the equipment end to solve a kernel function, a generalized inverse solution kernel function based on LU decomposition, a matrix multiplication kernel function, a matrix Hadamard product kernel function and a matrix row summation kernel function are established.
5. The method for detecting the abnormal target of the hyperspectral image based on CUDA acceleration according to claim 1, wherein in the sixth step, the method for dividing the target and the background pixel according to the difference measurement result is as follows:
counting the detection rate and the false alarm rate under different threshold conditions according to the abnormality degree of each sample to be detected, and determining a corresponding global threshold T according to the acceptable false alarm alpha to obtain the final detection result as follows:
where RD (x) =1 indicates that the pixel is an abnormal pixel, and RD (x) =0 indicates that the pixel position is not abnormal.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202310263730.XA CN116416442A (en) | 2023-03-12 | 2023-03-12 | Hyperspectral image abnormal target detection method based on CUDA acceleration |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202310263730.XA CN116416442A (en) | 2023-03-12 | 2023-03-12 | Hyperspectral image abnormal target detection method based on CUDA acceleration |
Publications (1)
Publication Number | Publication Date |
---|---|
CN116416442A true CN116416442A (en) | 2023-07-11 |
Family
ID=87058988
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN202310263730.XA Pending CN116416442A (en) | 2023-03-12 | 2023-03-12 | Hyperspectral image abnormal target detection method based on CUDA acceleration |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN116416442A (en) |
-
2023
- 2023-03-12 CN CN202310263730.XA patent/CN116416442A/en active Pending
Similar Documents
Publication | Publication Date | Title |
---|---|---|
CN109344618B (en) | Malicious code classification method based on deep forest | |
US8660360B1 (en) | System and method for reduced incremental spectral clustering | |
CN111028327A (en) | Three-dimensional point cloud processing method, device and equipment | |
CN109711442B (en) | Unsupervised layer-by-layer generation confrontation feature representation learning method | |
CN113420640A (en) | Mangrove hyperspectral image classification method and device, electronic equipment and storage medium | |
Liu et al. | Fast nearest neighbor searching based on improved VP-tree | |
Pichel et al. | A new approach for sparse matrix classification based on deep learning techniques | |
Lim et al. | Morphology for jet classification | |
CN111680579A (en) | Remote sensing image classification method for adaptive weight multi-view metric learning | |
Wan et al. | Mixed local channel attention for object detection | |
Hossam et al. | Accelerated hyperspectral image recursive hierarchical segmentation using GPUs, multicore CPUs, and hybrid CPU/GPU cluster | |
CN112967350B (en) | Hyperspectral remote sensing image eigen decomposition method and system based on sparse image coding | |
Yonehara et al. | A line-based connected component labeling algorithm using GPUs | |
CN110245706B (en) | Lightweight target detection method for embedded application | |
van Werkhoven et al. | A Jungle Computing approach to common image source identification in large collections of images | |
He et al. | Soma detection in 3D images of neurons using machine learning technique | |
Zhao et al. | Saliency map-aided generative adversarial network for raw to rgb mapping | |
CN104572588A (en) | Matrix inversion processing method and device | |
Backer et al. | Parallel k-means image segmentation using sort, scan and connected components on a GPU | |
CN116416442A (en) | Hyperspectral image abnormal target detection method based on CUDA acceleration | |
CN113947712A (en) | Hyperspectral anomaly detection method and system based on capsule differential countermeasure network | |
CN113506266A (en) | Method, device and equipment for detecting tongue greasy coating and storage medium | |
Morar et al. | GPU accelerated 2D and 3D image processing | |
Kanthi et al. | A 3D-Inception CNN for Hyperspectral Image Classification | |
CN108280461B (en) | Rapid global K-means clustering method accelerated by OpenCL |
Legal Events
Date | Code | Title | Description |
---|---|---|---|
PB01 | Publication | ||
PB01 | Publication | ||
SE01 | Entry into force of request for substantive examination | ||
SE01 | Entry into force of request for substantive examination |