A linear machine translation method and system based on optical vector matrix
Through a linear machine translation method based on optical vector matrix, the problem of poor translation accuracy and effect of handwritten image is solved, and efficient and accurate word handwritten image recognition and translation are achieved, which is suitable for high-speed real-time translation.
Patent Information
- Application Number
- CN202210233754.6
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-03-10
- Publication Date
- 2025-02-11
- Estimated Expiration
- 2042-03-10
Smart Images

Figure CN114781360B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of artificial intelligence technology, and in particular to a linear machine translation method and system based on an optical vector matrix. In addition, the present invention also relates to an electronic device and a processor-readable storage medium. Background Art
[0002] Machine translation is an important part of natural language processing. The machine translation system needs to accurately extract the features of the corpus so that the machine translation results are close to the translation results of natural language. At present, the traditional machine translation schemes are mainly divided into nonlinear methods based on temporal neural networks and linear methods based on probability statistics. The common point of these two methods is that they need to obtain the feature information of the corpus to be translated in a massive corpus based on the context structure of the corpus, and find the corresponding features in another language. Among them, the process of machine translation calculation involves a large number of high-dimensional matrix operations, and consumes a lot of computing time and storage space; and the object of traditional translation is based on word vectors. After obtaining the word vectors of another language, the corresponding words need to be retrieved in the dictionary. For the image-based translation method, a standard font is required to recognize the words corresponding to the image. However, this traditional method has a poor effect on the word translation of handwritten images, resulting in high application limitations. Therefore, how to design an efficient and accurate recognition and translation scheme for handwritten word images has very important practical significance. Summary of the invention
[0003] To this end, the present invention provides a linear machine translation method and system based on an optical vector matrix to solve the defects of the prior art that the machine translation solutions have high limitations, resulting in poor machine translation accuracy and effect.
[0004] In a first aspect, the present invention provides a linear machine translation method based on an optical vector matrix, comprising: obtaining a first language word picture to be translated, recognizing the first language word picture, and obtaining image speckles corresponding to word phrases in the first language word picture;
[0005] Performing word vector encoding based on the image speckle to obtain a word vector corresponding to a word phrase;
[0006] Based on a preset optical platform, the word vector and the corresponding linear translation matrix are loaded respectively to optimize the translation of the word vector based on the linear translation matrix to obtain the word vector corresponding to the second language;
[0007] Based on the word vector corresponding to the second language, a matching search is performed in the word library to obtain a target word vector; and the target word vector is decoded to obtain a translated second language word image.
[0008] Further, performing a matching search in a word library based on the word vector corresponding to the second language to obtain a target word vector specifically includes:
[0009] Based on the Softmax logistic regression model, the word vector corresponding to the second language is compared with the word vector corresponding to the word in the vocabulary by cosine distance, and the target word vector with the shortest cosine distance to the word vector corresponding to the second language is retrieved.
[0010] Furthermore, the preset optical platform respectively loads the word vector and the corresponding linear translation matrix to optimize the translation of the word vector based on the linear translation matrix to obtain the word vector corresponding to the second language, specifically including:
[0011] The word vector is loaded based on the amplitude-type spatial light modulator in the optical platform, and the corresponding linear translation matrix is loaded based on the pure phase-type spatial light modulator in the optical platform. After the word vector and the linear translation matrix are coherently superimposed, they are superimposed column by column using a cylindrical lens to obtain the word vector corresponding to the second language.
[0012] Further, word vector encoding is performed based on the image speckle to obtain a word vector corresponding to a word phrase, specifically including:
[0013] The image speckle is input into a Skip-Gram model for word vector encoding, and a word vector containing semantic information corresponding to the word phrase is obtained; wherein the Skip-Gram model is a linear word vector encoding model based on statistical probability.
[0014] Further, the first language word picture is recognized to obtain image speckles corresponding to word phrases in the first language word picture, specifically including:
[0015] The first language word picture is recognized based on a transmission matrix of a random scattering medium to obtain image speckles corresponding to word phrases in the first language word picture.
[0016] Furthermore, the first language word picture is a handwritten picture containing a first language word phrase; and the second language word picture is a picture containing a second language word phrase.
[0017] In a second aspect, the present invention further provides a linear machine translation system based on an optical vector matrix, comprising:
[0018] A handwriting image recognition module, used to obtain a first language word image to be translated, recognize the first language word image, and obtain image speckles corresponding to word phrases in the first language word image;
[0019] A word vector encoding module, used for performing word vector encoding based on the image speckle to obtain a word vector corresponding to a word phrase;
[0020] A word vector optimization translation module, used for loading the word vector and the corresponding linear translation matrix respectively based on a preset optical platform, so as to optimize the translation of the word vector based on the linear translation matrix and obtain the word vector corresponding to the second language;
[0021] The word vector matching retrieval and decoding module is used to perform matching retrieval in the word library based on the word vector corresponding to the second language to obtain the target word vector; and decode the target word vector to obtain the translated second language word image.
[0022] Furthermore, the word vector optimization translation module is specifically used for:
[0023] The word vector is loaded based on the amplitude-type spatial light modulator in the optical platform, and the corresponding linear translation matrix is loaded based on the pure phase-type spatial light modulator in the optical platform. After the word vector and the linear translation matrix are coherently superimposed, they are superimposed column by column using a cylindrical lens to obtain the word vector corresponding to the second language.
[0024] Furthermore, the word vector matching retrieval and decoding module is specifically used for:
[0025] Based on the Softmax logistic regression model, the word vector corresponding to the second language is compared with the word vector corresponding to the word in the vocabulary by cosine distance, and the target word vector with the shortest cosine distance to the word vector corresponding to the second language is retrieved.
[0026] Furthermore, the word vector encoding module is specifically used for:
[0027] The image speckle is input into a Skip-Gram model for word vector encoding, and a word vector containing semantic information corresponding to the word phrase is obtained; wherein the Skip-Gram model is a linear word vector encoding model based on statistical probability.
[0028] Furthermore, the handwritten image recognition module is specifically used for:
[0029] The first language word picture is recognized based on a transmission matrix of a random scattering medium to obtain image speckles corresponding to word phrases in the first language word picture.
[0030] Furthermore, the first language word picture is a handwritten picture containing a first language word phrase; and the second language word picture is a picture containing a second language word phrase.
[0031] In a third aspect, the present invention further provides an electronic device comprising: a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein when the processor executes the computer program, the steps of the linear machine translation method based on the optical vector matrix as described in any one of the above items are implemented.
[0032] In a fourth aspect, the present invention further provides a processor-readable storage medium, on which a computer program is stored. When the computer program is executed by a processor, the steps of the linear machine translation method based on the optical vector matrix as described in any one of the above items are implemented.
[0033] The linear machine translation method based on optical vector matrix provided by the present invention obtains the image speckle corresponding to the word phrase in the first language word picture by recognizing the acquired first language word picture; then, the word vector is encoded based on the image speckle to obtain the word vector corresponding to the word phrase; and the word vector and the corresponding linear translation matrix are loaded respectively based on the preset optical platform to realize the optimized translation of the word vector based on the linear translation matrix to obtain the word vector corresponding to the second language; further, the word vector corresponding to the second language is matched and retrieved in the word library to obtain the target word vector, and the target word vector is decoded to obtain the translated second language word picture. The high concurrency and low energy consumption characteristics of optical transmission are used to accelerate the calculation of high-dimensional matrices and reduce the storage space of the translation matrix, which greatly accelerates the matrix operation, reduces the original calculation time, improves the translation speed, and can realize the translation between text patterns, improves the recognition and translation accuracy of word handwritten pictures, and can be applied to the scene of high-speed real-time translation. BRIEF DESCRIPTION OF THE DRAWINGS
[0034] In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the following briefly introduces the drawings required for use in the embodiments or the description of the prior art. Obviously, the drawings described below are some embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying creative work.
[0035] Figure 1 is a flow chart of a linear machine translation method based on an optical vector matrix provided by an embodiment of the present invention;
[0036] Figure 2 It is a complete flow chart of a linear machine translation method based on an optical vector matrix provided by an embodiment of the present invention;
[0037] Figure 3 It is a schematic diagram of the basic principle of the Skip-Gram model provided by an embodiment of the present invention;
[0038] Figure 4 is a schematic diagram of a fully connected optical diffraction neural network provided by an embodiment of the present invention;
[0039] Figure 5 Schematic diagram of the basic principle of the linear translation matrix provided by an embodiment of the present invention;
[0040] Figure 6 is a schematic diagram of the structure of an optical platform provided by an embodiment of the present invention;
[0041] Figure 7 It is the speckle and recovery value of the input image after passing through the random scattering medium provided by the embodiment of the present invention;
[0042] Figure 8 is a speckle value obtained after the input image provided by the embodiment of the present invention passes through a random scattering medium;
[0043] Fig. 9 is a comparative schematic diagram of translation results provided by an embodiment of the present invention;
[0044] Fig.10 is a comparative schematic diagram of the translation accuracy after optimization based on the optical platform provided in an embodiment of the present invention;
[0045] Fig.11 is the computing time saved based on the optical platform provided by the embodiment of the present invention and its proportion in the total program running time;
[0046] Fig.12 is a schematic diagram of the structure of a linear machine translation system based on an optical vector matrix provided in an embodiment of the present invention;
[0047] Fig.13 It is a schematic diagram of the physical structure of an electronic device provided by an embodiment of the present invention. DETAILED DESCRIPTION
[0048] In order to make the purpose, technical solution and advantages of the embodiments of the present invention clearer, the technical solution in the embodiments of the present invention will be clearly and completely described below in conjunction with the drawings in the embodiments of the present invention. Obviously, the described embodiments are part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of the present invention.
[0049] The following is a detailed description of an embodiment of the linear machine translation method based on an optical vector matrix according to the present invention. Figure 1 As shown, it is a flow chart of a linear machine translation method based on an optical vector matrix provided by an embodiment of the present invention, and the specific implementation process includes the following steps:
[0050] Step 101: obtaining a first language word image to be translated, recognizing the first language word image, and obtaining image speckles corresponding to word phrases in the first language word image.
[0051] In an embodiment of the present invention, before executing this step, it is necessary to compress and reduce the dimension of the input handwritten word image in advance, extract the feature information of the handwritten word image, and classify similar handwritings and compile them into a unified code and add them to the vocabulary. In this step, the first language word image can be specifically identified based on the transmission matrix of the random scattering medium to obtain the image speckle corresponding to the word phrase in the first language word image. The transmission matrix H of the random scattering medium is approximately a random Gaussian complex matrix, and the transmission matrix has a corresponding complex conjugate matrix. When the optical signal passes through the random scattering medium, it is equivalent to multiplying with the transmission matrix, which can achieve dimensionality reduction compression and keep the inner product of the original vector unchanged. For example: assuming that the original image (first language word image) is W, and the encoded word vector is V=H*W, for the corresponding decoding process, the transmission matrix H of the random scattering medium can be obtained first, and then the complex conjugate matrix H of the transmission matrix can be calculated. r , and H*H r =E, E is the unit matrix, so the encoding and decoding process matrices corresponding to the word vector satisfy H r *H*W=W, thus completing the encoding and decoding restoration process. The first language word image refers to a handwritten image containing a first language word phrase.
[0052] Step 102: Perform word vector encoding based on the image speckle to obtain a word vector corresponding to a word phrase.
[0053] Specifically, the image speckle can be input into the Skip-Gram model (i.e., the Skip-Gram algorithm) for word vector encoding, and the word vector containing semantic information corresponding to the word phrase is obtained. Among them, the Skip-Gram model is a linear word vector encoding model based on statistical probability. The Skip-Gram algorithm is a linear word vector encoding process based on statistical probability. There is no nonlinear layer in the whole process. The word vector encoding module encodes words without semantic information in the vocabulary. Assuming that the word to be encoded is the central word, the probability of its context words appearing in the corpus is counted. If the probabilities of the context words of the two central words appearing are similar, then the two central words can be judged to be synonyms. This encoding method can make words with similar meanings have similar cosine distances in the vector space. For example Figure 3 As shown, it demonstrates the basic principle implementation process of the Skip-Gram algorithm.
[0054] It should be noted that in the actual implementation process, if the same method is used to encode dictionaries of different languages, synonyms also have the characteristic of similar cosine distances in their respective word vector spaces. The word vector obtained by this method is the result of single-language corpus training. In order to optimize the word vector corresponding to the image speckle, cross-language context information can be added to strengthen the correlation between the corresponding word vectors of different languages, so that the value of the correlation coefficient Cov(x, y) between the word x and the word y of the corresponding meaning is close to 1. The method used can be a deep canonical correlation algorithm. Let u and v be two projection matrices, f(x) and g(y) be word x and word y, and obtain feature information through a fully connected neural network. ∑fg, ∑ff, ∑gg are the covariance matrices between the feature information, and the correlation coefficient Cov(x, y) satisfies the following formula:
[0055]
[0056] Among them, the neural network part can be realized based on the optical diffraction neural network.
[0057] like Figure 4 As shown in Figure 1, it shows one layer of a fully connected optical diffraction neural network. The first spatial light modulator (SLM1, Spatial Light Modulation1) loaded word vector x = {x 1 , x 2 , x 3 , …, x n}, the second spatial light modulator (SLM2, Spatial Light Modulation2) loads the word vector y = {y 1 ,y 2 ,y 3 , …, y n}. For any y k ,have A k and θ k Represent the amplitude and phase of the second spatial light modulator respectively. The transmission matrix W is a preset fixed value that satisfies the law of spatial diffraction propagation. For each layer of input signal x, the output z satisfies the following formula:
[0058] z=f(x⊙y*W) (2)
[0059] where f(x) = x 2 It is an activation function and can be completed based on a CCD detector.
[0060] Step 103: Based on a preset optical platform, the word vector and the corresponding linear translation matrix are loaded respectively to optimize the translation of the word vector based on the linear translation matrix to obtain the word vector corresponding to the second language.
[0061] In the embodiment of the present invention, it is necessary to pre-train a linear translation matrix that meets the application conditions. Specifically, Figure 5 As shown, assuming that the total number of words in the language A dictionary is M, take m word vectors of dimension p as CodeA; the total number of words in the language B dictionary is N, take m word vectors of dimension q as CodeB (where M, N>>m). Use CodeA and CodeB as training sets to train a linear translation matrix T(pxq) so that T*CodeA=CodeB, where CodeA and CodeB are aligned word vectors, that is, the meaning of each row is the same. This linear translation matrix can achieve the effect of translating words in the entire vocabulary with a small amount of training data.
[0062] After obtaining a linear translation matrix that meets the application conditions through the above process, in this step, the word vector can be loaded based on the amplitude-type spatial light modulator in the optical platform, and the corresponding linear translation matrix can be loaded based on the pure phase-type spatial light modulator in the optical platform. After the word vector and the linear translation matrix are coherently superimposed, they are superimposed column by column using a cylindrical lens to obtain the word vector corresponding to the second language.
[0063] It should be noted that the optical platform (optical computing platform) described in the embodiment of the present invention can optimize the word vector through optical vector matrix multiplication to achieve the process of word vector translation and decoding restoration into an image. The structure of the optical computing platform is as follows: Figure 6 As shown, it includes a laser transmitter coupled with a polarization-maintaining fiber and a polarizer P1, a beam expander, an amplitude-type spatial light modulator DMD (Digital Micromirror Device), a pure phase-type spatial light modulator SLM (Spatial Light Modulation) loaded with a linear translation matrix, two sets of 4f imaging systems and CCD (Charge Coupled Device) cameras, L1, L2, L3, L4 are plano-convex lenses, C1 is a cylindrical lens, and S1 and S2 are pinholes. The DMD loads the input word vector, and the SLM loads the linear translation matrix. After the two are coherently superimposed, they are superimposed column by column with a cylindrical lens to obtain the calculated word vector, that is, the word vector corresponding to the second language. Each row of the DMD loads the input word vector v = {v 1 , v 2 , v 3 , …, v n}, with a total of m rows, the matrix V is obtained; the SLM loads the linear translation matrix W of size mxn, and the result of the coherent superposition of the two spatial light modulator patterns is equivalent to the corresponding multiplication of the elements, that is, the matrix U = V⊙W, and then passing through the cylindrical lens C1 is equivalent to summing all the elements of each row of the matrix U, that is, u k =∑i v i w ik , and finally we get u = W*v. In the specific implementation process, for the optical diffraction neural network, we only need to remove the 4f lens group on the basis of the original computing platform and select an appropriate distance between the beam splitter and the CCD.
[0064] Step 104: performing a matching search in a word library based on the word vector corresponding to the second language to obtain a target word vector; decoding the target word vector to obtain a translated second language word image.
[0065] like Figure 2 As shown, in an embodiment of the present invention, after translating to obtain a word vector of another language (a word vector corresponding to the second language), the word vector corresponding to the second language and the word vector corresponding to the word in the word library can be compared by cosine distance based on the Softmax logistic regression model, and the target word vector with the shortest cosine distance to the word vector corresponding to the second language is retrieved as the translation result. Among them, the second language word image is an image containing a second language word phrase. The translation result can be restored to the translated word image corresponding to the second language (i.e., the language B word image) through the word vector decoding module.
[0066] like Figure 7 As shown in FIG. 1 , it is the recognition and restoration process of the word image. The forward transformation and inverse transformation of the word image can be realized by the transmission matrix corresponding to the loaded random scattering medium and its inversion. The encoding distance of similar word images is smaller. In the embodiment of the present invention, the image speckle (b) and the corresponding recovery value (c) obtained after the input first language word image (a) passes through the random scattering medium. The recovery value is the word corresponding to the second language word image. Among them, the speckle value corresponding to the image speckle (b) obtained after passing through the random scattering medium is shown as follows: Figure 8 shown.
[0067] like Fig. 9 As shown, words of the same category are close in space, and for words with similar meanings, the correlation coefficient between the two is close to 1. Fig. 9 The following figure shows the translation result after loading the translation matrix on the optical platform for translation and then loading the decoding matrix to decode the word image. (a) is a set of word images in the first language to be translated, (b) is the theoretical value of the translation result, (c) is the translation result before experimental error optimization, and (d) is the translation result after optimization. Fig.10 It can be seen that the accuracy of translation has been significantly improved after optimization by the solution of the present invention. Fig.11 This is a curve showing the change of the computing time saved by the solution of the present invention as the matrix dimension increases. It can be seen that as the matrix dimension increases, the computing time and storage space that can be saved by the solution of the present invention can be greatly improved.
[0068] The linear machine translation method based on optical vector matrix described in the embodiment of the present invention obtains the image speckle corresponding to the word phrase in the first language word picture by recognizing the acquired first language word picture; then, the word vector is encoded based on the image speckle to obtain the word vector corresponding to the word phrase; and the word vector and the corresponding linear translation matrix are loaded respectively based on the preset optical platform to realize the optimized translation of the word vector based on the linear translation matrix to obtain the word vector corresponding to the second language; further, the word vector corresponding to the second language is matched and retrieved in the word library to obtain the target word vector, and the target word vector is decoded to obtain the translated second language word picture. The high concurrency and low energy consumption characteristics of optical transmission are used to accelerate the calculation of high-dimensional matrices and reduce the storage space of the translation matrix, which greatly accelerates the matrix operation, reduces the original calculation time, improves the translation speed, and can realize the translation between text patterns, improves the recognition and translation accuracy of handwritten word pictures, and can be applied to the scene of high-speed real-time translation.
[0069] Corresponding to the above-mentioned linear machine translation method based on optical vector matrix, the present invention also provides a linear machine translation system based on optical vector matrix. Since the embodiment of the system is similar to the above-mentioned method embodiment, the description is relatively simple. For relevant parts, please refer to the description of the above-mentioned method embodiment. The embodiment of the linear machine translation system based on optical vector matrix described below is only illustrative. Please refer to Fig.12 As shown, it is a structural schematic diagram of a linear machine translation system based on optical vector matrix provided by an embodiment of the present invention.
[0070] The optical vector matrix-based linear machine translation system of the present invention specifically includes:
[0071] The handwriting image recognition module 1201 is used to obtain a first language word image to be translated, recognize the first language word image, and obtain image speckles corresponding to word phrases in the first language word image;
[0072] A word vector encoding module 1202, configured to perform word vector encoding based on the image speckle to obtain a word vector corresponding to a word phrase;
[0073] The word vector optimization translation module 1203 is used to load the word vector and the corresponding linear translation matrix respectively based on a preset optical platform, so as to optimize the translation of the word vector based on the linear translation matrix to obtain the word vector corresponding to the second language;
[0074] The word vector matching retrieval and decoding module 1204 is used to perform matching retrieval in the word library based on the word vector corresponding to the second language to obtain the target word vector; and decode the target word vector to obtain the translated second language word image.
[0075] Furthermore, the word vector optimization translation module is specifically used for:
[0076] The word vector is loaded based on the amplitude-type spatial light modulator in the optical platform, and the corresponding linear translation matrix is loaded based on the pure phase-type spatial light modulator in the optical platform. After the word vector and the linear translation matrix are coherently superimposed, they are superimposed column by column using a cylindrical lens to obtain the word vector corresponding to the second language.
[0077] Furthermore, the word vector matching retrieval and decoding module is specifically used for:
[0078] Based on the Softmax logistic regression model, the word vector corresponding to the second language is compared with the word vector corresponding to the word in the vocabulary by cosine distance, and the target word vector with the shortest cosine distance to the word vector corresponding to the second language is retrieved.
[0079] Furthermore, the word vector encoding module is specifically used for:
[0080] The image speckle is input into a Skip-Gram model for word vector encoding, and a word vector containing semantic information corresponding to the word phrase is obtained; wherein the Skip-Gram model is a linear word vector encoding model based on statistical probability.
[0081] Furthermore, the handwritten image recognition module is specifically used for:
[0082] The first language word picture is recognized based on a transmission matrix of a random scattering medium to obtain image speckles corresponding to word phrases in the first language word picture.
[0083] Furthermore, the first language word picture is a handwritten picture containing a first language word phrase; and the second language word picture is a picture containing a second language word phrase.
[0084] The linear machine translation system based on optical vector matrix described in the embodiment of the present invention obtains the image speckle corresponding to the word phrase in the first language word picture by recognizing the acquired first language word picture; then, the word vector is encoded based on the image speckle to obtain the word vector corresponding to the word phrase; and the word vector and the corresponding linear translation matrix are loaded respectively based on the preset optical platform to realize the optimized translation of the word vector based on the linear translation matrix to obtain the word vector corresponding to the second language; further, the word vector corresponding to the second language is matched and retrieved in the word library to obtain the target word vector, and the target word vector is decoded to obtain the translated second language word picture. The high concurrency and low energy consumption characteristics of optical transmission are used to accelerate the calculation of high-dimensional matrices and reduce the storage space of the translation matrix, which greatly accelerates the matrix operation, reduces the original calculation time, improves the translation speed, and can realize the translation between text patterns, improves the recognition and translation accuracy of handwritten word pictures, and can be applied to the scene of high-speed real-time translation.
[0085] Corresponding to the above-mentioned linear machine translation method based on optical vector matrix, the present invention also provides an electronic device. Since the embodiment of the electronic device is similar to the above-mentioned method embodiment, the description is relatively simple. For the relevant parts, please refer to the description of the above-mentioned method embodiment. The electronic device described below is only exemplary. Fig.13 As shown, it is a schematic diagram of the physical structure of an electronic device disclosed in an embodiment of the present invention. The electronic device may include: a processor 1301, a memory 1302 and a communication bus 1303, wherein the processor 1301 and the memory 1302 complete mutual communication through the communication bus 1303, and communicate with the outside through the communication interface 1304. The processor 1301 can call the logic instructions in the memory 1302 to execute a linear machine translation method based on an optical vector matrix, the method comprising: obtaining a first language word image to be translated, identifying the first language word image, and obtaining an image speckle corresponding to a word phrase in the first language word image; encoding a word vector based on the image speckle to obtain a word vector corresponding to a word phrase; loading the word vector and the corresponding linear translation matrix based on a preset optical platform, respectively, to achieve optimized translation of the word vector based on the linear translation matrix, and obtain a word vector corresponding to the second language; matching and searching in the word library based on the word vector corresponding to the second language to obtain a target word vector; decoding the target word vector to obtain a translated second language word image.
[0086] In addition, the logic instructions in the above-mentioned memory 1302 can be implemented in the form of software functional units and can be stored in a computer-readable storage medium when sold or used as an independent product. Based on such an understanding, the technical solution of the present invention, in essence, or the part that contributes to the prior art or the part of the technical solution, can be embodied in the form of a software product, and the computer software product is stored in a storage medium, including several instructions for a computer device (which can be a personal computer, a server, or a network device, etc.) to perform all or part of the steps of the method described in each embodiment of the present invention. The aforementioned storage medium includes: a storage chip, a U disk, a mobile hard disk, a read-only memory (ROM, Read-Only Memory), a random access memory (RAM, Random Access Memory), a disk or an optical disk, and other media that can store program codes.
[0087] On the other hand, an embodiment of the present invention further provides a computer program product, the computer program product comprising a computer program stored on a processor-readable storage medium, the computer program comprising program instructions, and when the program instructions are executed by a computer, the computer can execute the linear machine translation method based on the optical vector matrix provided in the above-mentioned method embodiments. The method comprises: obtaining a first language word image to be translated, identifying the first language word image, and obtaining an image speckle corresponding to a word phrase in the first language word image; encoding a word vector based on the image speckle to obtain a word vector corresponding to the word phrase; loading the word vector and the corresponding linear translation matrix based on a preset optical platform, respectively, to achieve optimized translation of the word vector based on the linear translation matrix, and obtain a word vector corresponding to the second language; performing matching retrieval in the word library based on the word vector corresponding to the second language to obtain a target word vector; decoding the target word vector to obtain a translated second language word image.
[0088] On the other hand, an embodiment of the present invention further provides a processor-readable storage medium, on which a computer program is stored, and when the computer program is executed by the processor, it is implemented to execute the linear machine translation method based on the optical vector matrix provided in the above embodiments. The method includes: obtaining a first language word image to be translated, identifying the first language word image, and obtaining an image speckle corresponding to a word phrase in the first language word image; encoding a word vector based on the image speckle to obtain a word vector corresponding to the word phrase; loading the word vector and the corresponding linear translation matrix based on a preset optical platform, respectively, to achieve optimized translation of the word vector based on the linear translation matrix, and obtain a word vector corresponding to the second language; matching and searching in the word library based on the word vector corresponding to the second language to obtain a target word vector; decoding the target word vector to obtain a translated second language word image.
[0089] The processor-readable storage medium can be any available medium or data storage device that can be accessed by the processor, including but not limited to magnetic storage (such as floppy disks, hard disks, magnetic tapes, magneto-optical disks (MO), etc.), optical storage (such as CD, DVD, BD, HVD, etc.), and semiconductor storage (such as ROM, EPROM, EEPROM, non-volatile memory (NANDFLASH), solid-state drive (SSD)), etc.
[0090] The system embodiment described above is merely illustrative, wherein the units described as separate components may or may not be physically separated, and the components shown as units may or may not be physical units, that is, they may be located in one place, or they may be distributed on multiple network units. Some or all of the modules may be selected according to actual needs to achieve the purpose of the solution of this embodiment. Those of ordinary skill in the art may understand and implement it without creative work.
[0091] Through the description of the above implementation methods, those skilled in the art can clearly understand that each implementation method can be implemented by means of software plus a necessary general hardware platform, and of course, it can also be implemented by hardware. Based on this understanding, the above technical solution is essentially or the part that contributes to the prior art can be embodied in the form of a software product, and the computer software product can be stored in a computer-readable storage medium, such as ROM / RAM, a disk, an optical disk, etc., including a number of instructions for a computer device (which can be a personal computer, a server, or a network device, etc.) to execute the methods described in each embodiment or some parts of the embodiments.
[0092] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of the present invention, rather than to limit it. Although the present invention has been described in detail with reference to the aforementioned embodiments, those skilled in the art should understand that they can still modify the technical solutions described in the aforementioned embodiments, or make equivalent replacements for some of the technical features therein. However, these modifications or replacements do not deviate the essence of the corresponding technical solutions from the spirit and scope of the technical solutions of the embodiments of the present invention.
Claims
1. A linear machine translation method based on optical vector matrix, characterized in that: include: Acquire a first language word image to be translated, recognize the first language word image, and obtain image speckles corresponding to word phrases in the first language word image; Performing word vector encoding based on the image speckle to obtain a word vector corresponding to a word phrase; Based on a preset optical platform, the word vector and the corresponding linear translation matrix are loaded respectively to optimize the translation of the word vector based on the linear translation matrix to obtain the word vector corresponding to the second language; The linear translation matrix needs to be pre-trained to meet the application conditions, and is used to achieve the effect of translating the words in the entire vocabulary with a small amount of training data; if the total number of words in the language A dictionary is M, take m word vectors CodeA with a dimension of p; if the total number of words in the language B dictionary is N, take m word vectors with a dimension of q as CodeB; where M, N>>m; use CodeA and CodeB as training sets to train a linear translation matrix T, so that T*CodeA=CodeB, where CodeA and CodeB are aligned word vectors, and the meaning of the words corresponding to each row is the same; The word vector and the corresponding linear translation matrix are loaded based on the preset optical platform respectively, so as to optimize the translation of the word vector based on the linear translation matrix to obtain the word vector corresponding to the second language, specifically including: loading the word vector based on the amplitude type spatial light modulator in the optical platform, and loading the corresponding linear translation matrix based on the pure phase type spatial light modulator in the optical platform, and coherently superimposing the word vector and the linear translation matrix, and then superimposing them column by column using a cylindrical lens to obtain the word vector corresponding to the second language; Based on the word vector corresponding to the second language, a matching search is performed in the word library to obtain a target word vector; and the target word vector is decoded to obtain a translated second language word image.
2. The linear machine translation method based on optical vector matrix according to claim 1, characterized in that: Based on the word vector corresponding to the second language, a matching search is performed in the word library to obtain a target word vector, specifically including: Based on the Softmax logistic regression model, the word vector corresponding to the second language is compared with the word vector corresponding to the word in the vocabulary by cosine distance, and the target word vector with the shortest cosine distance to the word vector corresponding to the second language is retrieved.
3. The linear machine translation method based on optical vector matrix according to claim 1, characterized in that: The word vector encoding is performed based on the image speckle to obtain the word vector corresponding to the word phrase, specifically including: The image speckle is input into a Skip-Gram model for word vector encoding, and a word vector containing semantic information corresponding to the word phrase is obtained; wherein the Skip-Gram model is a linear word vector encoding model based on statistical probability.
4. The linear machine translation method based on optical vector matrix according to claim 1, characterized in that: Recognizing the first language word picture to obtain image speckles corresponding to word phrases in the first language word picture specifically includes: The first language word picture is recognized based on a transmission matrix of a random scattering medium to obtain image speckles corresponding to word phrases in the first language word picture.
5. The linear machine translation method based on optical vector matrix according to claim 1, characterized in that: The first language word picture is a handwritten picture containing a first language word phrase; the second language word picture is a picture containing a second language word phrase.
6. A linear machine translation system based on optical vector matrix, characterized in that: include: A handwriting image recognition module, used to obtain a first language word image to be translated, recognize the first language word image, and obtain image speckles corresponding to word phrases in the first language word image; A word vector encoding module, used for performing word vector encoding based on the image speckle to obtain a word vector corresponding to a word phrase; A word vector optimization translation module, used for loading the word vector and the corresponding linear translation matrix respectively based on a preset optical platform, so as to optimize the translation of the word vector based on the linear translation matrix and obtain the word vector corresponding to the second language; The linear translation matrix needs to be pre-trained to meet the application conditions, and is used to achieve the effect of translating words in the entire vocabulary with a small amount of training data; if the total number of words in the language A dictionary is M, take m word vectors CodeA with a dimension of p; if the total number of words in the language B dictionary is N, take m word vectors with a dimension of q as CodeB; where M, N>>m; CodeA and CodeB are used as training sets to train a linear translation matrix T, so that T*CodeA=CodeB, where CodeA and CodeB are aligned word vectors, and the meaning of the words corresponding to each row is the same; the word vector optimization translation module is specifically used to: load the word vector based on the amplitude-type spatial light modulator in the optical platform, and load the corresponding linear translation matrix based on the pure phase-type spatial light modulator in the optical platform, and coherently superimpose the word vector and the linear translation matrix, and then superimpose them column by column using a cylindrical lens to obtain the word vector corresponding to the second language; The word vector matching retrieval and decoding module is used to perform matching retrieval in the word library based on the word vector corresponding to the second language to obtain the target word vector; and decode the target word vector to obtain the translated second language word image.
7. An electronic device comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, characterized in that: When the processor executes the computer program, the steps of the linear machine translation method based on optical vector matrix as claimed in any one of claims 1 to 5 are implemented.
8. A processor-readable storage medium having a computer program stored thereon, characterized in that: When the computer program is executed by a processor, the steps of the linear machine translation method based on optical vector matrix as claimed in any one of claims 1 to 5 are implemented.
Citation Information
Patent Citations
Machine translation method and device
CN109446534A
Machine translation method and translation system thereof
CN112487833A