Sample dataset generation method, classifier training method, and image recognition method
Patent Information
- Application Number
- CN202611099675.5
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2026-07-23
- Publication Date
- 2026-10-16
AI Technical Summary
[0003]相关技术中,基于支持向量机、随机森林、卷积神经网络等方式实现图像识别,然而上述图像识别方式对于复杂度较高的图像识别任务,识别效率以及识别精度均较差,进而需要消耗过多计算资源
[0016] The seventh aspect of this disclosure also provides a computer program product, including a computer program or instructions that, when executed by a processor, implement the steps of the above-described method.
Smart Images

Figure CN122929318A_ABST
Abstract
Description
Technical Field
[0001] This disclosure relates to the field of data processing technology, specifically to a method for generating sample datasets, a method for training classifiers, and an image recognition method. Background Technology
[0002] Image recognition is widely used in autonomous driving, medical diagnosis, facial recognition, and other fields.
[0003] In related technologies, image recognition is achieved based on support vector machines, random forests, convolutional neural networks, etc. However, the above image recognition methods have poor recognition efficiency and accuracy for image recognition tasks with high complexity, thus requiring excessive computing resources. Summary of the Invention
[0004] In view of the above problems, this disclosure provides a method for generating sample datasets, a method for training classifiers, and an image recognition method.
[0005] According to a first aspect of this disclosure, a method for generating a sample dataset is provided, comprising: acquiring an initial dataset and initial samples, wherein the initial samples are obtained by mapping random vectors to a hybrid coding quantum coding space, and the initial dataset includes multiple images; encoding the images in the initial dataset to obtain target feature data; determining target samples that match the target feature data from the initial samples based on the matching results between the target feature data and the initial samples; fusing the target samples and the multiple images respectively to obtain target vectors corresponding to each of the multiple images; and determining a target dataset for training a classifier based on the target vectors corresponding to each of the multiple images.
[0006] According to embodiments of this disclosure, the initial sample includes multiple sub-samples, and the target feature data includes multiple target feature vectors corresponding to each of the multiple images. The process of determining a target sample matching the target feature data from the initial sample based on the matching result between the target feature data and the initial sample includes: determining first-dimensional pattern data and second-dimensional pattern data corresponding to each of the multiple sub-samples; for any target feature vector among the multiple target feature vectors corresponding to the image, matching the target feature vector with the first-dimensional pattern data and second-dimensional pattern data corresponding to each of the multiple sub-samples to obtain a matching result, the matching result representing the target first-dimensional pattern data and target second-dimensional pattern data corresponding to the target feature vector; determining the measurement basis vector corresponding to the target feature vector based on the target first-dimensional pattern data and target second-dimensional pattern data corresponding to the target feature vector; determining the target measurement basis vector based on the measurement basis vectors corresponding to each of the multiple target feature vectors; and determining the target sample from the initial sample based on the target measurement basis vector.
[0007] According to embodiments of this disclosure, determining a target measurement basis vector based on measurement basis vectors corresponding to each of the plurality of target feature vectors includes: determining the number of each of the plurality of measurement basis vectors and the total number of the plurality of measurement basis vectors based on the measurement basis vectors corresponding to each of the plurality of target feature vectors; determining frequency data of any measurement basis vector among the plurality of measurement basis vectors based on the ratio of the number of measurement basis vectors to the total number; and determining the target measurement basis vector from the plurality of measurement basis vectors based on the frequency data of each of the plurality of measurement basis vectors.
[0008] According to embodiments of this disclosure, encoding images in an initial dataset to obtain target feature data includes: reducing the dimensionality of the initial dataset to obtain first intermediate feature data that matches a first data dimension; expanding the first intermediate feature data to obtain second intermediate feature data that matches a second data dimension, wherein the second data dimension is higher than the first data dimension; and standardizing the second intermediate feature data to obtain target feature data.
[0009] According to embodiments of this disclosure, target samples and multiple images are fused to obtain target vectors corresponding to each of the multiple images, including: converting the format of the images to obtain array data corresponding to the images; and concatenating the array data corresponding to the images and the target samples to obtain target vectors corresponding to the images.
[0010] According to embodiments of this disclosure, target samples and multiple images are fused to obtain target vectors corresponding to each of the multiple images. The method further includes: determining target samples corresponding to each of the multiple initial samples when multiple initial samples exist; fusing the target samples corresponding to each of the multiple initial samples to obtain fused samples; and fusing the fused samples and multiple images to obtain target vectors corresponding to each of the multiple images.
[0011] A second aspect of this disclosure provides a method for training a classifier, comprising: acquiring a target dataset and data labels associated with the target dataset; performing image recognition on the target dataset using a classifier to be trained to obtain image recognition results; and adjusting the parameters of the classifier to be trained based on the difference between the image recognition results and the data labels to obtain a trained classifier.
[0012] A third aspect of this disclosure provides an image recognition method, comprising: acquiring an image to be recognized; and using a trained classifier to perform image recognition on the image to be recognized, thereby obtaining an image recognition result corresponding to the image to be recognized.
[0013] A fourth aspect of this disclosure provides a sample dataset generation apparatus, comprising: an acquisition module for acquiring an initial dataset and initial samples, wherein the initial samples are obtained by mapping random vectors to a hybrid coding quantum coding space, and the initial dataset includes multiple images; an encoding module for encoding the images in the initial dataset to obtain target feature data; a matching module for determining target samples that match the target feature data from the initial samples based on the matching results between the target feature data and the initial samples; a fusion module for fusing the target samples and the multiple images respectively to obtain target images corresponding to each of the multiple images; and a determination module for determining a target dataset for training a classifier based on the target images corresponding to each of the multiple images.
[0014] A fifth aspect of this disclosure provides an electronic device comprising: one or more processors; and a memory for storing one or more computer programs, wherein the one or more processors execute the one or more computer programs to implement the steps of the method described above.
[0015] A sixth aspect of this disclosure also provides a computer-readable storage medium having a computer program or instructions stored thereon, which, when executed by a processor, implement the steps of the above-described method.
[0016] The seventh aspect of this disclosure also provides a computer program product, including a computer program or instructions that, when executed by a processor, implement the steps of the above-described method.
[0017] According to embodiments of this disclosure, random vectors are mapped to a hybrid coding quantum coding space to obtain initial samples. The images in the initial dataset are further encoded to obtain target feature data, and the target feature data and initial samples are matched. Based on the matching results, target samples that match the data information of the target feature data, i.e., the pixel information of the images, are selected. Furthermore, the target samples and multiple images are fused separately to obtain target vectors corresponding to each of the multiple images. This allows the multiple images to retain their original information while adding more nonlinear high-dimensional information. Consequently, the target dataset obtained from the target images corresponding to each image, used for training the classifier, can improve classification accuracy during training. Moreover, the obtained target dataset possesses nonlinear high-dimensional information, eliminating the need for iterative training of its data dimensions, thereby reducing computational complexity. Attached Figure Description
[0018] The foregoing contents, as well as other objects, features, and advantages of this disclosure, will become clearer from the following description of embodiments with reference to the accompanying drawings, in which:
[0019] Figure 1This illustration schematically depicts an application scenario of the sample dataset generation method and apparatus according to embodiments of the present disclosure.
[0020] Figure 2 A flowchart illustrating a sample dataset generation method according to an embodiment of the present disclosure is shown schematically.
[0021] Figure 3 The illustration shows a schematic diagram of a sample dataset generation method and a classifier training method according to embodiments of the present disclosure;
[0022] Figure 4 A schematic diagram illustrating the evaluation of a classifier according to an embodiment of the present disclosure is shown.
[0023] Figure 5 A schematic diagram illustrating a sample dataset generation apparatus according to an embodiment of the present disclosure is shown; and
[0024] Figure 6 A block diagram schematically illustrates an electronic device suitable for implementing a sample dataset generation method according to an embodiment of the present disclosure. Detailed Implementation
[0025] The embodiments of the present disclosure will now be described with reference to the accompanying drawings. However, it should be understood that these descriptions are exemplary only and are not intended to limit the scope of the disclosure. In the following detailed description, numerous specific details are set forth to provide a thorough understanding of the embodiments of the present disclosure for ease of explanation. However, it will be apparent that one or more embodiments may be practiced without these specific details. Furthermore, descriptions of well-known structures and techniques are omitted in the following description to avoid unnecessarily obscuring the concepts of the present disclosure.
[0026] The terminology used herein is for the purpose of describing particular embodiments only and is not intended to limit this disclosure. The terms “comprising,” “including,” etc., as used herein indicate the presence of the stated features, steps, operations, and / or components, but do not exclude the presence or addition of one or more other features, steps, operations, or components.
[0027] All terms used herein (including technical and scientific terms) have the meanings commonly understood by those skilled in the art, unless otherwise defined. It should be noted that the terms used herein are to be interpreted in a manner consistent with the context of this specification, and not in an idealized or overly rigid way.
[0028] When using expressions such as "at least one of A, B and C", they should generally be interpreted in accordance with the meaning that is commonly understood by those skilled in the art (e.g., "a system having at least one of A, B and C" should include, but is not limited to, a system having A alone, a system having B alone, a system having C alone, a system having A and B, a system having A and C, a system having B and C, and / or a system having A, B and C, etc.).
[0029] Image recognition is widely used in autonomous driving, medical diagnosis, and facial recognition. Previously common image recognition schemes included Support Vector Machines (SVMs), Random Forests, and Convolutional Neural Networks (CNNs). However, these schemes have high computational complexity, making them unsuitable for real-time applications. To address this, Extreme Learning Machines (ELMs) were proposed, using fully connected layers with random weights as hidden layers to train the output layer, thus enabling rapid image recognition. Furthermore, some have attempted to implement this scheme using physics to improve computational speed. However, previous schemes have had low accuracy and require a high degree of programmability in the physical system.
[0030] Embodiments of this disclosure provide a method for generating a sample dataset. Random vectors are mapped to a hybrid coding quantum coding space to obtain initial samples. The images in the initial dataset are further encoded to obtain target feature data. The target feature data and the initial samples are then matched, allowing the selection of target samples that match the target feature data, i.e., the pixel information of the images. Furthermore, the target samples and multiple images are fused to obtain target vectors corresponding to each image. This allows the multiple images to retain their original information while adding more nonlinear high-dimensional information. Consequently, the target dataset obtained from the target images corresponding to each image, used for training a classifier, can improve classification accuracy during training. Moreover, the nonlinear high-dimensional information in the obtained target dataset eliminates the need for iterative training, thus reducing computational complexity.
[0031] Figure 1 The illustration shows an application scenario of the sample dataset generation method and apparatus according to embodiments of the present disclosure.
[0032] like Figure 1 As shown, application scenario 100 according to this embodiment may include a first terminal device 101, a second terminal device 102, a third terminal device 103, a network 104, and a server 105. The network 104 serves as a medium for providing a communication link between the first terminal device 101, the second terminal device 102, the third terminal device 103, and the server 105. The network 104 may include various connection types, such as wired or wireless communication links, or fiber optic cables, etc.
[0033] Users can use the first terminal device 101, the second terminal device 102, and the third terminal device 103 to interact with the server 105 via the network 104 to receive or send messages, etc. Various communication client applications can be installed on the first terminal device 101, the second terminal device 102, and the third terminal device 103, such as shopping applications, web browser applications, search applications, instant messaging tools, email clients, social media platform software, etc. (for example only).
[0034] The first terminal device 101, the second terminal device 102, and the third terminal device 103 can be various electronic devices with displays and support web browsing, including but not limited to smartphones, tablets, laptops, and desktop computers.
[0035] Server 105 can be a server that provides various services, such as a backend management server that supports websites browsed by users using the first terminal device 101, the second terminal device 102, and the third terminal device 103 (this is just an example). The backend management server can analyze and process data such as received user requests, and feed back the processing results (such as web pages, information, or data obtained or generated according to user requests) to the terminal devices.
[0036] It should be noted that the sample dataset generation method provided in this embodiment can generally be executed by server 105. Correspondingly, the sample dataset generation apparatus provided in this embodiment can generally be located in server 105. The sample dataset generation method provided in this embodiment can also be executed by a server or server cluster that is different from server 105 and capable of communicating with the first terminal device 101, the second terminal device 102, the third terminal device 103, and / or server 105. Correspondingly, the sample dataset generation apparatus provided in this embodiment can also be located in a server or server cluster that is different from server 105 and capable of communicating with the first terminal device 101, the second terminal device 102, the third terminal device 103, and / or server 105.
[0037] It should be understood that Figure 1 The number of terminal devices, networks, and servers shown is merely illustrative. Depending on implementation needs, any number of terminal devices, networks, and servers can be included.
[0038] The following will be based on Figure 1 The scenario described herein provides a detailed description of the sample dataset generation method of the disclosed embodiments.
[0039] Figure 2 A flowchart illustrating a sample dataset generation method according to an embodiment of the present disclosure is shown schematically.
[0040] like Figure 2 As shown, the sample dataset generation method of this embodiment includes operations S210 to S250.
[0041] In operation S210, an initial dataset and initial samples are obtained. The initial samples are obtained by mapping random vectors to a hybrid coding quantum coding space. The initial dataset includes multiple images.
[0042] In operation S220, the images of the initial dataset are encoded to obtain target feature data.
[0043] In operation S230, based on the matching result between the target feature data and the initial sample, the target sample that matches the target feature data is determined from the initial sample.
[0044] In operation S240, the target sample and multiple images are fused to obtain the target vector corresponding to each of the multiple images.
[0045] In operation S250, the target dataset for training the classifier is determined based on the target vectors corresponding to each of the multiple images.
[0046] The initial dataset includes multiple images, among which a preset image may be included. In some embodiments, the multiple images do not include the preset image, which may be an image whose pixels are relatively similar to those of the multiple images.
[0047] The hybrid coding quantum coding space is a joint Hilbert space constructed by simultaneously utilizing both time and space coding methods. In the process of constructing the hybrid coding quantum coding space, the above-mentioned coding is performed on a preset image.
[0048] After obtaining the hybrid coding quantum coding space, the random vector is mapped to the hybrid coding quantum coding space.
[0049] The more initial samples a model has, the more accurate the mapping will be. However, using more samples also increases the time required to generate samples and statistical results. When the number of initial samples exceeds a preset value, the accuracy remains almost unchanged. The number of initial samples can be determined based on a preset value to achieve good model performance while maintaining a balance between performance and time cost.
[0050] Encoding the images in the initial dataset can be done by encoding the image dimensions of multiple images in the initial dataset separately, resulting in multiple encoded images, which are then used as target feature data.
[0051] Matching the target feature data with the initial sample can be done by matching the target feature data with the first-dimensional pattern data and the second-dimensional pattern data corresponding to the initial sample to obtain the matching result between the target feature data and the initial sample. The first-dimensional pattern data can be spatial pattern data, and the second-dimensional pattern data can be temporal pattern data.
[0052] After obtaining the matching results between the target feature data and the initial samples, the target samples that match the target feature data are determined from the initial samples based on the matching results.
[0053] The target sample and multiple images can be fused separately, or the target sample and multiple images can be stitched together separately, and the stitched image can be used as the target vector corresponding to each of the multiple images.
[0054] After obtaining the target vectors corresponding to each of the multiple images, the target vectors corresponding to each of the multiple images are used as the target dataset for training the classifier. Among them, part of the target vectors in the target dataset are used as the training dataset, and the other part of the target vectors are used as the test dataset.
[0055] According to embodiments of this disclosure, a random vector is mapped to a hybrid coding quantum coding space to obtain an initial sample. The images in the initial dataset are further encoded to obtain target feature data, and the target feature data and the initial samples are matched. Based on the matching results, target samples that match the data information of the target feature data, i.e., the pixel information of the images, are selected. Furthermore, the target samples and multiple images are fused separately to obtain target vectors corresponding to each of the multiple images. This allows the multiple images to retain their original information while adding more nonlinear high-dimensional information. Consequently, the target dataset obtained from the target images corresponding to each of the multiple images, used for training the classifier, can improve the classification accuracy during training. Moreover, the obtained target dataset possesses nonlinear high-dimensional information, eliminating the need for iterative training of its data dimensions, thereby reducing computational complexity.
[0056] According to embodiments of this disclosure, the initial sample includes multiple sub-samples, and the target feature data includes multiple target feature vectors corresponding to each of the multiple images. The process of determining a target sample matching the target feature data from the initial sample based on the matching result between the target feature data and the initial sample includes: determining first-dimensional pattern data and second-dimensional pattern data corresponding to each of the multiple sub-samples; for any target feature vector among the multiple target feature vectors corresponding to the image, matching the target feature vector with the first-dimensional pattern data and second-dimensional pattern data corresponding to each of the multiple sub-samples to obtain a matching result, the matching result representing the target first-dimensional pattern data and target second-dimensional pattern data corresponding to the target feature vector; determining the measurement basis vector corresponding to the target feature vector based on the target first-dimensional pattern data and target second-dimensional pattern data corresponding to the target feature vector; determining the target measurement basis vector based on the measurement basis vectors corresponding to each of the multiple target feature vectors; and determining the target sample from the initial sample based on the target measurement basis vector.
[0057] Determine the spatial pattern data (i.e., first-dimensional pattern data) and temporal pattern data (i.e., second-dimensional pattern data) corresponding to each of the multiple subsamples. For example, the initial sample includes 9 million subsamples, of which the spatial pattern data and temporal pattern data corresponding to each of the multiple subsamples may include 511 temporal pattern data and 16 spatial pattern data.
[0058] Matching the target feature vector with the spatial pattern data (i.e., first-dimensional pattern data) and temporal pattern data (i.e., second-dimensional pattern data) corresponding to each of the multiple subsamples can be achieved by mapping the target feature vector to the GBS pattern selection, assigning the target feature vector to a spatial pattern data, and determining the temporal pattern data based on the target feature vector value of that target feature vector. For example, if the target feature vector value of the i-th target feature vector is j, then the matching result is determined to be the i-th target spatial pattern data and the j-th target temporal pattern data.
[0059] Furthermore, after obtaining the matching results, based on the target spatial pattern data (i.e., the target first-dimensional pattern data) and the target temporal pattern data (i.e., the target second-dimensional pattern data) corresponding to the target feature vector, the coordinate axis data of the measurement basis vector composed of the target spatial pattern data and the target temporal pattern data are determined, so as to determine the measurement basis vector.
[0060] After determining the measurement basis vectors corresponding to each of the multiple target feature vectors, the measurement basis vectors corresponding to each of the multiple target feature vectors may be the same or different. For example, there may be at least two target feature vectors that have the same measurement basis vector. The multiple measurement basis vectors have different degrees of importance, so the multiple measurement basis vectors are screened to select the target measurement basis vector.
[0061] After obtaining the target measurement basis vector, the target sample is determined from the initial sample based on the target measurement basis vector.
[0062] According to embodiments of this disclosure, determining a target measurement basis vector based on measurement basis vectors corresponding to each of the plurality of target feature vectors includes: determining the number of each of the plurality of measurement basis vectors and the total number of the plurality of measurement basis vectors based on the measurement basis vectors corresponding to each of the plurality of target feature vectors; determining frequency data of any measurement basis vector among the plurality of measurement basis vectors based on the ratio of the number of measurement basis vectors to the total number; and determining the target measurement basis vector from the plurality of measurement basis vectors based on the frequency data of each of the plurality of measurement basis vectors.
[0063] Determine the number of each of the multiple different measurement basis vectors in the measurement basis vectors corresponding to the multiple target feature vectors.
[0064] Furthermore, based on the ratio of the number of measurement basis vectors to the total number, the proportion of different measurement basis vectors in the total number of measurement basis vectors is determined, so as to determine the frequency of occurrence of different measurement basis vectors in the total number of measurement basis vectors, i.e., frequency data.
[0065] Furthermore, based on the frequency data of each of the multiple measurement basis vectors, the measurement basis vector with the higher frequency of occurrence in the total measurement basis vectors is determined from the multiple measurement basis vectors and used as the target measurement basis vector.
[0066] According to embodiments of this disclosure, since an increase in the number of measurement basis vectors requires excessive computational resources, by filtering the measurement basis vectors, target measurement basis vectors of higher importance can be selected, thereby improving accuracy while reducing computational burden.
[0067] According to embodiments of this disclosure, encoding images in an initial dataset to obtain target feature data includes: reducing the dimensionality of the initial dataset to obtain first intermediate feature data that matches a first data dimension; expanding the first intermediate feature data to obtain second intermediate feature data that matches a second data dimension, wherein the second data dimension is higher than the first data dimension; and standardizing the second intermediate feature data to obtain target feature data.
[0068] Dimensionality reduction of the initial dataset can be achieved by reducing the dimensionality of multiple images in the initial dataset separately, reducing the dimensionality of each image to the first data dimension, and obtaining the first intermediate feature data that matches the first data dimension.
[0069] One dimensionality reduction method is Principal Component Analysis (PCA) supplemented with the sigmoid activation function. PCA dimensionality reduction is a linear transformation that recombines multiple variables (features) of an image into a small number of independent new variables (called principal components) while preserving as much variance (information) as possible in the image.
[0070] In some embodiments, the initial dataset is dimensionality reduced so that the dimension of the initial dataset matches the preset number of modes (e.g., the number of dimensional 1 modes) of the hybrid-encoded quantum system. For example, the first data dimension can be 32-dimensional, so that the dimension of the first intermediate feature data matches the number of spatial modes 16 of the spatiotemporal hybrid-encoded quantum system.
[0071] Expanding the first intermediate feature data can be achieved by matching the dimension of the first intermediate feature data with another preset number of modes (e.g., the number of modes in dimension 2) of the hybrid encoded quantum system, i.e., the second data dimension, to obtain the second intermediate feature data that matches the second data dimension.
[0072] Standardizing the second intermediate feature data can be achieved by rounding down the second intermediate feature data to obtain the target feature data.
[0073] According to embodiments of this disclosure, dimensionality reduction of the initial dataset enables the data dimension of the initial dataset to match the data dimension of the hybrid coding quantum system. Further expansion of the first intermediate feature data enables the data dimension of the first intermediate feature data to be increased under the hybrid coding quantum system, thereby improving the matching accuracy with the initial sample.
[0074] According to embodiments of this disclosure, target samples and multiple images are fused to obtain target vectors corresponding to each of the multiple images, including: converting the format of the images to obtain array data corresponding to the images; and concatenating the array data corresponding to the images and the target samples to obtain target vectors corresponding to the images.
[0075] Image format conversion can be performed by flattening the image into a 1-dimensional array to obtain the array data corresponding to the image.
[0076] After obtaining the array data corresponding to the image, the array data corresponding to the image and the target sample are concatenated to obtain the target array data corresponding to the image, that is, the target vector corresponding to the image.
[0077] According to embodiments of this disclosure, the array data corresponding to the image and the target sample are concatenated to obtain the target array data corresponding to the image. This can increase the dimensionality of the array data corresponding to the image, so that the target array data corresponding to the image can add more non-linear high-dimensional information while retaining the original information, thereby improving the classification accuracy.
[0078] According to embodiments of this disclosure, target samples and multiple images are fused to obtain target images corresponding to each of the multiple images. The method further includes: determining target samples corresponding to each of the multiple initial samples when multiple initial samples exist; fusing the target samples corresponding to each of the multiple initial samples to obtain fused samples; and fusing the fused samples and multiple images to obtain target vectors corresponding to each of the multiple images.
[0079] In the case of multiple initial samples, based on the above operations S210 to S230, target samples corresponding to each of the multiple initial samples are obtained.
[0080] Furthermore, fusing the target samples corresponding to each of the multiple initial samples can be achieved by splicing the target samples corresponding to each of the multiple initial samples together to obtain the fused sample.
[0081] After obtaining the fused sample, during the execution of the above operation S240, the fusion of the target sample and multiple images will be replaced by the fusion of the fused sample and multiple images, thereby obtaining the target vector corresponding to each of the multiple images.
[0082] According to embodiments of this disclosure, target samples corresponding to multiple initial samples are fused to obtain fused samples, thereby obtaining high-precision samples. This makes the nonlinear high-dimensional information of the target vector obtained by fusing the fused samples and multiple images more accurate and reasonable.
[0083] A second aspect of this disclosure provides a method for training a classifier, comprising: acquiring a target dataset and data labels associated with the target dataset; performing image recognition on the target dataset using a classifier to be trained to obtain image recognition results; and adjusting the parameters of the classifier to be trained based on the difference between the image recognition results and the data labels to obtain a trained classifier.
[0084] Obtain the target dataset, and use the classifier to be trained to perform image recognition on the training dataset in the target dataset to obtain the image recognition results.
[0085] After obtaining the image recognition results, the image recognition results and data labels are compared to confirm the differences between the image recognition results and data labels, thereby determining the loss value.
[0086] Furthermore, based on the obtained loss value, the parameters of the classifier to be trained are adjusted until the loss value of the classifier after parameter adjustment is less than or equal to the preset loss value, thus obtaining the trained classifier.
[0087] After obtaining the trained classifier, the trained classifier is used to perform image recognition on the test dataset in the target dataset to obtain the test image recognition results. If the difference between the test image recognition results and the data labels is small, the trained classifier can be put into use.
[0088] Figure 3 The diagram illustrates a sample dataset generation method and a classifier training method according to embodiments of the present disclosure.
[0089] like Figure 3 As shown, after obtaining the initial dataset, the initial dataset is encoded to obtain the target feature data (including the dimensionality-reduced image feature data of the training dataset and the test dataset in the initial dataset).
[0090] Using a spatiotemporal coding interferometer, the compressed state's random vectors are mapped to a hybrid coding quantum coding space to obtain initial samples. Further, temporal pattern matching is performed between the target feature data and the initial samples; that is, the spatial pattern data (i.e., first-dimensional pattern data) and temporal pattern data (i.e., second-dimensional pattern data) corresponding to the target feature data and the initial samples are matched to obtain measurement basis vectors (i.e., determined by the target spatial pattern data (i.e., target first-dimensional pattern data) and target temporal pattern data (i.e., target second-dimensional pattern data) indicated by the matching results). Further, based on the measurement basis vectors corresponding to each of the multiple target feature vectors, the target measurement basis vector is determined; based on the target measurement basis vector, the target sample is determined from the initial samples.
[0091] The target samples and the initial dataset are fused to obtain target images corresponding to each of the multiple images, and the target dataset is determined based on the target images corresponding to each of the multiple images.
[0092] The classifier is trained based on the target dataset. This involves using the classifier to perform image recognition on the target dataset, outputting prediction results, and updating the classifier's parameters based on the prediction results to obtain the trained classifier.
[0093] Figure 4 A schematic diagram illustrating the evaluation of a classifier according to an embodiment of the present disclosure is shown.
[0094] like Figure 4As shown, the numbers on the diagonal of the confusion matrix represent the number of correctly predicted images by the classifier, while the numbers in other positions represent the number of incorrectly predicted images by the classifier. It can be seen that the trained classifier achieves a high accuracy rate when performing image recognition.
[0095] A third aspect of this disclosure provides an image recognition method, comprising: acquiring an image to be recognized; and using a trained classifier to perform image recognition on the image to be recognized, thereby obtaining an image recognition result corresponding to the image to be recognized.
[0096] Based on the above-described sample dataset generation method, this disclosure also provides a sample dataset generation apparatus. The following will be combined with... Figure 5 The device is described in detail.
[0097] Figure 5 A schematic block diagram of a sample dataset generation apparatus according to an embodiment of the present disclosure is shown.
[0098] like Figure 5 As shown, the sample dataset generation device 500 of this embodiment includes an acquisition module 510, an encoding module 520, a matching module 530, a fusion module 540, and a determination module 550.
[0099] The acquisition module 510 is used to acquire an initial dataset and initial samples. The initial samples are obtained by mapping random vectors to a hybrid coding quantum coding space. The initial samples represent a pixel matrix that matches the probability distribution of pixels in a preset image. The initial dataset includes multiple images. In one embodiment, the acquisition module 510 can be used to perform the operation S210 described above, which will not be repeated here.
[0100] The encoding module 520 is used to encode the images in the initial dataset to obtain target feature data. In one embodiment, the encoding module 520 can be used to perform the operation S220 described above, which will not be repeated here.
[0101] The matching module 530 is used to determine target samples that match the target feature data from the initial samples based on the matching results between the target feature data and the initial samples. In one embodiment, the matching module 530 can be used to perform the operation S230 described above, which will not be repeated here.
[0102] The fusion module 540 is used to fuse the target sample and multiple images respectively to obtain target vectors corresponding to each of the multiple images. In one embodiment, the fusion module 540 can be used to perform the operation S240 described above, which will not be repeated here.
[0103] The determination module 550 is used to determine the target dataset for training the classifier based on the target vectors corresponding to each of the multiple images. In one embodiment, the determination module 550 may be used to perform the operation S250 described above, which will not be repeated here.
[0104] According to embodiments of this disclosure, random vectors are mapped to a hybrid coding quantum coding space to obtain initial samples. The images in the initial dataset are further encoded to obtain target feature data, and the target feature data and initial samples are matched. Based on the matching results, target samples that match the data information of the target feature data, i.e., the pixel information of the images, are selected. Furthermore, the target samples and multiple images are fused separately to obtain target vectors corresponding to each of the multiple images. This allows the multiple images to retain their original information while adding more nonlinear high-dimensional information. Consequently, the target dataset obtained from the target images corresponding to each image, used for training the classifier, can improve classification accuracy during training. Moreover, the obtained target dataset possesses nonlinear high-dimensional information, eliminating the need for iterative training of its data dimensions, thereby reducing computational complexity.
[0105] According to embodiments of this disclosure, the matching module 530 includes a first determining submodule, a matching submodule, a second determining submodule, a third determining submodule, and a fourth determining submodule.
[0106] The first determination submodule is used to determine the first-dimensional pattern data and the second-dimensional pattern data corresponding to each of the multiple subsamples.
[0107] The matching submodule is used to match any target feature vector among multiple target feature vectors corresponding to the image with the target feature vector and the first-dimensional pattern data and second-dimensional pattern data corresponding to each of the multiple subsamples, respectively, to obtain the matching result. The matching result represents the first-dimensional pattern data and the second-dimensional pattern data of the target corresponding to the target feature vector.
[0108] The second determination submodule is used to determine the measurement basis vector corresponding to the target feature vector based on the target first-dimensional pattern data and the target second-dimensional pattern data corresponding to the target feature vector.
[0109] The third determination submodule is used to determine the target measurement basis vector based on the measurement basis vectors corresponding to each of the multiple target feature vectors.
[0110] The fourth determination submodule is used to determine the target sample from the initial sample based on the target measurement basis vector.
[0111] According to embodiments of this disclosure, the third determining submodule includes a first determining unit, a second determining unit, and a third determining unit.
[0112] The first determining unit is used to determine the number of each of the multiple measurement basis vectors and the total number of the multiple measurement basis vectors based on the measurement basis vectors corresponding to each of the multiple target feature vectors.
[0113] The second determining unit is used to determine the frequency data of any one of the multiple measurement basis vectors based on the ratio of the number of measurement basis vectors to the total number.
[0114] The third determining unit is used to determine the target measurement basis from the multiple measurement basis based on the frequency data of each of the multiple measurement basis.
[0115] According to embodiments of this disclosure, the encoding module 520 includes a dimensionality reduction submodule, an extension submodule, and a standardization submodule.
[0116] The dimensionality reduction submodule is used to reduce the dimensionality of the initial dataset to obtain the first intermediate feature data that matches the first data dimension.
[0117] An extension submodule is used to extend the first intermediate feature data to obtain second intermediate feature data that matches the second data dimension, where the second data dimension is higher than the first data dimension.
[0118] The standardization submodule is used to standardize the second intermediate feature data to obtain the target feature data.
[0119] According to embodiments of this disclosure, the fusion module 540 includes a first conversion submodule and a splicing submodule.
[0120] The first conversion submodule is used to convert the format of the image and obtain the array data corresponding to the image.
[0121] The stitching submodule is used to stitch together the array data corresponding to the image and the target sample to obtain the target vector corresponding to the image.
[0122] According to embodiments of this disclosure, the fusion module 540 includes a fifth determining submodule, a first fusion submodule, and a second fusion submodule.
[0123] The fifth determination submodule is used to determine the target sample corresponding to each of the multiple initial samples when multiple initial samples exist.
[0124] The first fusion submodule is used to fuse the target samples corresponding to multiple initial samples to obtain fused samples.
[0125] The second fusion submodule is used to fuse the fusion sample and multiple images respectively to obtain the target image corresponding to each of the multiple images.
[0126] According to embodiments of this disclosure, any multiple modules among the acquisition module 510, encoding module 520, matching module 530, fusion module 540, and determination module 550 can be combined into one module, or any one of these modules can be split into multiple modules. Alternatively, at least some of the functions of one or more of these modules can be combined with at least some of the functions of other modules and implemented in one module. According to embodiments of this disclosure, at least one of the acquisition module 510, encoding module 520, matching module 530, fusion module 540, and determination module 550 can be at least partially implemented as hardware circuitry, such as a field-programmable gate array (FPGA), a programmable logic array (PLA), a system-on-a-chip, a system-on-a-substrate, a system-on-package, an application-specific integrated circuit (ASIC), or implemented in hardware or firmware by any other reasonable means of integrating or packaging circuitry, or implemented in software, hardware, or firmware, or in any suitable combination of any of these three implementation methods. Alternatively, at least one of the acquisition module 510, encoding module 520, matching module 530, fusion module 540, and determination module 550 may be implemented at least partially as a computer program module that can perform corresponding functions when the computer program module is run.
[0127] Figure 6 A block diagram schematically illustrates an electronic device suitable for implementing a sample dataset generation method according to an embodiment of the present disclosure.
[0128] like Figure 6 As shown, an electronic device 600 according to an embodiment of this disclosure includes a processor 601, which can perform various appropriate actions and processes according to a program stored in a read-only memory (ROM) 602 or a program loaded from a storage portion 608 into a random access memory (RAM) 603. The processor 601 may include, for example, a general-purpose microprocessor (e.g., a CPU), an instruction set processor and / or an associated chipset and / or a special-purpose microprocessor (e.g., an application-specific integrated circuit (ASIC)), etc. The processor 601 may also include onboard memory for caching purposes. The processor 601 may include a single processing unit or multiple processing units for performing different actions of the method flow according to an embodiment of this disclosure.
[0129] RAM 603 stores various programs and data required for the operation of electronic device 600. Processor 601, ROM 602, and RAM 603 are interconnected via bus 604. Processor 601 performs various operations of the method flow according to embodiments of the present disclosure by executing programs in ROM 602 and / or RAM 603. It should be noted that the programs may also be stored in one or more memories other than ROM 602 and RAM 603. Processor 601 may also perform various operations of the method flow according to embodiments of the present disclosure by executing programs stored in said one or more memories.
[0130] According to embodiments of this disclosure, the electronic device 600 may further include an input / output (I / O) interface 605, which is also connected to a bus 604. The electronic device 600 may also include one or more of the following components connected to the input / output (I / O) interface 605: an input section 606 including a keyboard, mouse, etc.; an output section 607 including a cathode ray tube (CRT), liquid crystal display (LCD), etc., and a speaker, etc.; a storage section 608 including a hard disk, etc.; and a communication section 609 including a network interface card such as a LAN card, modem, etc. The communication section 609 performs communication processing via a network such as the Internet. A drive 610 is also connected to the input / output (I / O) interface 605 as needed. A removable medium 611, such as a disk, optical disk, magneto-optical disk, semiconductor memory, etc., is installed on the drive 610 as needed so that computer programs read from it can be installed into the storage section 608 as needed.
[0131] This disclosure also provides a computer-readable storage medium, which may be included in the device / apparatus / system described in the above embodiments; or it may exist independently and not assembled into the device / apparatus / system. The computer-readable storage medium carries one or more programs that, when executed, implement the method according to the embodiments of this disclosure.
[0132] According to embodiments of this disclosure, the computer-readable storage medium may be a non-volatile computer-readable storage medium, such as including, but not limited to: portable computer disks, hard disks, random access memory (RAM), read-only memory (ROM), erasable programmable read-only memory (EPROM or flash memory), portable compact disk read-only memory (CD-ROM), optical storage devices, magnetic storage devices, or any suitable combination thereof. In this disclosure, the computer-readable storage medium may be any tangible medium that contains or stores a program that can be used by or in conjunction with an instruction execution system, apparatus, or device. For example, according to embodiments of this disclosure, the computer-readable storage medium may include ROM 602 and / or RAM 603 and / or one or more memories other than ROM 602 and RAM 603 described above.
[0133] Embodiments of this disclosure also include a computer program product comprising a computer program containing program code for performing the methods shown in the flowchart. When the computer program product is run on a computer system, the program code is used to cause the computer system to implement the sample dataset generation method provided in the embodiments of this disclosure.
[0134] When the computer program is executed by the processor 601, it performs the functions defined in the system / apparatus of this disclosure embodiments. According to embodiments of this disclosure, the systems, apparatuses, modules, units, etc., described above can be implemented by computer program modules.
[0135] In one embodiment, the computer program may rely on a tangible storage medium such as an optical storage device or a magnetic storage device. In another embodiment, the computer program may also be transmitted and distributed in the form of signals over a network medium, and downloaded and installed via the communication section 609, and / or installed from the removable medium 611. The program code contained in the computer program can be transmitted using any suitable network medium, including but not limited to: wireless, wired, etc., or any suitable combination thereof.
[0136] In such an embodiment, the computer program can be downloaded and installed from a network via the communication section 609, and / or installed from the removable medium 611. When the computer program is executed by the processor 601, it performs the functions defined in the system of this disclosure embodiment. According to embodiments of this disclosure, the systems, devices, apparatuses, modules, units, etc., described above can be implemented by computer program modules.
[0137] According to embodiments of this disclosure, program code for executing the computer programs provided in embodiments of this disclosure can be written in any combination of one or more programming languages. Specifically, these computational programs can be implemented using high-level procedural and / or object-oriented programming languages, and / or assembly / machine languages. Programming languages include, but are not limited to, languages such as Java, C++, Python, "C", or similar programming languages. The program code can execute entirely on a user's computing device, partially on a user's device, partially on a remote computing device, or entirely on a remote computing device or server. In cases involving remote computing devices, the remote computing device can be connected to the user's computing device via any type of network, including a local area network (LAN) or a wide area network (WAN), or it can be connected to an external computing device (e.g., via the Internet using an Internet service provider).
[0138] The flowcharts and block diagrams in the accompanying drawings illustrate the architecture, functionality, and operation of possible implementations of systems, methods, and computer program products according to various embodiments of this disclosure. In this regard, each block in a flowchart or block diagram may represent a module, segment, or portion of code containing one or more executable instructions for implementing a specified logical function. It should also be noted that in some alternative implementations, the functions indicated in the blocks may occur in a different order than those indicated in the drawings. For example, two consecutively indicated blocks may actually be executed substantially in parallel, and they may sometimes be executed in reverse order, depending on the functions involved. It should also be noted that each block in a block diagram or flowchart, and combinations of blocks in a block diagram or flowchart, may be implemented using a dedicated hardware-based system that performs the specified function or operation, or using a combination of dedicated hardware and computer instructions.
[0139] Those skilled in the art will understand that the features described in the various embodiments of this disclosure can be combined and / or combined in various ways, even if such combinations or combinations are not explicitly described in this disclosure. In particular, the features described in the various embodiments of this disclosure can be combined and / or combined in various ways without departing from the spirit and teachings of this disclosure. All such combinations and / or combinations fall within the scope of this disclosure.
[0140] The embodiments of this disclosure have been described above. However, these embodiments are for illustrative purposes only and are not intended to limit the scope of this disclosure. Although various embodiments have been described above, this does not mean that the measures in the various embodiments cannot be used advantageously in combination. Various substitutions and modifications can be made by those skilled in the art without departing from the scope of this disclosure, and all such substitutions and modifications should fall within the scope of this disclosure.
Claims
1. A method for generating a sample dataset, characterized in that, The method includes: An initial dataset and initial samples are obtained, wherein the initial samples are obtained by mapping random vectors to a hybrid coding quantum coding space, and the initial dataset includes multiple images; The images in the initial dataset are encoded to obtain target feature data; Based on the matching result between the target feature data and the initial sample, a target sample that matches the target feature data is determined from the initial sample; The target sample and the multiple images are fused respectively to obtain a target vector corresponding to each of the multiple images; The target dataset for training the classifier is determined based on the target vectors corresponding to each of the multiple images.
2. The method according to claim 1, characterized in that, The initial sample includes multiple sub-samples, and the target feature data includes multiple target feature vectors corresponding to each of the multiple images; The step of determining a target sample that matches the target feature data from the initial sample based on the matching result between the target feature data and the initial sample includes: Determine the first-dimensional pattern data and the second-dimensional pattern data corresponding to each of the multiple sub-samples; For any one of the multiple target feature vectors corresponding to the image, the target feature vector and the first-dimensional pattern data and the second-dimensional pattern data corresponding to each of the multiple subsamples are matched respectively to obtain a matching result. The matching result represents the target first-dimensional pattern data and the second-dimensional pattern data corresponding to the target feature vector. Based on the target first-dimensional pattern data and target second-dimensional pattern data corresponding to the target feature vector, determine the measurement basis vector corresponding to the target feature vector; Determine the target measurement basis vector based on the measurement basis vectors corresponding to each of the multiple target feature vectors; The target sample is determined from the initial sample based on the target measurement basis vector.
3. The method according to claim 2, characterized in that, The step of determining the target measurement basis vector based on the measurement basis vectors corresponding to each of the plurality of target feature vectors includes: Based on the measurement basis vectors corresponding to each of the multiple target feature vectors, determine the number of each of the multiple measurement basis vectors, and the total number of the multiple measurement basis vectors; For any one of the multiple measurement basis vectors, the frequency data of the measurement basis vector is determined according to the ratio of the number of measurement basis vectors to the total number; The target measurement basis is determined from the plurality of measurement basis vectors based on the frequency data of each of the plurality of measurement basis vectors.
4. The method according to claim 1, characterized in that, The process of encoding the images in the initial dataset to obtain target feature data includes: The initial dataset is dimensionality reduced to obtain first intermediate feature data that matches the first data dimension; The first intermediate feature data is expanded to obtain second intermediate feature data that matches the second data dimension, where the second data dimension is higher than the first data dimension. The second intermediate feature data is standardized to obtain the target feature data.
5. The method according to claim 1, characterized in that, The step of fusing the target sample and the multiple images respectively to obtain a target vector corresponding to each of the multiple images includes: The image is converted to a different format to obtain array data corresponding to the image; The array data corresponding to the image and the target sample are concatenated to obtain the target vector corresponding to the image.
6. The method according to claim 1, characterized in that, The step of fusing the target sample and the multiple images respectively to obtain a target image corresponding to each of the multiple images further includes: In the presence of multiple initial samples, a target sample corresponding to each of the multiple initial samples is determined; The target samples corresponding to the multiple initial samples are fused to obtain a fused sample; The fused sample and the multiple images are fused respectively to obtain the target vector corresponding to each of the multiple images.
7. A method for training a classifier, characterized in that, The method includes: Obtain the target dataset as described in any one of claims 1-6, and the data labels associated with the target dataset; The target dataset is used to perform image recognition using the classifier to be trained, and the image recognition results are obtained. Based on the difference between the image recognition result and the data label, the parameters of the classifier to be trained are adjusted to obtain a trained classifier.
8. An image recognition method, characterized in that, The method includes: Acquire the image to be recognized; The trained classifier as described in claim 7 is used to perform image recognition on the image to be recognized, thereby obtaining an image recognition result corresponding to the image to be recognized.
9. A sample dataset generation device, characterized in that, The device includes: An acquisition module is used to acquire an initial dataset and initial samples. The initial samples are obtained by mapping random vectors to a hybrid coding quantum coding space. The initial dataset includes multiple images. The encoding module is used to encode the images in the initial dataset to obtain target feature data; A matching module is used to determine a target sample that matches the target feature data from the initial sample based on the matching result between the target feature data and the initial sample; A fusion module is used to fuse the target sample and the multiple images respectively to obtain a target image corresponding to each of the multiple images; and The determination module is used to determine the target dataset for training the classifier based on the target images corresponding to each of the plurality of images.
10. An electronic device, comprising: One or more processors; Memory, used to store one or more computer programs. The characteristic feature is that the one or more processors execute the one or more computer programs to implement the steps of the method according to any one of claims 1 to 8.