Compression device, compression method, compression program, and system
The compression device addresses the memory requirement issue in feature matrix compression by performing singular value decomposition on partial matrices, allowing for efficient compression and reduced memory usage.
Patent Information
- Application Number
- PCT/JP2024/002718
- Authority / Receiving Office
- WO · WO
- Patent Type
- Applications
- Current Assignee / Owner
- Filing Date
- 2024-01-30
- Publication Date
- 2025-08-07
AI Technical Summary
Existing methods for compressing feature matrices using singular value decomposition require large-capacity memory due to the need to store the entire feature matrix, which is often large in size.
A compression device that performs singular value decomposition on partial feature matrices of an image, sequentially storing and processing these matrices to construct global singular value and right singular matrices, allowing for the compression of the feature matrix by storing only a portion in memory.
The method effectively compresses feature matrices by storing only a portion in memory, reducing the memory requirements and enabling efficient processing without the need for large-capacity memory.
Smart Images

Figure JP2024002718_07082025_PF_FP_ABST
Abstract
Description
Compression device, compression method, compression program and system
[0001] The present disclosure relates to a compression device, a compression method, a compression program, and a system.
[0002] There is a compression device that compresses a feature matrix that indicates the features of an image. For example, Patent Document 1 discloses a method for compressing a feature matrix by a processing device performing singular value decomposition (SVD) on the feature matrix.
[0003] JP 2014-10495 A
[0004] In the method disclosed in Patent Document 1, in order for a processing device to perform SVD on a feature matrix, the entire feature matrix needs to be stored in the memory of the processing device. The memory of the processing device is a work memory such as a RAM (Random Access Memory) for temporarily storing data, and is different from a storage device such as a hard disk for long-term storage of data. Since the data size of a feature matrix is generally large, the method disclosed in Patent Document 1 has a problem in that the processing device needs to be equipped with a large-capacity memory.
[0005] The present disclosure has been made to solve the above-mentioned problems, and aims to provide a compression device that can compress a feature matrix by simply storing a portion of the feature matrix in memory.
[0006] A compression device according to the present disclosure is configured to include: a matrix acquisition unit that sequentially acquires partial feature matrices for each of a plurality of partial images obtained by dividing an image; and a first global matrix calculation unit that performs singular value decomposition on a first partial feature matrix that is the first partial feature matrix acquired by the matrix acquisition unit, and calculates a first global singular value matrix that is the first global singular value matrix including singular values of the first partial feature matrix, and a first global right singular matrix that is the first global right singular matrix including right singular vectors corresponding to the singular values of the first partial feature matrix. The compression device also includes: a target matrix calculation unit that calculates a b-th target matrix that is the b-th matrix to be subjected to singular value decomposition, and that includes the b-th partial feature matrix that is the b-th (b is an integer equal to or greater than 2) partial feature matrix acquired by the matrix acquisition unit, the (b-1)th global singular value matrix, and the (b-1)th global right singular matrix; and a second global matrix calculation unit that performs singular value decomposition on the b-th target matrix calculated by the target matrix calculation unit, and calculates a singular value matrix of the b-th target matrix that includes the singular values of the b-th target matrix as the b-th global singular value matrix, and calculates a right singular matrix of the b-th target matrix that includes right singular vectors corresponding to the singular values of the b-th target matrix as the b-th global right singular matrix.
[0007] According to the present disclosure, the feature matrix can be compressed by simply storing a portion of the feature matrix in memory.
[0008] 1 is a configuration diagram showing a system including a compression device 101 according to a first embodiment. FIG. 2 is a hardware configuration diagram showing hardware of the compression device 101 according to the first embodiment. FIG. 3 is a hardware configuration diagram of a computer in the case where the compression device 101 is realized by software, firmware, or the like. FIG. 4 is an explanatory diagram showing a feature matrix after compression by the compression method disclosed in Patent Document 1. FIG. 5 is a flowchart showing a compression method, which is a processing procedure of the compression device 101. FIG. 6 is an explanatory diagram showing a plurality of partial images included in an image. FIG. 7 is an explanatory diagram showing a feature matrix after compression by the compression device 101 shown in FIG. 1. FIG. 8 is an explanatory diagram showing a feature matrix after compression by the compression device 101 shown in FIG. 1. FIG. 9 is a configuration diagram showing a system including another compression device 101 according to the first embodiment. FIG. 10 is a configuration diagram showing a system including the compression device 101 according to a second embodiment. FIG. 11 is a hardware configuration diagram showing hardware of the compression device 101 according to the second embodiment. b ' vector and the bth second left singular matrix U b 10 is an explanatory diagram showing the difference between the vector of " and the vector of ". It is a configuration diagram showing a system including the compression device 101 according to the third embodiment. It is a hardware configuration diagram showing the hardware of the compression device 101 according to the third embodiment. It is a configuration diagram showing a system including the compression device 101 according to the fourth embodiment. It is a hardware configuration diagram showing the hardware of the compression device 101 according to the fourth embodiment.
[0009] In order to explain the present disclosure in more detail, embodiments of the present disclosure will be described below with reference to the accompanying drawings.
[0010] Embodiment 1 Fig. 1 is a configuration diagram showing a system including a compression device 101 according to embodiment 1. Fig. 2 is a hardware configuration diagram showing the hardware of the compression device 101 according to embodiment 1. The system shown in Fig. 1 includes the compression device 101, a decompression device 102, and an inspection device 103.
[0011] The compression device 101 shown in Fig. 1 includes a matrix acquisition unit 1, a partial feature matrix storage unit 2, a first global matrix calculation unit 3, an object matrix calculation unit 4, a second global matrix calculation unit 5, a global matrix storage unit 6, a first singular matrix calculation unit 7, and a second singular matrix calculation unit 8. The compression device 101 is a device that compresses images. An example of an image to be compressed is an inspection image. The inspection image is an image that includes an object to be inspected.
[0012] The matrix acquisition unit 1 is realized by, for example, a matrix acquisition circuit 21 shown in Fig. 2. The matrix acquisition unit 1 receives from the outside a partial feature matrix X b (b=1, ..., B) are acquired in order, where B is an integer equal to or greater than 2. The image from which the multiple partial images are divided is, for example, an inspection image. The partial feature matrix X b is a matrix including the feature vectors of the respective partial images. The matrix acquisition unit 1 obtains the partial feature matrix X b Each time a partial feature matrix X b is stored in the partial feature matrix storage unit 2.
[0013] The partial feature matrix storage unit 2 is realized by, for example, the partial feature matrix storage circuit 22 shown in FIG. b (b=1, . . . , B) is stored. The partial feature matrix stored in the partial feature matrix storage unit 2 is X 1 ~X B Any one of the partial feature matrices X b is.
[0014] The first global matrix calculation unit 3 is realized by, for example, the first global matrix calculation circuit 23 shown in FIG. 2. The first global matrix calculation unit 3 calculates the partial feature matrix X 1 The first partial feature matrix X 1 is subjected to singular value decomposition (SVD) to obtain a first global singular value matrix S and a first global right singular matrix V T The first partial feature matrix X 1is one or more singular values s 1 ~s K where K is an integer equal to or greater than 1. The first global singular value matrix S is a matrix including the first partial feature matrix X 1 The singular value s of 1 ~s K The first global right singular matrix V T is the first partial feature matrix X 1 The singular value s of k (k=1,...,K) k The first global matrix calculation unit 3 calculates the first global singular value matrix S and the first global right singular matrix V T and are stored in the global matrix storage unit 6.
[0015] In the compression device 101 shown in FIG. 1, the first partial feature matrix X 1 is subjected to SVD by the first singular matrix calculation unit 7. However, this is only an example. The first global matrix calculation unit 3 calculates the first partial feature matrix X 1 and obtain the first partial feature matrix X 1 SVD is performed to obtain the first global singular value matrix S and the first global right singular matrix V T It may be possible to calculate the following.
[0016] The target matrix calculation unit 4 is realized by, for example, the target matrix calculation circuit 24 shown in Fig. 2. The target matrix calculation unit 4 calculates the partial feature matrix X b Hereinafter, the b-th acquired partial feature matrix X b The bth partial feature matrix X b The target matrix calculation unit 4 receives from the global matrix storage unit 6 the (b-1)th global singular value matrix S, which is the (b-1)th global singular value matrix, and the (b-1)th global right singular matrix V T The (b-1)th global right singular matrix V T The target matrix calculation unit 4 obtains the b-th partial feature matrix X b, the (b-1)th global singular value matrix S, and the (b-1)th global right singular matrix V T The b-th target matrix W b The b-th object matrix W b is the b-th target matrix for singular value decomposition. b is output to the second global matrix calculation unit 5.
[0017] The second global matrix calculation unit 5 is realized by, for example, the second global matrix calculation circuit 25 shown in FIG. 2. The second global matrix calculation unit 5 receives the b-th target matrix W b (b=2, . . . , B). The second global matrix calculation unit 5 obtains the b-th target matrix W b SVD is performed to obtain the b-th global singular value matrix S and the b-th global right singular matrix V T The b-th global singular value matrix S is calculated by the b-th target matrix W b The b-th target matrix W b The b-th target matrix W b The singular values of the stacked matrix X 1-b Therefore, the b-th target matrix W b is the stacked matrix X 1-b The matrix is approximately equal to the stacked matrix X 1-b is the partial feature matrix X obtained from the first to bth sub-matrices by the matrix obtaining unit 1. 1 ~X b are virtual matrices stacked on top of each other. The bth global right singular matrix V T is the b-th target matrix W b The right singular vectors v corresponding to the singular values of k The second global matrix calculation unit 5 calculates the b-th global singular value matrix S and the b-th global right singular matrix V T and are stored in the global matrix storage unit 6.
[0018] The global matrix storage unit 6 is realized by, for example, the global matrix storage circuit 26 shown in Fig. 2. The global matrix storage unit 6 stores the first global singular value matrix S output from the first global matrix calculation unit 3 or the b-th global singular value matrix S output from the second global matrix calculation unit 5. The global matrix storage unit 6 stores the first global right singular matrix V output from the first global matrix calculation unit 3. T , or the b-th global right singular matrix V output from the second global matrix calculation unit 5 T The first global singular value matrix S or the b-th global singular value matrix S stored in the global matrix storage unit 6 is updated to the newly output b-th global singular value matrix S every time the b-th global singular value matrix S is output from the second global matrix calculation unit 5. Therefore, only the latest b-th global singular value matrix S is stored in the global matrix storage unit 6. In addition, the first global right singular value matrix V stored in the global matrix storage unit 6 is updated to the newly output b-th global singular value matrix S every time the b-th global singular value matrix S is output from the second global matrix calculation unit 5. T , or the bth global right singular matrix V T is the b-th global right singular matrix V T Each time a new b-th global right singular matrix V is output, T Therefore, the global matrix storage unit 6 stores the latest b-th global right singular matrix V T Only the value is stored.
[0019] The first singular matrix calculation unit 7 is realized by, for example, the first singular matrix calculation circuit 27 shown in Fig. 2. The first singular matrix calculation unit 7 calculates the b-th partial feature matrix X b The first singular matrix calculation unit 7 obtains the b-th partial feature matrix X b SVD is performed to obtain the b-th first singular value matrix S b ' and the bth first left singular matrix U b ' and the bth first right singular matrix V b ' T The b-th first singular value matrix S b ' is the bth partial feature matrix Xb The singular value s of 1 ~s K The bth first left singular matrix U b ' is the bth partial feature matrix X b The singular value s of k (k=1, . . . , K) k The bth first right singular matrix V b ' T is the b-th partial feature matrix X b The singular value s of k The right singular vector v corresponding to k The first singular matrix calculation unit 7 calculates the b-th first singular value matrix S b ' and the bth first left singular matrix U b ' and the bth first right singular matrix V b ' T and are output to the second singular matrix calculation unit 8.
[0020] The second singular matrix calculation unit 8 is realized by, for example, the second singular matrix calculation circuit 28 shown in Fig. 2. The second singular matrix calculation unit 8 receives the b-th global singular value matrix S and the b-th global right singular matrix V from the global matrix storage unit 6. T The second singular matrix calculation unit 8 obtains the b-th first singular value matrix S b ' and the bth first left singular matrix U b ' and the bth first right singular matrix V b ' T The second singular matrix calculation unit 8 obtains the b-th global singular value matrix S and the b-th global right singular matrix V T and the bth first singular value matrix S b ' and the bth first left singular matrix U b ' and the bth first right singular matrix V b ' T From this, the b-th symmetric matrix W b The left singular vector u corresponding to the singular value of k The b-th second left singular matrix U b The second singular matrix calculation unit 8 calculates the b-th second left singular matrix Ub " and the bth global singular value matrix S and the bth global right singular matrix V T and are output to the restoration device 102.
[0021] The decompression device 102 receives the b-th second left singular matrix U from the second singular matrix calculation unit 8 of the compression device 101. b " and the bth global singular value matrix S and the bth global right singular matrix V T The restoration device 102 obtains the b-th second left singular matrix U b " and the bth global singular value matrix S and the bth global right singular matrix V T The restoration device 102 restores the original image from which the plurality of partial images were divided based on the above. The restoration device 102 outputs the restored image to the inspection device 103.
[0022] The inspection device 103 acquires the restored image from the restoration device 102. The inspection device 103 inspects the object included in the restored image based on the restored image.
[0023] 1, it is assumed that each of the components of the compression device 101, namely, the matrix acquisition unit 1, the partial feature matrix storage unit 2, the first global matrix calculation unit 3, the target matrix calculation unit 4, the second global matrix calculation unit 5, the global matrix storage unit 6, the first singular matrix calculation unit 7, and the second singular matrix calculation unit 8, is realized by dedicated hardware such as that shown in Fig. 2. In other words, it is assumed that the compression device 101 is realized by a matrix acquisition circuit 21, a partial feature matrix storage circuit 22, a first global matrix calculation circuit 23, a target matrix calculation circuit 24, a second global matrix calculation circuit 25, a global matrix storage circuit 26, a first singular matrix calculation circuit 27, and a second singular matrix calculation circuit 28.
[0024] Here, each of the partial feature matrix storage circuit 22 and the global matrix storage circuit 26 is realized by, for example, a RAM (Random Access Memory) or a flash memory. Each of the matrix acquisition circuit 21, the first global matrix calculation circuit 23, the target matrix calculation circuit 24, the second global matrix calculation circuit 25, the first singular matrix calculation circuit 27, and the second singular matrix calculation circuit 28 is, for example, a single circuit, a composite circuit, a programmed processor, a parallel programmed processor, an ASIC (Application Specific Integrated Circuit), an FPGA (Field-Programmable Gate Array), or a combination thereof.
[0025] The components of the compression device 101 are not limited to those realized by dedicated hardware, and the compression device 101 may be realized by software, firmware, or a combination of software and firmware. The software or firmware is stored as a program in the memory of a computer. The computer refers to hardware that executes a program, and includes, for example, a CPU (Central Processing Unit), a GPU (Graphics Processing Unit), a central processing unit, a processing unit, an arithmetic unit, a microprocessor, a microcomputer, a processor, or a DSP (Digital Signal Processor).
[0026] 3 is a hardware configuration diagram of a computer when the compression device 101 is realized by software, firmware, or the like. When the compression device 101 is realized by software, firmware, or the like, the partial feature matrix storage unit 2 and the global matrix storage unit 6 are each configured on a memory 41 of the computer. A compression program is stored in the memory 41 to cause the computer to execute the respective processing procedures of the matrix acquisition unit 1, the first global matrix calculation unit 3, the target matrix calculation unit 4, the second global matrix calculation unit 5, the first singular matrix calculation unit 7, and the second singular matrix calculation unit 8. A processor 42 of the computer then executes the compression program stored in the memory 41.
[0027] 2 shows an example in which each of the components of the compression device 101 is realized by dedicated hardware, while Fig. 3 shows an example in which the compression device 101 is realized by software, firmware, etc. However, this is merely an example, and some of the components in the compression device 101 may be realized by dedicated hardware, and the remaining components may be realized by software, firmware, etc.
[0028] FIG. 4 is an explanatory diagram showing a feature matrix after compression by the compression method disclosed in Patent Document 1. In the feature matrix compression method disclosed in Patent Document 1, first, a processing device (not shown) externally acquires a feature matrix X indicating the features of an image including an object, and stores the feature matrix X in a memory (not shown). In the example of FIG. 4, the data size of the feature matrix X is M×N, where M<N. Both M and N are integers equal to or greater than 2. The feature matrix X is obtained by compressing N feature vectors n 1 ~n N The processing device compresses the feature matrix X by subjecting the feature matrix X to SVD. Specifically, as shown in FIG. 4 , the processing device compresses the feature matrix X by subjecting the feature matrix X to SVD to reduce one or more singular values s 1 ~s K and the singular value matrix S containing the singular values s k (k=1,...,M) kThe left singular matrix U contains the singular values s k The right singular vector v corresponding to k A right singular matrix V T where K is an integer equal to or greater than 1, and K<<M. The data size of the singular value matrix S is K×K, the data size of the left singular matrix U is K×N, and the data size of the right singular matrix V T The data size is M×K.
[0029] Next, the operation of the compression device 101 shown in FIG. 1 will be described. FIG. 5 is a flowchart showing a compression method, which is a processing procedure of the compression device 101. In the compression device 101 shown in FIG. 1, an image is assumed to be divided into multiple partial images as shown in FIG. 6. FIG. 6 is an explanatory diagram showing multiple partial images included in an image. FIG. 6 shows an example in which the image is divided into 16 partial images, and the 16 partial images are of the same size. However, this is merely an example, and the number of divided images is not limited to 16. Furthermore, the size of the multiple divided images is not limited to the same size. In the compression device 101 shown in FIG. 1, for convenience of explanation, it is assumed that the number of partial images is B, where B is an integer greater than or equal to 2. FIGS. 7 and 8 are explanatory diagrams each showing a feature matrix after compression by the compression device 101 shown in FIG. 1.
[0030] The matrix acquisition unit 1 receives from the outside a partial feature matrix X b (b=1, . . . , B) in order (step ST1 in FIG. 5). b Each time a partial feature matrix X b is stored in the partial feature matrix storage unit 2. The partial feature matrix stored in the partial feature matrix storage unit 2 is X 1 ~X B Any one of the partial feature matrices X b The partial feature matrix X b The data size of is 1 / B of the data size of the feature matrix X.
[0031] In the compression device shown in FIG. 1, a matrix acquisition unit 1 acquires a partial feature matrix X b(b=1, . . . , B) are acquired in order. However, this is only an example. The matrix acquisition unit 1 acquires each partial image and obtains the partial feature matrix X b The partial feature matrix X b The calculation method is not particularly limited, but for example, a method is to provide a partial image to a convolutional neural network (CNN) and acquire a feature vector of the partial image from the CNN. The CNN is a learning model that has already learned the feature vector of an image.
[0032] The first singular matrix calculation unit 7 calculates the first partial feature matrix X , which is the partial feature matrix first acquired by the matrix acquisition unit 1, from the partial feature matrix storage unit 2. 1 The first singular matrix calculation unit 7 obtains the first partial feature matrix X as shown in FIG. 1 (Step ST2 in FIG. 5). Specifically, the first singular matrix calculation unit 7 calculates the first partial feature matrix X as shown in the following equation (1): 1 The SVD result is output to the first global matrix calculation unit 3. 1 ~U 1 'S 1 'V 1 ' T (1) In equation (1), "~" is a mathematical symbol indicating truncated SVD. The truncated SVD is a type of SVD, and the first partial feature matrix X 1 The M singular values s 1 ~s M Among them, the top singular value s 1 ~s K The method is to calculate only the singular values s and discard the remaining singular values. 1 ~s K is a singular value relating to an important feature of an image among a plurality of features in the image.
[0033] The first global matrix calculation unit 3 obtains the result of SVD from the first singular matrix calculation unit 7. Based on the result of SVD, the first global matrix calculation unit 3 calculates the first singular value matrix S 1' is calculated as the first global singular value matrix S, and the first right singular matrix V 1 ' T is the first global right singular matrix V T (Step ST3 in FIG. 5). The first singular value matrix S 1 ' is the first partial feature matrix X 1 The M singular values s 1 ~s M Among them, the top K singular values s 1 ~s K The first right singular matrix V 1 ' T is the first partial feature matrix X 1 The singular value s k (k=1,...,K) k Hereinafter, the one or more singular values included in the first global singular value matrix S are denoted as s 1 ~s K The first global matrix calculation unit 3 calculates the first partial feature matrix X 1 The singular value s k (k=1, . . . , K) k The first left singular matrix U 1 ' is not calculated.
[0034] The first global matrix calculation unit 3 stores the first global singular value matrix S in the global matrix storage unit 6. The first global matrix calculation unit 3 stores the first global right singular matrix V T is stored in the global matrix storage unit 6.
[0035] The target matrix calculation unit 4 calculates the b-th partial feature matrix X , which is the b-th (b=2, . . . , B)-th partial feature matrix acquired by the matrix acquisition unit 1, from the partial feature matrix storage unit 2. b The target matrix calculation unit 4 obtains the previously calculated global singular value matrix S from the global matrix storage unit 6. Specifically, the target matrix calculation unit 4 obtains the second partial feature matrix X obtained secondly by the matrix obtaining unit 1 from the partial feature matrix storage unit 2. 2When the matrix acquisition unit 1 acquires the first global singular value matrix S calculated by the first global matrix calculation unit 3 from the global matrix storage unit 6, the target matrix calculation unit 4 acquires the b-th (b=3, ..., B)-th partial feature matrix X calculated by the matrix acquisition unit 1 from the partial feature matrix storage unit 2. b When the (b-1)th global singular value matrix S calculated by the second global matrix calculation unit 5 is acquired, the (b-1)th global singular value matrix S is acquired from the global matrix storage unit 6. The (b-1)th global singular value matrix S is calculated by the partial feature matrix X 1 ~X b-1 are stacked matrices X 1-(b-1) A singular value s that is approximately equal to the singular values included in 1 ~s K is a matrix containing
[0036] The target matrix calculation unit 4 calculates the b-th partial feature matrix X b , the (b-1)th global singular value matrix S, and the (b-1)th global right singular matrix V T The b-th target matrix W is the b-th target matrix of the singular value decomposition, b is calculated (step ST4 in FIG. 5). b = [V T S, X b T ] = [V T diag(s 1 ...s K ), X b T ] (2) In equation (2), diag is a mathematical symbol indicating that the (b-1)th global singular value matrix S is a diagonal matrix. T is a mathematical symbol indicating transposition. The target matrix calculation unit 4 calculates the bth target matrix W b is output to the second global matrix calculation unit 5.
[0037] The second global matrix calculation unit 5 receives the b-th symmetric matrix W from the symmetric matrix calculation unit 4. b (b=2, . . . , B). The second global matrix calculation unit 5 obtains the b-th object matrix W b(Step ST5 in FIG. 5). Specifically, the second global matrix calculation unit 5 calculates the b-th object matrix W b is truncated and subjected to SVD to obtain the b-th global singular value matrix S and the b-th global right singular matrix V T (Step ST6 in FIG. 5). b ~V S U T (3)
[0038] In the truncated SVD by the second global matrix calculation unit 5, the second global matrix calculation unit 5 calculates the b-th global singular value matrix S and the b-th global right singular matrix V T However, the global left singular matrix U is not calculated. b is the b-th partial feature matrix X b In addition, the (b-1)th global singular value matrix S and the (b-1)th global right singular matrix V T Therefore, the b-th target matrix W b As shown in FIG. 8, the truncated SVD is performed to obtain the partial feature matrix X 1 ~X b A stacked matrix X is a matrix in which all of the 1-b Therefore, the b-th global singular value matrix S is equivalent to performing SVD by truncating the stacked matrix X 1-b A singular value s that is approximately equal to one or more singular values contained in 1 ~s K Furthermore, the bth global right singular matrix V T is the stacked matrix X 1-b The singular values s k (k=1,...,K) k is a matrix containing
[0039] The second global matrix calculation unit 5 calculates the b-th global singular value matrix S and the b-th global right singular matrix V Tand are overwritten and saved in the global matrix storage unit 6. As a result, the (b-1)th global singular value matrix S previously stored in the global matrix storage unit 6 is updated to the bth global singular value matrix S output from the second global matrix calculation unit 5, so that only the bth global singular value matrix S, which is the latest global singular value matrix S, is stored in the global matrix storage unit 6. In addition, the (b-1)th global right singular value matrix V previously stored in the global matrix storage unit 6 is updated to the bth global singular value matrix S output from the second global matrix calculation unit 5. T is the b-th global right singular matrix V output from the second global matrix calculation unit 5. T Therefore, the latest global right singular matrix V T The bth global right singular matrix V T is stored in the global matrix storage unit 6.
[0040] As described above, the first singular matrix calculation unit 7 calculates the first partial feature matrix X 1 The first singular matrix calculation unit 7 obtains the first partial feature matrix X as shown in FIG. 1 Specifically, the first singular matrix calculation unit 7 calculates the first partial feature matrix X 1 is truncated and SVD is performed to obtain the first singular value matrix S 1 ' and the first left singular matrix U 1 ' and the first right singular matrix V 1 ' T The first left singular matrix U 1 ' is the first partial feature matrix X 1 The M singular values s 1 ~s M Among them, the top K singular values s k (k=1, . . . , K) k is a matrix containing
[0041] The first singular matrix calculation unit 7 calculates the b-th partial feature matrix X bThe first singular matrix calculation unit 7 obtains the b-th partial feature matrix X b (Step ST7 in FIG. 5). Specifically, the first singular matrix calculation unit 7 calculates the b-th partial feature matrix X b By performing SVD on the b-th singular value matrix S b ' and the bth first left singular matrix U b ' and the bth first right singular matrix V b ' T (Step ST8 in FIG. 5). The b-th first singular value matrix S b ' is the bth partial feature matrix X b The M singular values s 1 ~s M Among them, the top K singular values s 1 ~s K The bth first left singular matrix U b ' is the bth partial feature matrix X b The singular value s k (k=1, . . . , K) k The bth first right singular matrix V b ' T is the b-th partial feature matrix X b The singular value s k The right singular vector v corresponding to 1 ~v K is a matrix containing b ~U b 'S b 'V b ' T (4) The first singular matrix calculation unit 7 calculates the b (b=1, . . . , B)-th first singular value matrix S b ' and the bth first left singular matrix U b ' and the bth first right singular matrix V b ' T and are output to the second singular matrix calculation unit 8.
[0042] The second singular matrix calculation unit 8 receives the b-th global singular value matrix S, which is the b-th (b=1, . . . , B)-th global singular value matrix S, and the b-th global right singular matrix V TThe bth global right singular matrix V T The second singular matrix calculation unit 8 obtains the b-th first singular value matrix S b ' and the bth first left singular matrix U b ' and the bth first right singular matrix V b ' T The second singular matrix calculation unit 8 obtains the b-th global singular value matrix S and the b-th global right singular matrix V based on the following equation (5): T and the bth first singular value matrix S b ' and the bth first left singular matrix U b ' and the bth first right singular matrix V b ' T From this, the bth second left singular matrix U b " is calculated (step ST9 in FIG. 5). The b-th second left singular matrix U b " is the b-th partial feature matrix X b The singular value s k (k=1, . . . , K) k is a matrix containing b "S.V. T =U b 'S b 'V b ' T (5) The second singular matrix calculation unit 8 calculates the b-th second left singular matrix U b ", the bth global singular value matrix S, and the bth global right singular matrix V T and are output to the restoration device 102.
[0043] Hereinafter, the b-th second left singular matrix U b First, the second singular matrix calculation unit 8 multiplies both sides of equation (5) by V as shown in the following equation (6). U b "S.V. T V=U b 'S b 'V b ' T V ↓ U b "S=U b 'S b 'V b' T V (6) Next, the second singular matrix calculation unit 8 calculates the inverse matrix S of the b-th global singular value matrix S as shown in the following equation (7): -1 Calculate S = diag(s 1 ...s K ) ↓ S -1 = diag(1 / s 1 ...1 / s K ) (7) Next, the second singular matrix calculation unit 8 applies the inverse matrix S -1 b-th second left singular matrix U b " is calculated. U b "S.S. -1 =U b 'S b 'V b ' T V.S. -1 ↓ U b "=U b 'S b 'V b ' T V.S. -1 (8)
[0044] The decompression device 102 receives the b-th second left singular matrix U from the second singular matrix calculation unit 8 of the compression device 101. b " and the bth global singular value matrix S and the bth global right singular matrix V T The restoration device 102 obtains the b-th second left singular matrix U b " and the bth global singular value matrix S and the bth global right singular matrix V T Specifically, the restoration device 102 restores the original image from which the multiple partial images were divided based on the b-th second left singular matrix U b " and the bth global singular value matrix S and the bth global right singular matrix V T Substituting into equation (5), U b 'S b 'V b ' T That is, the restoration device 102 calculates the b-th partial feature matrix X b As U b 'S b 'Vb ' T The restoration device 102 calculates the b-th partial feature matrix X 1 ~X B When the calculation of the b-th partial feature matrix X 1 ~X B The restoration of the feature matrix X of the test image corresponds to the restoration of the test image. Here, when restoring the test image, the restoration device 102 restores the b-th partial feature matrix X b It is assumed that the position of the partial image corresponding to (b=1, . . . , B) in the test image is known in advance. b It is assumed that the order of obtaining the b-th partial feature matrix X b If partial feature matrix information is acquired from an external source when acquiring the b-th partial feature matrix X, the decompression device 102 acquires the partial feature matrix information from the compression device 101. The partial feature matrix information may include, for example, the b-th partial feature matrix X b and the b-th partial feature matrix X b and the b-th partial feature matrix X b The restoration device 102 restores the b-th partial feature matrix X b Calculate the b-th partial feature matrix X 1 ~X B When the calculation of is completed, the b-th partial feature matrix X 1 ~X B The restoration device 102 restores the feature matrix X of the test image, which includes:
[0045] The inspection device 103 acquires the feature matrix X of the test image from the restoration device 102 as the restored image. The inspection device 103 inspects the object included in the test image based on the feature matrix X. The process of inspecting the object included in the test image based on the feature matrix X is a well-known technique, so the process of inspecting the object will be briefly described here. The inspection device 103 stores one or more feature vectors included in the feature matrix of a normal object. If the inspection device 103 does not store such feature vectors, it may acquire the feature vectors from an external source, for example. The inspection device 103 calculates differences between one or more feature vectors included in the feature matrix of the normal object and one or more feature vectors included in the feature matrix X. If all of the calculated differences are within a threshold, the inspection device 103 determines that the object included in the test image is normal. The threshold may be stored in the internal memory of the inspection device 103 or may be provided externally. If one or more of the calculated differences is equal to or greater than a threshold, the inspection device 103 determines that the object included in the inspection image is abnormal.
[0046] In the first embodiment described above, the compression device 101 is configured to include: a matrix acquisition unit 1 that sequentially acquires partial feature matrices for each of a plurality of partial images obtained by dividing an image; and a first global matrix calculation unit 3 that performs singular value decomposition on a first partial feature matrix that is the first partial feature matrix acquired by the matrix acquisition unit 1, and calculates a first global singular value matrix that is the first global singular value matrix including singular values of the first partial feature matrix, and a first global right singular matrix that is the first global right singular matrix including right singular vectors corresponding to the singular values of the first partial feature matrix. The compression device 101 also includes: a target matrix calculation unit 4 that calculates a b-th target matrix that is the b-th matrix to be subjected to singular value decomposition, the b-th target matrix including the b-th partial feature matrix that is the b-th (b is an integer equal to or greater than 2) partial feature matrix acquired by the matrix acquisition unit 1, the (b-1)th global singular value matrix, and the (b-1)th global right singular matrix; and a second global matrix calculation unit 5 that performs singular value decomposition on the b-th target matrix calculated by the target matrix calculation unit 4, and calculates a singular value matrix of the b-th target matrix that includes the singular values of the b-th target matrix as the b-th global singular value matrix, and calculates a right singular matrix of the b-th target matrix that includes right singular vectors corresponding to the singular values of the b-th target matrix as the b-th global right singular matrix. Thus, the compression device 101 can compress a feature matrix simply by storing a part of the feature matrix in memory.
[0047] The compression device 101 also includes a first singular matrix calculation unit 7 that performs singular value decomposition on the b-th partial feature matrix acquired by the matrix acquisition unit 1 for the b-th time, and calculates a b-th first singular value matrix including singular values of the b-th partial feature matrix, a b-th first left singular matrix including left singular vectors corresponding to the singular values of the b-th partial feature matrix, and a b-th first right singular matrix including right singular vectors corresponding to the singular values of the b-th partial feature matrix; and a second singular matrix computation unit 8 that computes a b-th second left singular matrix including left singular vectors corresponding to the singular values of the b-th target matrix, from the b-th global right singular value matrix computed by the second global matrix computation unit 5, the b-th first singular value matrix computed by the first singular matrix computation unit 7, the b-th first left singular matrix computed by the first singular matrix computation unit 7, and the b-th first right singular matrix computed by the first singular matrix computation unit 7. Therefore, the compression device can compress the feature matrix by simply storing a part of the feature matrix in a memory.
[0048] In the compression device shown in FIG. 1 , each of the second global matrix calculation unit 5 and the first singular matrix calculation unit 7 performs truncated SVD on a matrix. As long as the matrix can be compressed, the SVD is not limited to truncated SVD, and each of the second global matrix calculation unit 5 and the first singular matrix calculation unit 7 may perform, for example, economy SVD on a matrix. In addition, one type of SVD is incremented SVD. Even when incremented SVD is performed, the matrix can be compressed. That is, when the partial feature matrix X b The second left singular matrix U b However, as the value of b increases and approaches the value of B, the second left singular matrix U b The number of left singular vectors contained in " increases, and the second left singular matrix U b Therefore, as the value of b increases and approaches the value of B, the processing time of the incremental SVD increases. bBy performing SVD on the b-th global singular value matrix S and the b-th global right singular matrix V T and calculate the b-th target matrix W b Therefore, even if the value of b increases and approaches the value of B, the SVD processing time does not increase, as in the incremental SVD.
[0049] The compression device 101 shown in FIG. 1 includes a matrix acquisition unit 1, a partial feature matrix storage unit 2, a first global matrix calculation unit 3, a target matrix calculation unit 4, a second global matrix calculation unit 5, a global matrix storage unit 6, a first singular matrix calculation unit 7, and a second singular matrix calculation unit 8. However, this is merely an example, and the compression device 101 may include, for example, the matrix acquisition unit 1, the partial feature matrix storage unit 2, the first global matrix calculation unit 3, the target matrix calculation unit 4, the second global matrix calculation unit 5, and the global matrix storage unit 6, and each of the first singular matrix calculation unit 7 and the second singular matrix calculation unit 8 may be provided outside the compression device 101. An example of the outside of the compression device 101 is a cloud. When each of the first singular matrix calculation unit 7 and the second singular matrix calculation unit 8 is provided in the cloud, for example, the compression device 101 calculates the b-th partial feature matrix X stored in the partial feature matrix storage unit 2. b (b=2, . . . , B), and the b-th global singular value matrix S and the b-th global right singular matrix V stored in the global matrix storage unit 6. T The first singular matrix calculation unit 7 provided in the cloud then calculates the b-th first singular value matrix S b ' and the bth first left singular matrix U b ' and the bth first right singular matrix V b ' T and the second singular matrix calculation unit 8 provided in the cloud calculates the b-th second left singular matrix U b The compression device 101 calculates the b-th second left singular matrix U from the second singular matrix calculation unit 8 provided in the cloud. b", the bth global singular value matrix S, and the bth global right singular matrix V T Then, the compression device 101 obtains the b-th second left singular matrix U b ", the bth global singular value matrix S, and the bth global right singular matrix V T and outputs the result to the decompression device 102. In a compression device in which the first singular matrix calculation unit 7 and the second singular matrix calculation unit 8 are provided outside the compression device 101, the processing load is reduced compared to the compression device 101 shown in FIG.
[0050] In the compression device 101 shown in FIG. 1, the second singular matrix calculation unit 8 calculates the b-th second left singular matrix U b ", the bth global singular value matrix S, and the bth global right singular matrix V T However, this is merely an example, and the compression device 101 outputs the b-th second left singular matrix U b ", the b-th global singular value matrix S calculated by the second global matrix calculation unit 5, and the b-th global right singular matrix V calculated by the second global matrix calculation unit 5. T 9 is a configuration diagram showing a system including another compression device 101 according to the first embodiment. In this case, when restoring an original image from which a plurality of partial images are divided, the restoration device 102 stores the b-th second left singular matrix U b ", the bth global singular value matrix S, and the bth global right singular matrix V T and get.
[0051] In the second embodiment, the second singular matrix calculation unit 9 calculates the b-th first left singular matrix U b The bth rotation matrix R that rotates ' b and obtain the bth rotation matrix R b and the bth first left singular matrix U b ' and the bth second left singular matrix U b The compression device 101 that calculates " will be described.
[0052] FIG. 10 is a configuration diagram showing a system including a compression device 101 according to a second embodiment. In FIG. 10, the same reference numerals as those in FIGS. 1 and 9 indicate the same or corresponding parts, and therefore detailed description thereof will be omitted. FIG. 11 is a hardware configuration diagram showing hardware of the compression device 101 according to the second embodiment. In FIG. 11, the same reference numerals as those in FIG. 2 indicate the same or corresponding parts, and therefore detailed description thereof will be omitted. The compression device 101 shown in FIG. 10 includes a matrix acquisition unit 1, a partial feature matrix storage unit 2, a first global matrix calculation unit 3, a target matrix calculation unit 4, a second global matrix calculation unit 5, a global matrix storage unit 6, a first singular matrix calculation unit 7, and a second singular matrix calculation unit 9. However, this is merely an example, and the compression device 101 may include, for example, a matrix acquisition unit 1, a partial feature matrix storage unit 2, a first global matrix calculation unit 3, a target matrix calculation unit 4, a second global matrix calculation unit 5, and a global matrix storage unit 6, and each of the first singular matrix calculation unit 7 and the second singular matrix calculation unit 9 may be provided outside the compression device 101. An example of the outside of the compression device 101 is a cloud.
[0053] The second singular matrix calculation unit 9 is realized by, for example, a second singular matrix calculation circuit 29 shown in Fig. 11. The second singular matrix calculation unit 9 receives the b (b = 1, ..., B)-th first left singular matrix U b ' is acquired, and the b-th rotation matrix R b Obtain the rotation matrix R b is the b-th global singular value matrix S and the b-th global right singular matrix V T and the bth first singular value matrix S b ' and the bth first right singular matrix V b ' T The second singular matrix calculation unit 9 calculates the b-th rotation matrix R b and the bth first left singular matrix U b ' and the bth second left singular matrix U b " is calculated. The bth second left singular matrix U b " is the b-th object matrix W b The singular value s k The left singular vector u corresponding tok The second singular matrix calculation unit 9 calculates the b-th second left singular matrix U b " and the bth global singular value matrix S and the bth global right singular matrix V T and are output to the restoration device 102.
[0054] 10, it is assumed that each of the components of the compression device 101, namely, the matrix acquisition unit 1, the partial feature matrix storage unit 2, the first global matrix calculation unit 3, the target matrix calculation unit 4, the second global matrix calculation unit 5, the global matrix storage unit 6, the first singular matrix calculation unit 7, and the second singular matrix calculation unit 9, is realized by dedicated hardware such as that shown in Fig. 11. In other words, it is assumed that the compression device 101 is realized by a matrix acquisition circuit 21, a partial feature matrix storage circuit 22, a first global matrix calculation circuit 23, a target matrix calculation circuit 24, a second global matrix calculation circuit 25, a global matrix storage circuit 26, a first singular matrix calculation circuit 27, and a second singular matrix calculation circuit 29. Each of the matrix acquisition circuit 21, the first global matrix calculation circuit 23, the target matrix calculation circuit 24, the second global matrix calculation circuit 25, the first singular matrix calculation circuit 27, and the second singular matrix calculation circuit 29 corresponds to, for example, a single circuit, a composite circuit, a programmed processor, a parallel programmed processor, an ASIC, an FPGA, or a combination thereof.
[0055] The components of the compression device 101 are not limited to those realized by dedicated hardware, and the compression device 101 may be realized by software, firmware, or a combination of software and firmware. When the compression device 101 is realized by software, firmware, or the like, the partial feature matrix storage unit 2 and the global matrix storage unit 6 are each configured on a memory 41 shown in FIG. 3 of a computer. A compression program for causing a computer to execute the respective processing procedures of the matrix acquisition unit 1, the first global matrix calculation unit 3, the target matrix calculation unit 4, the second global matrix calculation unit 5, the first singular matrix calculation unit 7, and the second singular matrix calculation unit 9 is stored in the memory 41. Then, a processor 42 shown in FIG. 3 executes the compression program stored in the memory 41.
[0056] 11 shows an example in which each of the components of the compression device 101 is realized by dedicated hardware, while Fig. 3 shows an example in which the compression device 101 is realized by software, firmware, etc. However, this is merely an example, and some of the components in the compression device 101 may be realized by dedicated hardware, and the remaining components may be realized by software, firmware, etc.
[0057] Next, the operation of the compression device 101 shown in Fig. 10 will be described. However, apart from the second singular matrix calculation unit 9, the compression device 101 is the same as the compression device 101 shown in Fig. 1. Therefore, the operation of the second singular matrix calculation unit 9 will mainly be described here.
[0058] The b (b=1, . . . , B)-th first left singular matrix U b ' vector and the bth second left singular matrix U b As shown in FIG. 12, there is a difference between the vectors of " and ", and the difference is the b-th rotation matrix R b Therefore, the bth first left singular matrix U b ' is the bth rotation matrix R b By rotating by b ' is the bth second left singular matrix U b12 shows the first left singular matrix U b ' vector and the bth second left singular matrix U b 10 is an explanatory diagram showing the difference between the vectors of
[0059] The first singular matrix calculation unit 7 calculates the b-th first singular value matrix S b ' and the calculated b-th first right singular matrix V b ' T The second singular matrix calculation unit 9 outputs the b-th global singular value matrix S and the b-th global right singular matrix V stored in the global matrix storage unit 6 to a processing device (not shown). The processing device (not shown) is provided in, for example, a cloud. T The processing device (not shown) outputs the b-th global singular value matrix S and the b-th global right singular matrix V as shown in the following equation (9): T and the bth first singular value matrix S b ' and the bth first right singular matrix V b ' T From this, the bth first left singular matrix U b The bth rotation matrix R that rotates ' b Calculate the rotation matrix R b The data size of R is K×K. b = S b 'V b ' T V T S -1 = diag(s 1 ...s K ) V b ' T V T diag (1 / s 1 ...1 / s K ) (9) A processing device (not shown) calculates the b-th rotation matrix R b is output to the second singular matrix calculation unit 9.
[0060] The second singular matrix calculation unit 9 receives the b-th first left singular matrix U b ' is acquired, and the b-th rotation matrix R bThe second singular matrix calculation unit 9 obtains the rotation matrix R as shown in the following equation (10). b and the first left singular matrix U b ' and the bth second left singular matrix U b " is calculated. U b "=U b 'R b (10) Rotation matrix R b Since the data size of the second singular matrix U is small, the second singular matrix calculation unit 9 calculates the second left singular matrix U b The processing load for calculating " is the processing load for calculating the second left singular matrix U" by the second singular matrix calculation unit 8 shown in FIG. b The processing load is smaller than that of calculating "
[0061] In the second embodiment described above, the compression device 101 shown in FIG. 10 is configured so that the second singular matrix calculation unit 9 acquires the b-th first left singular matrix calculated by the first singular matrix calculation unit 7 and the b-th rotation matrix that rotates the b-th first left singular matrix, and calculates the b-th second left singular matrix including left singular vectors corresponding to the singular values of the b-th target matrix from the b-th rotation matrix and the b-th first left singular matrix. Therefore, similar to the compression device 101 shown in FIG. 1, the compression device 101 shown in FIG. 10 can compress a feature matrix by simply storing a part of the feature matrix in a memory, and can also compress the second left singular matrix U b This reduces the processing load for calculating ".
[0062] In the compression device 101 shown in FIG. 10, a processing device (not shown) calculates a first left singular matrix U b ' is a rotation matrix R b However, this is merely an example, and the second singular matrix calculation unit 9 calculates the first left singular matrix U as shown in equation (9). b ' is a rotation matrix R b However, in this case, the second left singular matrix U b The processing load for calculating " is the same as that of the compression device 101 shown in FIG.
[0063] In the third embodiment, the b-th first left singular matrix U b ' and the bth rotation matrix Rb and the b-th second left singular matrix U b The absolute value of the difference between 1 If so, the bth second left singular matrix U b " is output, and the absolute value of the difference is equal to or exceeds the first threshold value Th 1 If the b-th second left singular matrix U is smaller than b A compression device 101 including a sampling unit 10 that does not output "." will be described.
[0064] FIG. 13 is a configuration diagram showing a system including a compression device 101 according to a third embodiment. In FIG. 13, the same reference numerals as those in FIGS. 1, 9, and 10 indicate the same or corresponding parts, and therefore detailed description thereof will be omitted. FIG. 14 is a hardware configuration diagram showing hardware of the compression device 101 according to the third embodiment. In FIG. 14, the same reference numerals as those in FIGS. 2 and 11 indicate the same or corresponding parts, and therefore detailed description thereof will be omitted. The compression device shown in FIG. 13 includes a matrix acquisition unit 1, a partial feature matrix storage unit 2, a first global matrix calculation unit 3, a target matrix calculation unit 4, a second global matrix calculation unit 5, a global matrix storage unit 6, a first singular matrix calculation unit 7, a second singular matrix calculation unit 9, and a sampling unit 10.
[0065] The sampling unit 10 is realized by, for example, a sampling circuit 30 shown in Fig. 14. The sampling unit 10 receives the b (b = 1, ..., B)-th first left singular matrix U b ' is obtained, and the b-th second left singular matrix U b " and the bth global singular value matrix S and the bth global right singular matrix V T The sampling unit 10 acquires the b-th rotation matrix R b The sampling unit 10 obtains the b-th first left singular matrix U b ' and the bth rotation matrix R b and the b-th second left singular matrix U b The sampling unit 10 calculates the absolute value of the difference between the first threshold value Th 1 If so, the bth second left singular matrix Ub The sampling unit 10 outputs "" to the restoration device 102. When the absolute value of the difference is equal to or exceeds the first threshold value Th 1 If the b-th second left singular matrix U is smaller than b " is not output to the restoration device 102. 1 may be stored in the internal memory of the sampling unit 10, or may be provided from outside the compression device 101, for example.
[0066] In the compression device shown in Fig. 13, the sampling unit 10 is applied to the compression device 101 shown in Fig. 10. However, this is merely an example, and the sampling unit 10 may also be applied to the compression device 101 shown in Fig. 1 or the compression device 101 shown in Fig. 9.
[0067] 13, it is assumed that each of the components of the compression device 101, namely, the matrix acquisition unit 1, the partial feature matrix storage unit 2, the first global matrix calculation unit 3, the target matrix calculation unit 4, the second global matrix calculation unit 5, the global matrix storage unit 6, the first singular matrix calculation unit 7, the second singular matrix calculation unit 9, and the sampling unit 10, is realized by dedicated hardware such as that shown in Fig. 14. In other words, it is assumed that the compression device 101 is realized by a matrix acquisition circuit 21, a partial feature matrix storage circuit 22, a first global matrix calculation circuit 23, a target matrix calculation circuit 24, a second global matrix calculation circuit 25, a global matrix storage circuit 26, a first singular matrix calculation circuit 27, a second singular matrix calculation circuit 29, and a sampling circuit 30. Each of the matrix acquisition circuit 21, the first global matrix calculation circuit 23, the target matrix calculation circuit 24, the second global matrix calculation circuit 25, the first singular matrix calculation circuit 27, the second singular matrix calculation circuit 29 and the sampling circuit 30 corresponds to, for example, a single circuit, a composite circuit, a programmed processor, a parallel programmed processor, an ASIC, an FPGA, or a combination thereof.
[0068] The components of the compression device 101 are not limited to those realized by dedicated hardware, and the compression device 101 may be realized by software, firmware, or a combination of software and firmware. When the compression device 101 is realized by software, firmware, or the like, the partial feature matrix storage unit 2 and the global matrix storage unit 6 are each configured on a memory 41 shown in FIG. 3 of a computer. A compression program for causing a computer to execute the respective processing procedures of the matrix acquisition unit 1, the first global matrix calculation unit 3, the target matrix calculation unit 4, the second global matrix calculation unit 5, the first singular matrix calculation unit 7, the second singular matrix calculation unit 9, and the sampling unit 10 is stored in the memory 41. Then, a processor 42 shown in FIG. 3 executes the compression program stored in the memory 41.
[0069] 14 shows an example in which each of the components of the compression device 101 is realized by dedicated hardware, while Fig. 3 shows an example in which the compression device 101 is realized by software, firmware, etc. However, this is merely an example, and some of the components in the compression device 101 may be realized by dedicated hardware, and the remaining components may be realized by software, firmware, etc.
[0070] Next, the operation of the compression device 101 shown in Fig. 13 will be described. However, apart from the sampling unit 10, the compression device 101 is the same as the compression device 101 shown in Fig. 10. Therefore, the operation of the sampling unit 10 will mainly be described here.
[0071] The sampling unit 10 receives the b (b=1, . . . , B)-th first left singular matrix U from the first singular matrix calculation unit 7. b ' is obtained, and the b-th second left singular matrix U b " and the bth global singular value matrix S and the bth global right singular matrix V T The sampling unit 10 acquires the b-th rotation matrix R b The sampling unit 10 obtains the b-th first left singular matrix U b' and rotation matrix R b The multiplication result U b 'R b and the bth second left singular matrix U b Absolute value of the difference between b "-U b 'R b | 2 Calculate the absolute value of the difference |U b "-U b 'R b | 2 and the first threshold Th 1 Compare with.
[0072] The sampling unit 10 calculates the absolute value of the difference |U b "-U b 'R b | 2 is the first threshold Th 1 If so, the bth second left singular matrix U b " and the bth global singular value matrix S and the bth global right singular matrix V T and are output to the restoration device 102. b "-U b 'R b | 2 ≧Th1 (11) The sampling unit 10 calculates the absolute value of the difference |U b "-U b 'R b | 2 is the first threshold Th 1 If the b-th second left singular matrix U is smaller than b " and the bth global singular value matrix S and the bth global right singular matrix V T and are not output to the restoration device 102. b "-U b 'R b | 2 is the first threshold Th 1 If the b-th second left singular matrix U is smaller than b Since the partial image related to " does not contain important features, the b-th second left singular matrix U b ” to the decompression device 102.
[0073] In the third embodiment described above, the compression device 101 shown in Fig. 13 is configured to include a sampling unit 10 that outputs the b-th second left singular matrix if the absolute value of the difference between the multiplication result of the b-th first left singular matrix calculated by the first singular matrix calculation unit 7 and the b-th rotation matrix and the b-th second left singular matrix calculated by the second singular matrix calculation unit 9 is equal to or greater than a first threshold, and does not output the b-th second left singular matrix if the absolute value of the difference is smaller than the first threshold. Therefore, like the compression device 101 shown in Fig. 1, the compression device 101 shown in Fig. 13 can compress a feature matrix by simply storing a part of the feature matrix in memory, and can also achieve a higher compression rate of the feature matrix than the compression devices 101 shown in Figs. 1, 9, and 10.
[0074] Embodiment 4 In embodiment 4, the b-th rotation matrix R b and a plurality of matrix elements included in the unit matrix I are calculated, and the sum of the calculated differences is equal to or exceeds a second threshold Th 2 If so, the bth second left singular matrix U b " is output, and the sum of the differences is equal to or exceeds the second threshold value Th 2 If the b-th second left singular matrix U is smaller than b A compression device 101 including a sampling unit 11 that does not output "." will be described.
[0075] FIG. 15 is a configuration diagram showing a system including a compression device 101 according to a fourth embodiment. In FIG. 15, the same reference numerals as those in FIGS. 1, 9, and 10 indicate the same or corresponding parts, and therefore detailed description thereof will be omitted. FIG. 16 is a hardware configuration diagram showing hardware of the compression device 101 according to the fourth embodiment. In FIG. 16, the same reference numerals as those in FIGS. 2 and 11 indicate the same or corresponding parts, and therefore detailed description thereof will be omitted. The compression device shown in FIG. 15 includes a matrix acquisition unit 1, a partial feature matrix storage unit 2, a first global matrix calculation unit 3, a target matrix calculation unit 4, a second global matrix calculation unit 5, a global matrix storage unit 6, a first singular matrix calculation unit 7, a second singular matrix calculation unit 9, and a sampling unit 11.
[0076] The sampling unit 11 is realized by, for example, a sampling circuit 31 shown in Fig. 16. The sampling unit 11 receives the b (b = 1, ..., B)-th first left singular matrix U b ' is obtained, and the b-th second left singular matrix U b " and the bth global singular value matrix S and the bth global right singular matrix V T The sampling unit 11 acquires the b-th rotation matrix R b The sampling unit 11 obtains the rotation matrix R b and the unit matrix I. The sampling unit 11 calculates the difference between each of the plurality of matrix elements included in 2 If so, the bth second left singular matrix U b The sampling unit 11 outputs "" to the restoration device 102. When the sum of the calculated differences is equal to or smaller than the second threshold Th 2 If the b-th second left singular matrix U is smaller than b " is not output to the restoration device 102. 2 may be stored in the internal memory of the sampling unit 11 or may be provided from outside the compression device 101, for example.
[0077] In the compression device 101 shown in Fig. 15, the sampling unit 11 is applied to the compression device 101 shown in Fig. 10. However, this is merely an example, and the sampling unit 11 may be applied to the compression device 101 shown in Fig. 1 or the compression device 101 shown in Fig. 9.
[0078] 15 assumes that the components of the compression device 101, namely, the matrix acquisition unit 1, the partial feature matrix storage unit 2, the first global matrix calculation unit 3, the target matrix calculation unit 4, the second global matrix calculation unit 5, the global matrix storage unit 6, the first singular matrix calculation unit 7, the second singular matrix calculation unit 9, and the sampling unit 11, are each realized by dedicated hardware such as that shown in Fig. 16. That is, it is assumed that the compression device 101 is realized by a matrix acquisition circuit 21, a partial feature matrix storage circuit 22, a first global matrix calculation circuit 23, a target matrix calculation circuit 24, a second global matrix calculation circuit 25, a global matrix storage circuit 26, a first singular matrix calculation circuit 27, a second singular matrix calculation circuit 29, and a sampling circuit 31. Each of the matrix acquisition circuit 21, the first global matrix calculation circuit 23, the target matrix calculation circuit 24, the second global matrix calculation circuit 25, the first singular matrix calculation circuit 27, the second singular matrix calculation circuit 29 and the sampling circuit 31 corresponds to, for example, a single circuit, a composite circuit, a programmed processor, a parallel programmed processor, an ASIC, an FPGA, or a combination thereof.
[0079] The components of the compression device 101 are not limited to those realized by dedicated hardware, and the compression device 101 may be realized by software, firmware, or a combination of software and firmware. When the compression device 101 is realized by software, firmware, or the like, the partial feature matrix storage unit 2 and the global matrix storage unit 6 are each configured on a memory 41 shown in FIG. 3 of a computer. A compression program for causing a computer to execute the respective processing procedures of the matrix acquisition unit 1, the first global matrix calculation unit 3, the target matrix calculation unit 4, the second global matrix calculation unit 5, the first singular matrix calculation unit 7, the second singular matrix calculation unit 9, and the sampling unit 11 is stored in the memory 41. Then, a processor 42 shown in FIG. 3 executes the compression program stored in the memory 41.
[0080] 16 shows an example in which each of the components of the compression device 101 is realized by dedicated hardware, while Fig. 3 shows an example in which the compression device 101 is realized by software, firmware, etc. However, this is merely an example, and some of the components in the compression device 101 may be realized by dedicated hardware, and the remaining components may be realized by software, firmware, etc.
[0081] Next, the operation of the compression device 101 shown in Fig. 15 will be described. However, apart from the sampling unit 11, the compression device 101 is the same as the compression device 101 shown in Fig. 10. Therefore, the operation of the sampling unit 11 will mainly be described here.
[0082] The sampling unit 11 receives the b-th second left singular matrix U from the second singular matrix calculation unit 9. b " and the bth global singular value matrix S and the bth global right singular matrix V T The sampling unit 11 acquires the b-th rotation matrix R b The sampling unit 11 obtains the rotation matrix R as shown in the following equation (12). b The multiple matrix elements r included in p,q (p=1,...,K:q=1,...,K) and the plurality of matrix elements i included in the unit matrix I p,q The difference d between each of p,q Calculate.
[0083]
[0084] The sampling unit 11 calculates a plurality of differences d p,q A sum D of (p=1, . . . , K: q=1, . . . , K) is calculated.
[0085]
[0086] The sampling unit 11 calculates a plurality of differences d p,q The sum D and the second threshold Th 2 The sampling unit 11 compares the multiple differences d p,q The sum D of the second threshold Th2 If so, the bth second left singular matrix U b " and the bth global singular value matrix S and the bth global right singular matrix V T and output to the reconstruction device 102. D≧Th 2 (14) The sampling unit 11 calculates a plurality of differences d p,q The sum D of the second threshold Th 2 If the b-th second left singular matrix U is smaller than b " and the bth global singular value matrix S and the bth global right singular matrix V T and are not output to the restoration device 102. p,q The sum D of the second threshold Th 2 If the b-th second left singular matrix U is smaller than b " does not contain important features, so in restoring the image, the b-th second left singular matrix U b ” to the decompression device 102.
[0087] In the fourth embodiment described above, the compression device 101 shown in Fig. 15 is configured to include a sampling unit 11 that calculates differences between each of a plurality of matrix elements included in the rotation matrix and each of a plurality of matrix elements included in the unit matrix, and outputs the b-th second left singular matrix calculated by the second singular matrix calculation unit 9 if the sum of the calculated differences is equal to or greater than a second threshold, and does not output the b-th second left singular matrix if the sum of the differences is smaller than the second threshold. Therefore, like the compression device 101 shown in Fig. 1, the compression device 101 shown in Fig. 15 can compress a feature matrix by simply storing a part of the feature matrix in memory, and can also achieve a higher compression rate of the feature matrix than the compression devices 101 shown in Figs. 1, 9, and 10.
[0088] In addition, the present disclosure allows for free combination of the respective embodiments, modification of any of the components of the respective embodiments, or omission of any of the components of the respective embodiments.
[0089] The present disclosure is suitable for a compression device, a compression method, a compression program, and a system.
[0090] 1 matrix acquisition unit, 2 partial feature matrix storage unit, 3 first global matrix calculation unit, 4 target matrix calculation unit, 5 second global matrix calculation unit, 6 global matrix storage unit, 7 first singular matrix calculation unit, 8, 9 second singular matrix calculation unit, 10, 11 sampling unit, 12 storage unit, 21 matrix acquisition circuit, 22 partial feature matrix storage circuit, 23 first global matrix calculation circuit, 24 target matrix calculation circuit, 25 second global matrix calculation circuit, 26 global matrix storage circuit, 27 first singular matrix calculation circuit, 28, 29 second singular matrix calculation circuit, 30, 31 sampling circuit, 41 memory, 42 processor, 101 compression device, 102 decompression device, 103 inspection device.
Claims
1. A matrix acquisition unit that sequentially acquires partial feature matrices for each of a plurality of partial images obtained by dividing an image; a first global matrix calculation unit that performs singular value decomposition on a first partial feature matrix that is the first partial feature matrix acquired by the matrix acquisition unit, and calculates a first global singular value matrix that is the first global singular value matrix including singular values of the first partial feature matrix, and a first global right singular matrix that is the first global right singular matrix including right singular vectors corresponding to the singular values of the first partial feature matrix; a target matrix calculation unit that calculates a b-th target matrix that is the b-th target matrix for the singular value decomposition, including the b-th partial feature matrix that is the b-th (b is an integer of 2 or more) partial feature matrix acquired by the matrix acquisition unit, the (b-1)-th global singular value matrix, and the (b-1)-th global right singular matrix; a second global matrix calculation unit that performs singular value decomposition on the b-th target matrix calculated by the target matrix calculation unit, calculates a singular value matrix of the b-th target matrix including singular values of the b-th target matrix as a b-th global singular value matrix, and calculates a right singular matrix of the b-th target matrix including right singular vectors corresponding to the singular values of the b-th target matrix as a b-th global right singular matrix.
2. The compression device according to claim 1, further comprising a first singular matrix calculation unit that performs singular value decomposition on the b-th partial feature matrix acquired by the matrix acquisition unit, and calculates a b-th first singular value matrix including singular values of the b-th partial feature matrix, a b-th first left singular matrix including left singular vectors corresponding to the singular values of the b-th partial feature matrix, and a b-th first right singular matrix including right singular vectors corresponding to the singular values of the b-th partial feature matrix.
3. The compression device according to claim 2, further comprising a second singular matrix calculation unit that calculates a b-th second left singular matrix including left singular vectors corresponding to the singular values of the b-th target matrix, from the b-th global singular value matrix calculated by the second global matrix calculation unit, the b-th global right singular matrix calculated by the second global matrix calculation unit, the b-th first singular value matrix calculated by the first singular matrix calculation unit, the b-th first left singular matrix calculated by the first singular matrix calculation unit, and the b-th first right singular matrix calculated by the first singular matrix calculation unit.
4. The compression device according to claim 3, further comprising a storage unit that stores the bth second left singular matrix calculated by the second singular matrix calculation unit, the bth global singular value matrix calculated by the second global matrix calculation unit, and the bth global right singular matrix calculated by the second global matrix calculation unit.
5. The compression device according to claim 2, further comprising a second singular matrix calculation unit that acquires the bth first left singular matrix calculated by the first singular matrix calculation unit and a bth rotation matrix that rotates the bth first left singular matrix, and calculates a bth second left singular matrix from the bth rotation matrix and the bth first left singular matrix, the bth second left singular matrix including left singular vectors corresponding to the singular values of the b target matrix.
6. The compression device according to claim 5, characterized in that the second singular matrix calculation unit calculates the bth rotation matrix from the bth global singular value matrix calculated by the second global matrix calculation unit, the bth global right singular matrix calculated by the second global matrix calculation unit, the bth first singular value matrix calculated by the first singular matrix calculation unit, and the bth first right singular matrix calculated by the first singular matrix calculation unit.
7. The compression device according to claim 5, further comprising a sampling unit that outputs the bth second left singular matrix if the absolute value of the difference between the multiplication result of the bth first left singular matrix calculated by the first singular matrix calculation unit and the bth rotation matrix and the bth second left singular matrix calculated by the second singular matrix calculation unit is equal to or greater than a first threshold, and does not output the bth second left singular matrix if the absolute value of the difference is smaller than the first threshold.
8. The compression device according to claim 5, further comprising a sampling unit that calculates the difference between each of a plurality of matrix elements included in the rotation matrix and each of a plurality of matrix elements included in the identity matrix, and outputs the b-th second left singular matrix calculated by the second singular matrix calculation unit if the sum of the calculated differences is equal to or greater than a second threshold, and does not output the b-th second left singular matrix if the sum of the differences is smaller than the second threshold.
9. The compression device according to claim 1, wherein the image is an inspection image including an object for inspection, and the compression device is a device for compressing the inspection image.
10. The matrix acquisition unit sequentially acquires partial feature matrices for each of a plurality of partial images obtained by dividing an image; the first global matrix calculation unit performs singular value decomposition on the first partial feature matrix that is the first partial feature matrix acquired by the matrix acquisition unit, and calculates a first global singular value matrix that is the first global singular value matrix including singular values of the first partial feature matrix, and a first global right singular matrix that is the first global right singular matrix including right singular vectors corresponding to the singular values of the first partial feature matrix; the target matrix calculation unit calculates a b-th target matrix that is the b-th singular value decomposition target matrix that includes the b-th partial feature matrix that is the b-th (b is an integer of 2 or more) partial feature matrix acquired by the matrix acquisition unit, the (b-1)-th global singular value matrix, and the (b-1)-th global right singular matrix; a second global matrix calculation unit performs singular value decomposition on the b-th target matrix calculated by the target matrix calculation unit, calculates a singular value matrix of the b-th target matrix including singular values of the b-th target matrix as a b-th global singular value matrix, and calculates a right singular matrix of the b-th target matrix including right singular vectors corresponding to the singular values of the b-th target matrix as a b-th global right singular matrix.
11. A processing procedure in which a matrix acquisition unit sequentially acquires partial feature matrices for each of a plurality of partial images obtained by dividing an image; a processing procedure in which a first global matrix calculation unit performs singular value decomposition on a first partial feature matrix that is the first partial feature matrix acquired by the matrix acquisition unit, and calculates a first global singular value matrix that is the first global singular value matrix including singular values of the first partial feature matrix, and a first global right singular matrix that is the first global right singular matrix including right singular vectors corresponding to the singular values of the first partial feature matrix; a processing procedure in which a target matrix calculation unit calculates a b-th target matrix that is the b-th target matrix for singular value decomposition, including a b-th partial feature matrix that is the b-th (b is an integer of 2 or more) partial feature matrix acquired by the matrix acquisition unit, a (b-1)-th global singular value matrix, and a (b-1)-th global right singular matrix. a processing procedure in which a second global matrix calculation unit performs singular value decomposition on the b-th target matrix calculated by the target matrix calculation unit, calculates a singular value matrix of the b-th target matrix including singular values of the b-th target matrix as a b-th global singular value matrix, and calculates a right singular matrix of the b-th target matrix including right singular vectors corresponding to the singular values of the b-th target matrix as a b-th global right singular matrix.
12. A system comprising: the compression device according to claim 3; and a restoration device that restores the original image from which the plurality of partial images were divided, based on the bth second left singular matrix calculated by the second singular matrix calculation unit, the bth global singular value matrix calculated by the second global matrix calculation unit, and the bth global right singular matrix calculated by the second global matrix calculation unit.
13. The system according to claim 12, further comprising an inspection device that inspects an object included in the restored image based on the image restored by the restoration device.
Citation Information
Patent Citations
Image compression method based on singular vector sparse reconstruction
CN112218085A
Method for extracting feature of image and method for compressing image
JP2008042335A
Feature-based video compression
JP2012505600A
Data adaptive compression and data encryption using kronecker product
JP2019204542A