WO2022206092A1 - Quantum kernel method-based image classification method and apparatus, server, and system - Google Patents

Quantum kernel method-based image classification method and apparatus, server, and system Download PDF

Info

Publication number
WO2022206092A1
WO2022206092A1 PCT/CN2022/070264 CN2022070264W WO2022206092A1 WO 2022206092 A1 WO2022206092 A1 WO 2022206092A1 CN 2022070264 W CN2022070264 W CN 2022070264W WO 2022206092 A1 WO2022206092 A1 WO 2022206092A1
Authority
WO
WIPO (PCT)
Prior art keywords
matrix
kernel
quantum
indeterminate
eigenvalue
Prior art date
Application number
PCT/CN2022/070264
Other languages
French (fr)
Chinese (zh)
Inventor
杜宇轩
王新彪
陶大程
罗勇
Original Assignee
北京沃东天骏信息技术有限公司
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by 北京沃东天骏信息技术有限公司 filed Critical 北京沃东天骏信息技术有限公司
Publication of WO2022206092A1 publication Critical patent/WO2022206092A1/en

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06NCOMPUTING ARRANGEMENTS BASED ON SPECIFIC COMPUTATIONAL MODELS
    • G06N10/00Quantum computing, i.e. information processing based on quantum-mechanical phenomena
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06NCOMPUTING ARRANGEMENTS BASED ON SPECIFIC COMPUTATIONAL MODELS
    • G06N10/00Quantum computing, i.e. information processing based on quantum-mechanical phenomena
    • G06N10/20Models of quantum computing, e.g. quantum circuits or universal quantum computers
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06VIMAGE OR VIDEO RECOGNITION OR UNDERSTANDING
    • G06V10/00Arrangements for image or video recognition or understanding
    • G06V10/20Image preprocessing
    • G06V10/30Noise filtering
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06VIMAGE OR VIDEO RECOGNITION OR UNDERSTANDING
    • G06V10/00Arrangements for image or video recognition or understanding
    • G06V10/70Arrangements for image or video recognition or understanding using pattern recognition or machine learning
    • G06V10/764Arrangements for image or video recognition or understanding using pattern recognition or machine learning using classification, e.g. of video objects

Definitions

  • Embodiments of the present disclosure relate to the field of computer technology, and in particular, to an image classification method, apparatus, server, and system based on a quantum kernel method.
  • Kernel method is an important class of algorithms for dealing with nonlinear classification problems in machine learning. Its purpose is to correctly classify data with the same attribute. Its core idea is to transform the original linearly inseparable data into linearly separable data in a high-dimensional space through some nonlinear mathematical transformation.
  • quantum computers Due to its own properties (superposition and entanglement), quantum computers are able to generate nonlinear transformations that classical computers cannot simulate. Thus, for a specific dataset, quantum machine learning algorithms can achieve better classification results than optimal classical machine learning algorithms. And the larger the sample size used, the better the classification effect of the algorithm will be.
  • Embodiments of the present disclosure propose an image classification method, apparatus, server, and system based on a quantum kernel method.
  • embodiments of the present disclosure provide an image classification method based on a quantum kernel method, the method comprising: acquiring an indeterminate kernel matrix obtained by processing an image set based on a quantum kernel method, wherein the elements in the indeterminate kernel matrix It is used to characterize the relationship between the images in the image set; based on the correction of the negative values in the eigenvalue diagonal matrix corresponding to the indeterminate kernel matrix, a revised eigenvalue diagonal matrix is generated, wherein the revised eigenvalues The eigenvalues in the diagonal matrix are non-negative; according to the eigenvector matrix corresponding to the indeterminate kernel matrix and the corrected eigenvalue diagonal matrix, the corrected positive definite matrix is generated; according to the corrected positive definite matrix, the pre-trained image is used
  • the classification model generates classification information for each image in the image collection.
  • embodiments of the present disclosure provide an image classification device based on a quantum kernel method, the device comprising: an acquisition unit configured to acquire an indeterminate kernel matrix obtained by processing an image set based on the quantum kernel method, wherein, The elements in the indeterminate kernel matrix are used to characterize the relationship between the images in the image set; the correction unit is configured to generate a modified feature based on the correction of the negative values in the diagonal matrix of eigenvalues corresponding to the indeterminate kernel matrix value diagonal matrix, wherein, the eigenvalues in the corrected eigenvalue diagonal matrix are non-negative values; the generating unit is configured to generate according to the eigenvector matrix corresponding to the indeterminate kernel matrix and the corrected eigenvalue diagonal matrix The modified positive definite matrix; the classification unit is configured to generate classification information of each image in the image set by using a pre-trained image classification model according to the modified positive definite matrix.
  • an embodiment of the present disclosure provides an image classification system based on a quantum kernel method, the system includes: a quantum computing terminal, configured to acquire an image set; using a preset quantum kernel function to process the image set to generate an indefinite kernel matrix, wherein the elements in the indefinite kernel matrix are used to characterize the relationship between the images in the image set; the indefinite kernel matrix is sent to the classical computing end; the classical computing end is configured to execute the implementation as in the first aspect The method described by either implementation.
  • an embodiment of the present disclosure provides a server, the server includes: one or more processors; a storage device on which one or more programs are stored; when one or more programs are processed by one or more The processor executes such that the one or more processors implement the method as described in any one of the implementations of the first aspect.
  • an embodiment of the present disclosure provides a computer-readable medium on which a computer program is stored, and when the program is executed by a processor, implements the method described in any implementation manner of the first aspect.
  • the image classification method, device, server and system based on the quantum kernel method provided by the embodiments of the present disclosure by modifying the negative value in the eigenvalue diagonal matrix corresponding to the indeterminate kernel matrix for image processing obtained based on the quantum kernel method , so that the corrected positive definite matrix generated according to the corrected eigenvalue diagonal matrix meets the kernel matrix requirements of the classical kernel method, which reduces the adverse effect of the noise of the quantum computer on the accuracy of the image classification result.
  • the combination of classification models improves the accuracy of image classification models.
  • FIG. 1 is an exemplary system architecture diagram to which an embodiment of the present disclosure may be applied;
  • FIG. 2 is a flowchart of one embodiment of a quantum kernel method-based image classification method according to the present disclosure
  • FIG. 3 is a schematic diagram of an application scenario of an image classification method based on a quantum kernel method according to an embodiment of the present disclosure
  • FIG. 4 is a flowchart of an image classification model obtained by training in an embodiment of the image classification method based on the quantum kernel method according to the present disclosure
  • FIG. 5 is a schematic structural diagram of an embodiment of an image classification apparatus based on a quantum kernel method according to the present disclosure
  • FIG. 6 is a sequence diagram of interactions between various devices in one embodiment of the quantum kernel method-based image classification system according to the present disclosure.
  • FIG. 7 is a schematic structural diagram of an electronic device suitable for implementing embodiments of the present disclosure.
  • FIG. 1 illustrates an exemplary architecture 100 to which the quantum kernel method-based image classification method or quantum kernel method-based image classification apparatus of the present disclosure may be applied.
  • the system architecture 100 may include terminal devices 101 , 102 , 103 , networks 104 , 106 and servers 105 , 107 .
  • the networks 104, 106 are used as a medium for providing communication links between the terminal devices 101, 102, 103 and the server 105, and between the server 105 and the server 107, respectively.
  • the networks 104, 106 may include various connection types, such as wired, wireless communication links, or fiber optic cables, among others.
  • the terminal devices 101, 102, and 103 interact with the server 105 through the network 104 to receive or send messages and the like.
  • Various communication client applications can be installed on the terminal devices 101, 102, and 103, such as search applications, image processing applications, and the like.
  • the terminal devices 101, 102, and 103 may be hardware or software.
  • the terminal devices 101, 102, and 103 can be various electronic devices having display screens and supporting human-computer interaction, including but not limited to smart phones, tablet computers, laptop computers, desktop computers, and the like.
  • the terminal devices 101, 102, and 103 are software, they can be installed in the electronic devices listed above. It can be implemented as a plurality of software or software modules (eg, software or software modules for providing distributed services), or can be implemented as a single software or software module. There is no specific limitation here.
  • the server 105 may be a quantum computer for providing various services, for example, a background server that provides support for image processing applications on the terminal devices 101 , 102 , and 103 .
  • the background server can analyze and process the received image, generate a processing result (eg, indeterminate kernel matrix), and send the above-mentioned processing result to the server 107 .
  • a processing result eg, indeterminate kernel matrix
  • the server 107 may be a classic computer for providing various services, for example, a background server that provides support for image processing applications on the terminal devices 101 , 102 , and 103 .
  • the background server may analyze and process the received indefinite kernel matrix, and generate a processing result (for example, classification information of each image corresponding to the indefinite kernel matrix).
  • the above images can also be directly stored locally on the server 105, and the server 105 can directly extract the locally stored images and process them.
  • the server may be hardware or software.
  • the server can be implemented as a distributed server cluster composed of multiple servers, or can be implemented as a single server.
  • the server is software, it can be implemented as a plurality of software or software modules (for example, software or software modules for providing distributed services), or can be implemented as a single software or software module. There is no specific limitation here.
  • the image classification method based on the quantum kernel method provided by the embodiments of the present disclosure is generally executed by the server 107 , and accordingly, the image classification apparatus based on the quantum kernel method is generally set in the server 107 .
  • terminal devices, networks and servers in FIG. 1 are merely illustrative. There can be any number of terminal devices, networks and servers according to implementation needs.
  • a flow 200 of one embodiment of a quantum kernel method-based image classification method according to the present disclosure is shown.
  • the image classification method based on the quantum kernel method includes the following steps:
  • Step 201 Obtain an indeterminate kernel matrix obtained by processing an image set based on a quantum kernel method.
  • the execution body of the image classification method based on the quantum kernel method can obtain the indeterminate kernel obtained by processing the image set based on the quantum kernel method through wired connection or wireless connection matrix.
  • the elements in the above-mentioned indeterminate kernel matrix can be used to represent the relationship between the images in the image set.
  • the above-mentioned relationship may be the inner product between the data obtained after the image is mapped by the quantum kernel function.
  • the above-mentioned execution subject may acquire an indeterminate kernel matrix that is pre-stored locally and obtained by processing an image set based on a quantum kernel method.
  • the above-mentioned executive body may also acquire an indeterminate kernel matrix obtained by processing an image set based on a quantum kernel method from an electronic device (eg, the quantum computer 105 shown in FIG. 1 ) connected to it in communication.
  • the quantum computer since the quantum computer itself has noise, it will cause disturbance to the elements in the generated quantum nuclear matrix. Therefore, the actually generated kernel matrix is often an indefinite matrix, that is, a matrix whose eigenvalues contain both positive and negative values.
  • the noise of the quantum computer on which the above quantum kernel method relies is smaller than a first preset threshold.
  • this solution can control the noise of the quantum computer within the first preset threshold, so that the image classification using the quantum kernel method has a more significant improvement in accuracy compared to the image classification of the classical computer. Effect.
  • Step 202 based on the correction of the negative values in the eigenvalue diagonal matrix corresponding to the indeterminate kernel matrix, generate a corrected eigenvalue diagonal matrix.
  • the above-mentioned executive body may generate the corrected eigenvalue diagonal matrix in various ways.
  • the eigenvalues in the above-mentioned corrected eigenvalue diagonal matrix are non-negative values.
  • the above-mentioned executive body may modify the above-mentioned negative eigenvalues into non-negative eigenvalues in various ways.
  • the above-mentioned execution body may correct the above-mentioned negative eigenvalues to corresponding non-negative eigenvalues according to a preset correction value correspondence table.
  • the above correction value correspondence table may be used to represent the correspondence between negative values and corrected non-negative eigenvalues.
  • the above-mentioned execution body may correct the negative values in the diagonal matrix of eigenvalues corresponding to the indeterminate kernel matrix obtained in the above step 201 to preset values, and generate the corrected eigenvalues diagonal matrix.
  • the above-mentioned preset value may be a non-negative value.
  • the above executive body may replace the negative values in the eigenvalue diagonal matrix corresponding to the above indefinite kernel matrix with a preset value (for example, 0.01), and keep other eigenvalues unchanged, thereby generating a modified eigenvalue diagonal matrix .
  • the above-mentioned execution body may correct the negative value in the diagonal matrix of eigenvalues corresponding to the indeterminate kernel matrix obtained in the above step 201 to the absolute value of the above-mentioned negative value, and generate a modified The eigenvalue diagonal matrix of .
  • the eigenvalue diagonal matrix corresponding to the above indefinite kernel matrix may include "-0.3” and "-0.8".
  • the above-mentioned execution body can correct the above-mentioned "-0.3” to "0.3”, and the above-mentioned "-0.8” to "0.8", and keep other eigenvalues unchanged, thereby generating the corrected eigenvalue diagonal matrix.
  • the above-mentioned execution body may generate a corrected diagonal matrix of eigenvalues according to the following steps:
  • the eigenvalue with the smallest numerical value in the eigenvalue diagonal matrix corresponding to the indeterminate kernel matrix is determined as the target value.
  • the eigenvalue diagonal matrix corresponding to the above indefinite kernel matrix may be diag(-0.3, 0.6, 0.1, -0.5).
  • the above executive body may determine "-0.5" as the target value.
  • the sum of the absolute value of the eigenvalue and the target value is determined as the corrected eigenvalue.
  • the above-mentioned executive body can compare the absolute value of each eigenvalue and the target value The sum of "0.5” is determined as the modified eigenvalue corresponding to the original eigenvalue, that is, "0.2, 1.1, 0.6, 0" is determined as the modified eigenvalue for "-0.3, 0.6, 0.1, -0.5".
  • a modified diagonal matrix of eigenvalues is generated according to the determined modified eigenvalues.
  • the above-mentioned execution body may form the modified eigenvalues into a modified eigenvalue diagonal matrix according to the arrangement of eigenvalues in the original eigenvalue diagonal matrix.
  • the above-mentioned execution body may generate the corrected eigenvalue diagonal matrix diag(0.2, 1.1, 0.6, 0).
  • Step 203 Generate a modified positive definite matrix according to the eigenvector matrix corresponding to the indefinite kernel matrix and the modified eigenvalue diagonal matrix.
  • the above-mentioned executive body can generate the modified positive definite matrix in various ways.
  • the eigenvector matrix corresponding to the above indefinite kernel matrix is usually an eigenvector matrix obtained by eigendecomposition of the indefinite kernel matrix obtained in the above step 201 .
  • the above-mentioned execution body may multiply the corrected eigenvalue diagonal matrix generated in step 202 by the above-mentioned corresponding eigenvector matrix in a manner matching the above-mentioned eigendecomposition to obtain a corrected matrix.
  • the modified matrix obtained above is a positive definite matrix.
  • Step 204 according to the corrected positive definite matrix, use a pre-trained image classification model to generate classification information of each image in the image set.
  • the above-mentioned executing subject may generate classification information of each image in the image set by using a pre-trained image classification model.
  • the above-mentioned image classification model is used to represent the correspondence between the positive definite matrix and the classification information of the image.
  • the above image classification model may include various models trained by machine learning methods, such as SVM (Support Vector Machine, support vector machine).
  • SVM Small Vector Machine, support vector machine
  • the above classification information may include various forms, for example, "0" and "1" are used to represent two different categories.
  • FIG. 3 is a schematic diagram of an application scenario of the image classification method based on the quantum kernel method according to an embodiment of the present disclosure.
  • the background server 306 can obtain the indeterminate kernel matrix 305 .
  • the backend server 306 may modify the negative values in the diagonal matrix based on the eigenvalues obtained by eigendecomposition of the indefinite kernel matrix 305 to obtain a modified diagonal matrix of eigenvalues.
  • the backend server 306 may generate a modified positive definite matrix 307 according to the eigenvector matrix obtained by eigendecomposition of the indefinite kernel matrix 305 and the modified eigenvalue diagonal matrix.
  • the background server 306 inputs the above-mentioned corrected positive definite matrix 307 to the pre-trained image classification model 308 to generate classification information 309 of each image.
  • the above-mentioned indeterminate kernel matrix 305 can be obtained through the following process: the user can send the image to be processed to the quantum computer 304 through the terminal devices 301 and 302 (such as the image xi located in the image space x as shown in 303 in FIG. x j ).
  • the quantum computer 304 can use the quantum kernel function to convert the image of the image space x to a higher dimension to generate an indeterminate kernel matrix 305 .
  • the quantum computer can send the generated indeterminate kernel matrix 305 to the above-mentioned background server 306 .
  • the existing techniques usually does not take into account some of the limitations of current real quantum computers, resulting in the noise of the quantum computer adversely affecting the classification accuracy of quantum kernel-based methods.
  • the modified eigenvalue diagonal matrix by modifying the negative values in the eigenvalue diagonal matrix corresponding to the indeterminate kernel matrix for image processing obtained based on the quantum kernel method, the modified eigenvalue diagonal matrix
  • the generated corrected positive definite matrix complies with the kernel matrix requirements of the classical kernel method, which reduces the adverse effect of the noise of the quantum computer on the accuracy of the image classification result, and then improves the accuracy of the image classification model through the combination of the quantum kernel method and the classical classification model.
  • FIG. 4 it shows a process 400 of training an image classification model in an embodiment of the image classification method based on the quantum kernel method.
  • the process 400 of obtaining an image classification model by training includes the following steps:
  • Step 401 acquiring training samples.
  • the execution subject for training the image classification model may acquire training samples from a local or communicatively connected electronic device.
  • the above-mentioned training samples may include a sample indeterminate kernel matrix obtained by processing the sample image set based on the quantum kernel method and label information corresponding to each sample image in the above-mentioned sample image set.
  • the elements in the sample indeterminate kernel matrix may be used to represent the association relationship between the sample images in the sample image set.
  • the total number of sample images included in the sample image set is n
  • the dimension of the sample indeterminate kernel matrix may be n ⁇ n.
  • the elements in the first row and the first column in the sample indeterminate kernel matrix can be used to represent the inner product of the first sample image after being processed by the quantum kernel function and itself.
  • the above-mentioned sample image set generally belongs to a core-set (core-set) of the original sample image set.
  • the number of sample images included in the above-mentioned sample image set is usually less than the second preset threshold.
  • this solution can extract core subsets from the original sample image set through an active learning query strategy, so that the number of sample images contained in the sample image set is less than the second preset threshold, thereby ensuring the use of quantum The accuracy advantage of the kernel method for image classification compared to the classical computer image classification.
  • step 402 the sample indeterminate kernel matrix of the training sample is used as input, and the annotation information corresponding to each sample image corresponding to the input sample indeterminate kernel matrix is used as the expected output, and an image classification model is obtained by training.
  • the above-mentioned execution body may use the sample indeterminate kernel matrix of the training sample obtained in step 401 as an input, and use the annotation information corresponding to each sample image corresponding to the input sample indeterminate kernel matrix as the expected output, through the machine learning method. Train to get an image classification model.
  • the above-mentioned image classification models may include various classification models based on kernel methods, such as SVM.
  • the executive body used for training the image classification model and the executive body used for executing the image classification method based on the quantum kernel method may be the same or different, which is not limited herein.
  • the process of obtaining an image classification model by training in the image classification method based on the quantum kernel method in this embodiment embodies the sample indeterminate kernel matrix and the The step of performing model training on the training samples of annotation information corresponding to each sample image in the sample image set. Therefore, the solution described in this embodiment provides a training method of an image classification model based on the quantum kernel method, thereby improving the accuracy of image classification.
  • the present disclosure provides an embodiment of an image classification apparatus based on a quantum kernel method, which is similar to the method embodiment shown in FIG. 2 or FIG. 4 .
  • the apparatus can be specifically applied to various electronic devices.
  • the image classification apparatus 500 based on the quantum kernel method includes an acquisition unit 501 , a correction unit 502 , a generation unit 503 and a classification unit 504 .
  • the acquiring unit 501 is configured to acquire an indeterminate kernel matrix obtained by processing the image set based on the quantum kernel method, wherein the elements in the indeterminate kernel matrix are used to represent the correlation between the images in the image set;
  • the modifying unit 502 is configured to generate a corrected eigenvalue diagonal matrix based on the correction of the negative values in the eigenvalue diagonal matrix corresponding to the indeterminate kernel matrix, wherein the eigenvalues in the corrected eigenvalue diagonal matrix are non-negative value;
  • the generating unit 503 is configured to generate a modified positive definite matrix according to the corresponding eigenvector matrix of the indeterminate kernel matrix and the modified eigenvalue diagonal matrix;
  • the classification unit 504 is configured to, according to the modified positive definite matrix, Use a pre-trained image
  • the specific processing of the acquisition unit 501 , the correction unit 502 , the generation unit 503 and the classification unit 504 and the technical effects brought by them can be implemented with reference to FIG. 2 respectively.
  • the related descriptions of step 201 , step 202 , step 203 and step 204 in the example will not be repeated here.
  • the above-mentioned correcting unit 502 may be further configured to: correct the negative values in the diagonal matrix of eigenvalues corresponding to the indeterminate kernel matrix to preset values, and generate the corrected eigenvalues A diagonal matrix where the default values are non-negative.
  • the above-mentioned modifying unit 502 may be further configured to: modify the negative value in the eigenvalue diagonal matrix corresponding to the indeterminate kernel matrix to the absolute value of the negative value, and generate a modified Eigenvalue diagonal matrix.
  • the above modification unit 502 may be further configured to: determine the eigenvalue with the smallest numerical value in the diagonal matrix of eigenvalues corresponding to the indeterminate kernel matrix as the target value; for the indeterminate kernel matrix corresponding to The eigenvalues in the diagonal matrix of eigenvalues of .
  • the noise of the quantum computer on which the quantum kernel method is based may be smaller than the first preset threshold.
  • the above-mentioned pre-trained image classification model may be obtained by training through the following steps: acquiring training samples, wherein the training samples include indeterminate samples obtained by processing a sample image set based on a quantum kernel method The kernel matrix and the annotation information corresponding to each sample image in the sample image set; the sample indeterminate kernel matrix of the training sample is used as input, and the annotation information corresponding to each sample image corresponding to the input sample indeterminate kernel matrix is used as the expected output. Get an image classification model.
  • the above-mentioned sample image set may belong to a core subset of the original sample image set.
  • the number of sample images included in the above-mentioned sample image set may be less than the second preset threshold.
  • the correction unit 502 corrects the negative values in the diagonal matrix of eigenvalues corresponding to the indeterminate kernel matrix for image processing obtained by the acquisition unit 501 based on the quantum kernel method, so that the generation of The corrected positive definite matrix generated by the unit 503 according to the corrected eigenvalue diagonal matrix meets the requirements of the kernel matrix of the classical kernel method, which reduces the adverse effect of the noise of the quantum computer on the accuracy of the image classification result.
  • the combination of classification models improves the accuracy of image classification models.
  • the image classification system based on the quantum kernel method may include: a quantum computing terminal (eg, the server 105 shown in FIG. 1 ) and a classical computing terminal (eg, the server 107 shown in FIG. 1 ).
  • the above quantum computing terminal can be configured to acquire an image set; use a preset quantum kernel function to process the image set to generate an indeterminate kernel matrix; and send the indeterminate kernel matrix to the classical computing terminal.
  • the elements in the above-mentioned indeterminate kernel matrix can be used to represent the relationship between the images in the image set.
  • the above-mentioned classical computing terminal can be configured to implement the image classification method based on the quantum kernel method as described in the foregoing embodiments.
  • step 601 the quantum computing terminal acquires an image set.
  • the quantum computing terminal may acquire the image set from a local or communicatively connected electronic device (eg, terminal devices 101, 102, 103 shown in FIG. 1 ) through a wired or wireless connection.
  • a local or communicatively connected electronic device eg, terminal devices 101, 102, 103 shown in FIG. 1
  • the above-mentioned image set may generally include at least one image to be classified.
  • step 602 the quantum computing terminal uses a preset quantum kernel function to process the image set to generate an indeterminate kernel matrix.
  • the quantum computing end may use a preset quantum kernel function to process the image set acquired in step 601 to generate an indeterminate kernel matrix.
  • the elements in the indeterminate kernel matrix can be used to represent the association relationship between the images in the above-mentioned image set.
  • the above-mentioned association relationship may be consistent with the description in the foregoing embodiments, and details are not repeated here.
  • step 603 the quantum computing terminal sends the indeterminate kernel matrix to the classical computing terminal.
  • the quantum computing terminal may send the indeterminate kernel matrix generated in step 602 to the classical computing terminal.
  • the above-mentioned classical computing terminal is the currently widely used conventional computer corresponding to the quantum computer.
  • step 604 the classical computing terminal obtains the indeterminate kernel matrix obtained by processing the image set based on the quantum kernel method.
  • step 605 based on the correction of the negative values in the eigenvalue diagonal matrix corresponding to the indeterminate kernel matrix, the classical computing terminal generates a corrected eigenvalue diagonal matrix.
  • step 606 according to the eigenvector matrix corresponding to the indefinite kernel matrix and the corrected eigenvalue diagonal matrix, the classical computing terminal generates a corrected positive definite matrix.
  • step 607 according to the corrected positive definite matrix, the classical computing terminal generates classification information of each image in the image set by using the pre-trained image classification model.
  • steps 604 to 607 are respectively consistent with the steps 201 to 204 and their optional implementations in the foregoing embodiment, and the above descriptions for the steps 201 to 204 and their optional implementations are also applicable to the steps 604 to 204. Step 607 is not repeated here.
  • the image classification system based on the quantum kernel method performs mapping processing based on the quantum kernel method on the image set through the quantum computing end to generate an indeterminate kernel matrix, and the classical computing end matches the image obtained by the quantum kernel method.
  • the correction of the negative values in the eigenvalue diagonal matrix corresponding to the indeterminate kernel matrix of image processing makes the corrected positive definite matrix generated according to the corrected eigenvalue diagonal matrix conforms to the kernel matrix requirements of the classical kernel method and reduces the quantum computer. Therefore, the accuracy of the image classification model is improved by the combination of the quantum kernel method and the classical classification model.
  • FIG. 7 it shows a schematic structural diagram of an electronic device (eg, server 107 in FIG. 1 ) 700 suitable for implementing embodiments of the present disclosure.
  • the server shown in FIG. 7 is only an example, and should not impose any limitation on the function and scope of use of the embodiments of the present disclosure.
  • an electronic device 700 may include a processing device (eg, a central processing unit, a graphics processor, etc.) 701 that may be loaded into random access according to a program stored in a read only memory (ROM) 702 or from a storage device 708 Various appropriate actions and processes are executed by the programs in the memory (RAM) 703 . In the RAM 703, various programs and data required for the operation of the electronic device 700 are also stored.
  • the processing device 701, the ROM 702, and the RAM 703 are connected to each other through a bus 704.
  • An input/output (I/O) interface 705 is also connected to bus 704 .
  • the following devices may be connected to the I/O interface 705: input devices 706 including, for example, a touch screen, touch pad, keyboard, mouse, etc.; output devices including, for example, a Liquid Crystal Display (LCD), speakers, vibrators, etc. 707; storage devices 708 including, for example, magnetic tapes, hard disks, etc.; and communication devices 709.
  • Communication means 709 may allow electronic device 700 to communicate wirelessly or by wire with other devices to exchange data. While Figure 7 illustrates electronic device 700 having various means, it should be understood that not all of the illustrated means are required to be implemented or provided. More or fewer devices may alternatively be implemented or provided. Each block shown in FIG. 7 can represent one device, and can also represent multiple devices as required.
  • embodiments of the present disclosure include a computer program product comprising a computer program carried on a computer-readable medium, the computer program containing program code for performing the method illustrated in the flowchart.
  • the computer program may be downloaded and installed from the network via the communication device 709, or from the storage device 708, or from the ROM 702.
  • the processing device 701 the above-described functions defined in the methods of the embodiments of the present disclosure are executed.
  • the computer-readable medium described in the embodiments of the present disclosure may be a computer-readable signal medium or a computer-readable storage medium, or any combination of the above two.
  • the computer-readable storage medium can be, for example, but not limited to, an electrical, magnetic, optical, electromagnetic, infrared, or semiconductor system, apparatus or device, or a combination of any of the above. More specific examples of computer readable storage media may include, but are not limited to, electrical connections with one or more wires, portable computer disks, hard disks, random access memory (RAM), read only memory (ROM), erasable Programmable read only memory (EPROM or flash memory), fiber optics, portable compact disk read only memory (CD-ROM), optical storage devices, magnetic storage devices, or any suitable combination of the foregoing.
  • a 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.
  • a computer-readable signal medium may include a data signal in baseband or propagated as part of a carrier wave, carrying computer-readable program code therein. Such propagated data signals may take a variety of forms, including but not limited to electromagnetic signals, optical signals, or any suitable combination of the foregoing.
  • a computer-readable signal medium can also be any computer-readable medium other than a computer-readable storage medium that can transmit, propagate, or transport the program for use by or in connection with the instruction execution system, apparatus, or device .
  • the program code contained on the computer-readable medium can be transmitted by any suitable medium, including but not limited to: electric wire, optical cable, RF (Radio Frequency, radio frequency), etc., or any suitable combination of the above.
  • the above-mentioned computer-readable medium may be included in the above-mentioned electronic device; or may exist alone without being assembled into the server.
  • the above-mentioned computer-readable medium carries one or more programs, and when the above-mentioned one or more programs are executed by the server, the server: obtains an indeterminate kernel matrix obtained by processing an image set based on a quantum kernel method, wherein the indeterminate kernel The elements in the matrix are used to characterize the relationship between the images in the image set; based on the correction of the negative values in the eigenvalue diagonal matrix corresponding to the indeterminate kernel matrix, a revised eigenvalue diagonal matrix is generated, where the correction The eigenvalues in the eigenvalue diagonal matrix are non-negative; according to the eigenvector matrix corresponding to the indefinite kernel matrix and the revised eigenvalue diagonal matrix, a revised positive definite matrix is generated; according to the revised positive definite matrix, use
  • the pre-trained image classification model generates classification information for each image in
  • Computer program code for carrying out operations of embodiments of the present disclosure may be written in one or more programming languages, including object-oriented programming languages—such as Java, Smalltalk, C++, or a combination thereof, Also included are conventional procedural programming languages - such as "C", the Python language, or similar programming languages.
  • the program code may execute entirely on the user's computer, partly on the user's computer, as a stand-alone software package, partly on the user's computer and partly on a remote computer, or entirely on the remote computer or server.
  • the remote computer may be connected to the user's computer through any kind of network, including a local area network (LAN) or a wide area network (WAN), or may be connected to an external computer (eg, using an Internet service provider through Internet connection).
  • LAN local area network
  • WAN wide area network
  • each block in the flowchart or block diagrams may represent a module, segment, or portion of code that contains one or more logical functions for implementing the specified functions executable instructions.
  • the functions noted in the blocks may occur out of the order noted in the figures. For example, two blocks shown in succession may, in fact, be executed substantially concurrently, or the blocks may sometimes be executed in the reverse order, depending upon the functionality involved.
  • each block of the block diagrams and/or flowchart illustrations, and combinations of blocks in the block diagrams and/or flowchart illustrations can be implemented in dedicated hardware-based systems that perform the specified functions or operations , or can be implemented in a combination of dedicated hardware and computer instructions.
  • the units involved in the embodiments of the present disclosure may be implemented in software or hardware.
  • the described unit may also be set in the processor, for example, it may be described as: a processor, including an acquisition unit, a correction unit, a generation unit, and a classification unit.
  • the names of these units do not constitute a limitation of the unit itself in some cases.
  • the acquisition unit can also be described as "a unit that acquires an indeterminate kernel matrix obtained by processing an image set based on a quantum kernel method, where , the elements in the indeterminate kernel matrix are used to characterize the association between the images in the image collection".

Landscapes

  • Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • Physics & Mathematics (AREA)
  • General Physics & Mathematics (AREA)
  • Computing Systems (AREA)
  • Artificial Intelligence (AREA)
  • Software Systems (AREA)
  • Evolutionary Computation (AREA)
  • Data Mining & Analysis (AREA)
  • Computational Mathematics (AREA)
  • Pure & Applied Mathematics (AREA)
  • Mathematical Analysis (AREA)
  • General Engineering & Computer Science (AREA)
  • Mathematical Physics (AREA)
  • Condensed Matter Physics & Semiconductors (AREA)
  • Mathematical Optimization (AREA)
  • Multimedia (AREA)
  • Health & Medical Sciences (AREA)
  • Computer Vision & Pattern Recognition (AREA)
  • Databases & Information Systems (AREA)
  • General Health & Medical Sciences (AREA)
  • Medical Informatics (AREA)
  • Image Analysis (AREA)

Abstract

Disclosed in embodiments of the present disclosure are a quantum kernel method-based image classification method and apparatus, a server, and a medium. A specific embodiment of the method comprises: obtaining an indefinite kernel matrix obtained by processing an image set on the basis of a quantum kernel method, wherein elements in the indefinite kernel matrix are used for representing the association relationship between images in the image set; generating a corrected eigenvalue diagonal matrix on the basis of correction of a negative value in an eigenvalue diagonal matrix corresponding to the indefinite kernel matrix, wherein an eigenvalue in the corrected eigenvalue diagonal matrix is a non-negative value; generating a corrected positive definite matrix according to an eigenvector matrix corresponding to the indefinite kernel matrix and the corrected eigenvalue diagonal matrix; and generating, according to the corrected positive definite matrix, classification information of the images in the image set by using a pre-trained image classification model. This embodiment reduces the adverse effect of noise of a quantum computer on the accuracy of image classification results.

Description

基于量子核方法的图像分类方法、装置、服务器和系统Image classification method, device, server and system based on quantum kernel method
本专利申请要求于2021年03月29日提交的、申请号为202110334853.9、发明名称为“基于量子核方法的图像分类方法、装置、服务器和系统”的中国专利申请的优先权,该申请的全文以引用的方式并入本申请中。This patent application claims the priority of the Chinese patent application filed on March 29, 2021 with the application number of 202110334853.9 and the invention titled "image classification method, device, server and system based on quantum kernel method", the full text of the application Incorporated into this application by reference.
技术领域technical field
本公开的实施例涉及计算机技术领域,具体涉及基于量子核方法的图像分类方法、装置、服务器和系统。Embodiments of the present disclosure relate to the field of computer technology, and in particular, to an image classification method, apparatus, server, and system based on a quantum kernel method.
背景技术Background technique
核方法(kernel method)是机器学习中处理非线性分类问题的一类重要算法。它的目的是将具有同一属性的数据进行正确分类。其核心思想是通过某种非线性的数学变换将原始线性不可分的数据变为高维空间中线性可分的数据。Kernel method is an important class of algorithms for dealing with nonlinear classification problems in machine learning. Its purpose is to correctly classify data with the same attribute. Its core idea is to transform the original linearly inseparable data into linearly separable data in a high-dimensional space through some nonlinear mathematical transformation.
量子计算机由于其自身的特性(叠加和纠缠),能够产生经典计算机无法模拟的非线性变换。从而,对于特定的数据集,量子机器学习算法能够实现比最优的经典机器学习算法更好的分类效果。并且所用的样本量越大,算法的分类效果会越好。Due to its own properties (superposition and entanglement), quantum computers are able to generate nonlinear transformations that classical computers cannot simulate. Thus, for a specific dataset, quantum machine learning algorithms can achieve better classification results than optimal classical machine learning algorithms. And the larger the sample size used, the better the classification effect of the algorithm will be.
然而,现有的量子核方法(quantum kernel method)没有考虑当前真实量子计算机的一些局限,例如在NISQ(Noisy Intermediate-Scale Quantum,中等规模带噪声的量子器件)时代,量子计算机是具有噪声的,并且我们从量子计算机中获得的并不是一个精确的数据,而是服从某种概率分布的数据。这对量子核方法的一些性质产生了巨大的影响,进而影响其对数据的分类效果。However, the existing quantum kernel methods do not consider some of the limitations of current real quantum computers. For example, in the era of NISQ (Noisy Intermediate-Scale Quantum, medium-scale noisy quantum devices), quantum computers are noisy, And what we get from a quantum computer is not an exact data, but data that obeys a certain probability distribution. This has a huge impact on some properties of the quantum kernel method, which in turn affects how well it can classify data.
发明内容SUMMARY OF THE INVENTION
本公开的实施例提出了基于量子核方法的图像分类方法、装置、服务器和系统。Embodiments of the present disclosure propose an image classification method, apparatus, server, and system based on a quantum kernel method.
第一方面,本公开的实施例提供了一种基于量子核方法的图像分类方法,该方法包括:获取基于量子核方法对图像集合进行处理得到的不定核矩阵,其中,不定核矩阵中的元素用于表征图像集合中的图像之间的关联关系;基于对不定核 矩阵对应的特征值对角矩阵中的负值的修正,生成修正后的特征值对角矩阵,其中,修正后的特征值对角阵中的特征值为非负值;根据不定核矩阵对应的特征向量矩阵和修正后的特征值对角矩阵,生成修正后的正定矩阵;根据修正后的正定矩阵,利用预先训练的图像分类模型生成图像集合中各图像的分类信息。In a first aspect, embodiments of the present disclosure provide an image classification method based on a quantum kernel method, the method comprising: acquiring an indeterminate kernel matrix obtained by processing an image set based on a quantum kernel method, wherein the elements in the indeterminate kernel matrix It is used to characterize the relationship between the images in the image set; based on the correction of the negative values in the eigenvalue diagonal matrix corresponding to the indeterminate kernel matrix, a revised eigenvalue diagonal matrix is generated, wherein the revised eigenvalues The eigenvalues in the diagonal matrix are non-negative; according to the eigenvector matrix corresponding to the indeterminate kernel matrix and the corrected eigenvalue diagonal matrix, the corrected positive definite matrix is generated; according to the corrected positive definite matrix, the pre-trained image is used The classification model generates classification information for each image in the image collection.
第二方面,本公开的实施例提供了一种基于量子核方法的图像分类装置,该装置包括:获取单元,被配置成获取基于量子核方法对图像集合进行处理得到的不定核矩阵,其中,不定核矩阵中的元素用于表征图像集合中的图像之间的关联关系;修正单元,被配置成基于对不定核矩阵对应的特征值对角矩阵中的负值的修正,生成修正后的特征值对角矩阵,其中,修正后的特征值对角阵中的特征值为非负值;生成单元,被配置成根据不定核矩阵对应的特征向量矩阵和修正后的特征值对角矩阵,生成修正后的正定矩阵;分类单元,被配置成根据修正后的正定矩阵,利用预先训练的图像分类模型生成图像集合中各图像的分类信息。In a second aspect, embodiments of the present disclosure provide an image classification device based on a quantum kernel method, the device comprising: an acquisition unit configured to acquire an indeterminate kernel matrix obtained by processing an image set based on the quantum kernel method, wherein, The elements in the indeterminate kernel matrix are used to characterize the relationship between the images in the image set; the correction unit is configured to generate a modified feature based on the correction of the negative values in the diagonal matrix of eigenvalues corresponding to the indeterminate kernel matrix value diagonal matrix, wherein, the eigenvalues in the corrected eigenvalue diagonal matrix are non-negative values; the generating unit is configured to generate according to the eigenvector matrix corresponding to the indeterminate kernel matrix and the corrected eigenvalue diagonal matrix The modified positive definite matrix; the classification unit is configured to generate classification information of each image in the image set by using a pre-trained image classification model according to the modified positive definite matrix.
第三方面,本公开实施例提供了一种基于量子核方法的图像分类系统,该系统包括:量子计算端,被配置成获取图像集合;利用预设的量子核函数对图像集合进行处理,生成不定核矩阵,其中,不定核矩阵中的元素用于表征图像集合中的图像之间的关联关系;将不定核矩阵发送至经典计算端;经典计算端,被配置成执行实现如第一方面中任一实现方式描述的方法。In a third aspect, an embodiment of the present disclosure provides an image classification system based on a quantum kernel method, the system includes: a quantum computing terminal, configured to acquire an image set; using a preset quantum kernel function to process the image set to generate an indefinite kernel matrix, wherein the elements in the indefinite kernel matrix are used to characterize the relationship between the images in the image set; the indefinite kernel matrix is sent to the classical computing end; the classical computing end is configured to execute the implementation as in the first aspect The method described by either implementation.
第四方面,本公开实施例提供了一种服务器,该服务器包括:一个或多个处理器;存储装置,其上存储有一个或多个程序;当一个或多个程序被一个或多个处理器执行,使得一个或多个处理器实现如第一方面中任一实现方式描述的方法。In a fourth aspect, an embodiment of the present disclosure provides a server, the server includes: one or more processors; a storage device on which one or more programs are stored; when one or more programs are processed by one or more The processor executes such that the one or more processors implement the method as described in any one of the implementations of the first aspect.
第五方面,本公开实施例提供了一种计算机可读介质,其上存储有计算机程序,该程序被处理器执行时实现如第一方面中任一实现方式描述的方法。In a fifth aspect, an embodiment of the present disclosure provides a computer-readable medium on which a computer program is stored, and when the program is executed by a processor, implements the method described in any implementation manner of the first aspect.
本公开的实施例提供的基于量子核方法的图像分类方法、装置、服务器和系统,通过对基于量子核方法得到的针对图像处理的不定核矩阵对应的特征值对角矩阵中的负值的修正,使得根据修正后的特征值对角矩阵生成的修正后的正定矩阵符合经典核方法的核矩阵要求,降低了量子计算机的噪声对图像分类结果准确度的不良影响,进而通过量子核方法和经典分类模型的结合提升图像分类模型的准确度。The image classification method, device, server and system based on the quantum kernel method provided by the embodiments of the present disclosure, by modifying the negative value in the eigenvalue diagonal matrix corresponding to the indeterminate kernel matrix for image processing obtained based on the quantum kernel method , so that the corrected positive definite matrix generated according to the corrected eigenvalue diagonal matrix meets the kernel matrix requirements of the classical kernel method, which reduces the adverse effect of the noise of the quantum computer on the accuracy of the image classification result. The combination of classification models improves the accuracy of image classification models.
附图说明Description of drawings
通过阅读参照以下附图所作的对非限制性实施例所作的详细描述,本公开的其它特征、目的和优点将会变得更明显:Other features, objects and advantages of the present disclosure will become more apparent upon reading the detailed description of non-limiting embodiments taken with reference to the following drawings:
图1是本公开的一个实施例可以应用于其中的示例性系统架构图;FIG. 1 is an exemplary system architecture diagram to which an embodiment of the present disclosure may be applied;
图2是根据本公开的基于量子核方法的图像分类方法的一个实施例的流程图;FIG. 2 is a flowchart of one embodiment of a quantum kernel method-based image classification method according to the present disclosure;
图3是根据本公开的实施例的基于量子核方法的图像分类方法的一个应用场景的示意图;3 is a schematic diagram of an application scenario of an image classification method based on a quantum kernel method according to an embodiment of the present disclosure;
图4是根据本公开的基于量子核方法的图像分类方法的一个实施例中训练得到图像分类模型的流程图;4 is a flowchart of an image classification model obtained by training in an embodiment of the image classification method based on the quantum kernel method according to the present disclosure;
图5是根据本公开的基于量子核方法的图像分类装置的一个实施例的结构示意图;5 is a schematic structural diagram of an embodiment of an image classification apparatus based on a quantum kernel method according to the present disclosure;
图6是根据本公开的基于量子核方法的图像分类系统的一个实施例中各个设备之间交互的时序图。FIG. 6 is a sequence diagram of interactions between various devices in one embodiment of the quantum kernel method-based image classification system according to the present disclosure.
图7是适于用来实现本公开的实施例的电子设备的结构示意图。7 is a schematic structural diagram of an electronic device suitable for implementing embodiments of the present disclosure.
具体实施方式Detailed ways
下面结合附图和实施例对本公开作进一步的详细说明。可以理解的是,此处所描述的具体实施例仅仅用于解释相关发明,而非对该发明的限定。另外还需要说明的是,为了便于描述,附图中仅示出了与有关发明相关的部分。The present disclosure will be further described in detail below with reference to the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are only used to explain the related invention, but not to limit the invention. In addition, it should be noted that, for the convenience of description, only the parts related to the related invention are shown in the drawings.
需要说明的是,在不冲突的情况下,本公开中的实施例及实施例中的特征可以相互组合。下面将参考附图并结合实施例来详细说明本公开。It should be noted that the embodiments of the present disclosure and the features of the embodiments may be combined with each other under the condition of no conflict. The present disclosure will be described in detail below with reference to the accompanying drawings and in conjunction with embodiments.
图1示出了可以应用本公开的基于量子核方法的图像分类方法或基于量子核方法的图像分类装置的示例性架构100。FIG. 1 illustrates an exemplary architecture 100 to which the quantum kernel method-based image classification method or quantum kernel method-based image classification apparatus of the present disclosure may be applied.
如图1所示,系统架构100可以包括终端设备101、102、103,网络104、106和服务器105、107。网络104、106分别用以在终端设备101、102、103和服务器105之间、服务器105和服务器107之间提供通信链路的介质。网络104、106可以包括各种连接类型,例如有线、无线通信链路或者光纤电缆等等。As shown in FIG. 1 , the system architecture 100 may include terminal devices 101 , 102 , 103 , networks 104 , 106 and servers 105 , 107 . The networks 104, 106 are used as a medium for providing communication links between the terminal devices 101, 102, 103 and the server 105, and between the server 105 and the server 107, respectively. The networks 104, 106 may include various connection types, such as wired, wireless communication links, or fiber optic cables, among others.
终端设备101、102、103通过网络104与服务器105交互,以接收或发送消息等。终端设备101、102、103上可以安装有各种通讯客户端应用,例如搜索类 应用、图像处理类应用等。The terminal devices 101, 102, and 103 interact with the server 105 through the network 104 to receive or send messages and the like. Various communication client applications can be installed on the terminal devices 101, 102, and 103, such as search applications, image processing applications, and the like.
终端设备101、102、103可以是硬件,也可以是软件。当终端设备101、102、103为硬件时,可以是具有显示屏并且支持人机交互的各种电子设备,包括但不限于智能手机、平板电脑、膝上型便携计算机和台式计算机等等。当终端设备101、102、103为软件时,可以安装在上述所列举的电子设备中。其可以实现成多个软件或软件模块(例如用来提供分布式服务的软件或软件模块),也可以实现成单个软件或软件模块。在此不做具体限定。The terminal devices 101, 102, and 103 may be hardware or software. When the terminal devices 101, 102, and 103 are hardware, they can be various electronic devices having display screens and supporting human-computer interaction, including but not limited to smart phones, tablet computers, laptop computers, desktop computers, and the like. When the terminal devices 101, 102, and 103 are software, they can be installed in the electronic devices listed above. It can be implemented as a plurality of software or software modules (eg, software or software modules for providing distributed services), or can be implemented as a single software or software module. There is no specific limitation here.
服务器105可以是用于提供各种服务的量子计算机,例如为终端设备101、102、103上图像处理类应用提供支持的后台服务器。后台服务器可以对接收到的图像进行分析处理,生成处理结果(例如不定核矩阵)以及将上述处理结果发送给服务器107。The server 105 may be a quantum computer for providing various services, for example, a background server that provides support for image processing applications on the terminal devices 101 , 102 , and 103 . The background server can analyze and process the received image, generate a processing result (eg, indeterminate kernel matrix), and send the above-mentioned processing result to the server 107 .
服务器107可以是用于提供各种服务的经典计算机,例如为终端设备101、102、103上图像处理类应用提供支持的后台服务器。后台服务器可以对接收到的不定核矩阵进行分析处理,生成处理结果(例如不定核矩阵对应的各图像的分类信息)。The server 107 may be a classic computer for providing various services, for example, a background server that provides support for image processing applications on the terminal devices 101 , 102 , and 103 . The background server may analyze and process the received indefinite kernel matrix, and generate a processing result (for example, classification information of each image corresponding to the indefinite kernel matrix).
需要说明的是,上述图像也可以直接存储在服务器105的本地,服务器105可以直接提取本地所存储的图像并进行处理,此时,可以不存在终端设备101、102、103和网络104。It should be noted that the above images can also be directly stored locally on the server 105, and the server 105 can directly extract the locally stored images and process them.
需要说明的是,服务器可以是硬件,也可以是软件。当服务器为硬件时,可以实现成多个服务器组成的分布式服务器集群,也可以实现成单个服务器。当服务器为软件时,可以实现成多个软件或软件模块(例如用来提供分布式服务的软件或软件模块),也可以实现成单个软件或软件模块。在此不做具体限定。It should be noted that the server may be hardware or software. When the server is hardware, it can be implemented as a distributed server cluster composed of multiple servers, or can be implemented as a single server. When the server is software, it can be implemented as a plurality of software or software modules (for example, software or software modules for providing distributed services), or can be implemented as a single software or software module. There is no specific limitation here.
需要说明的是,本公开的实施例所提供的基于量子核方法的图像分类方法一般由服务器107执行,相应地,基于量子核方法的图像分类装置一般设置于服务器107中。It should be noted that the image classification method based on the quantum kernel method provided by the embodiments of the present disclosure is generally executed by the server 107 , and accordingly, the image classification apparatus based on the quantum kernel method is generally set in the server 107 .
应该理解,图1中的终端设备、网络和服务器的数目仅仅是示意性的。根据实现需要,可以具有任意数目的终端设备、网络和服务器。It should be understood that the numbers of terminal devices, networks and servers in FIG. 1 are merely illustrative. There can be any number of terminal devices, networks and servers according to implementation needs.
继续参考图2,示出了根据本公开的基于量子核方法的图像分类方法的一个实施例的流程200。该基于量子核方法的图像分类方法包括以下步骤:Continuing to refer to FIG. 2 , a flow 200 of one embodiment of a quantum kernel method-based image classification method according to the present disclosure is shown. The image classification method based on the quantum kernel method includes the following steps:
步骤201,获取基于量子核方法对图像集合进行处理得到的不定核矩阵。Step 201: Obtain an indeterminate kernel matrix obtained by processing an image set based on a quantum kernel method.
在本实施例中,基于量子核方法的图像分类方法的执行主体(如图1所示的服务器107)可以通过有线连接方式或者无线连接方式获取基于量子核方法对图像集合进行处理得到的不定核矩阵。其中,上述不定核矩阵中的元素可以用于表征图像集合中的图像之间的关联关系。作为示例,上述关联关系可以是图像经量子核函数映射后所得到的数据之间的内积。In this embodiment, the execution body of the image classification method based on the quantum kernel method (the server 107 shown in FIG. 1 ) can obtain the indeterminate kernel obtained by processing the image set based on the quantum kernel method through wired connection or wireless connection matrix. Wherein, the elements in the above-mentioned indeterminate kernel matrix can be used to represent the relationship between the images in the image set. As an example, the above-mentioned relationship may be the inner product between the data obtained after the image is mapped by the quantum kernel function.
在本实施例中,上述执行主体可以获取预先存储于本地的、基于量子核方法对图像集合进行处理得到的不定核矩阵。上述执行主体也可以从与之通信连接的电子设备(例如图1所示的量子计算机105)获取基于量子核方法对图像集合进行处理得到的不定核矩阵。In this embodiment, the above-mentioned execution subject may acquire an indeterminate kernel matrix that is pre-stored locally and obtained by processing an image set based on a quantum kernel method. The above-mentioned executive body may also acquire an indeterminate kernel matrix obtained by processing an image set based on a quantum kernel method from an electronic device (eg, the quantum computer 105 shown in FIG. 1 ) connected to it in communication.
需要说明的是,由于量子计算机本身具有噪声,会对生成的量子核矩阵中的元素造成扰动。从而,实际生成的核矩阵往往是不定矩阵,即特征值既包含正值、也包含负值的矩阵。It should be noted that since the quantum computer itself has noise, it will cause disturbance to the elements in the generated quantum nuclear matrix. Therefore, the actually generated kernel matrix is often an indefinite matrix, that is, a matrix whose eigenvalues contain both positive and negative values.
在本实施例的一些可选的实现方式中,上述量子核方法所依托的量子计算机的噪声小于第一预设阈值。In some optional implementations of this embodiment, the noise of the quantum computer on which the above quantum kernel method relies is smaller than a first preset threshold.
需要说明的是,发明人发现,用于执行上述量子核方法的量子计算机的噪声在达到一定程度时对图像分类准确性具有较大影响。基于上述可选的实现方式,本方案可以将量子计算机的噪声控制在第一预设阈值以内,使得使用量子核方法进行图像分类相比于经典计算机的图像分类在准确性改进方面具有较为显著的效果。It should be noted that the inventors found that the noise of the quantum computer used to execute the above quantum kernel method has a great influence on the image classification accuracy when it reaches a certain level. Based on the above-mentioned optional implementations, this solution can control the noise of the quantum computer within the first preset threshold, so that the image classification using the quantum kernel method has a more significant improvement in accuracy compared to the image classification of the classical computer. Effect.
步骤202,基于对不定核矩阵对应的特征值对角矩阵中的负值的修正,生成修正后的特征值对角矩阵。 Step 202 , based on the correction of the negative values in the eigenvalue diagonal matrix corresponding to the indeterminate kernel matrix, generate a corrected eigenvalue diagonal matrix.
在本实施例中,基于对上述步骤201所获取的不定核矩阵对应的特征值对角矩阵中的负值的修正,上述执行主体可以通过各种方式生成修正后的特征值对角矩阵。其中,上述修正后的特征值对角阵中的特征值为非负值。In this embodiment, based on the correction of the negative values in the eigenvalue diagonal matrix corresponding to the indeterminate kernel matrix obtained in the above step 201, the above-mentioned executive body may generate the corrected eigenvalue diagonal matrix in various ways. Wherein, the eigenvalues in the above-mentioned corrected eigenvalue diagonal matrix are non-negative values.
在本实施例中,上述执行主体可以对上述步骤201所获取的不定核矩阵(例如矩阵A)进行特征分解(A=QΣQ -1),生成包含至少一个特征值的对角矩阵(例如对角阵Σ)和特征向量矩阵(例如矩阵Q)。其中,上述对角矩阵中的特征值(例如λ i=Σ ii)既包括正值、也包括负值。对于所生成的上述对角矩阵中的负值特征值,上述执行主体可以通过各种方式将上述负值特征值修正为非负特征值。 作为示例,上述执行主体可以根据预设的修正数值对应表,将上述负值特征值修正为对应的非负特征值。其中,上述修正数值对应表可以用于表征负值与修正后的非负特征值之间的对应关系。 In this embodiment, the above-mentioned execution body may perform eigendecomposition (A=QΣQ −1 ) on the indefinite kernel matrix (for example, matrix A) obtained in the above-mentioned step 201 to generate a diagonal matrix (for example, diagonal matrix) including at least one eigenvalue matrix Σ) and eigenvector matrix (such as matrix Q). The eigenvalues (eg, λ iii ) in the above-mentioned diagonal matrix include both positive and negative values. For the generated negative eigenvalues in the above-mentioned diagonal matrix, the above-mentioned executive body may modify the above-mentioned negative eigenvalues into non-negative eigenvalues in various ways. As an example, the above-mentioned execution body may correct the above-mentioned negative eigenvalues to corresponding non-negative eigenvalues according to a preset correction value correspondence table. The above correction value correspondence table may be used to represent the correspondence between negative values and corrected non-negative eigenvalues.
在本实施例的一些可选的实现方式中,上述执行主体可以将上述步骤201所获取的不定核矩阵对应的特征值对角矩阵中的负值修正为预设值,生成修正后的特征值对角矩阵。In some optional implementations of this embodiment, the above-mentioned execution body may correct the negative values in the diagonal matrix of eigenvalues corresponding to the indeterminate kernel matrix obtained in the above step 201 to preset values, and generate the corrected eigenvalues diagonal matrix.
在这些实现方式中,上述预设值可以为非负值。作为示例,上述执行主体可以将上述不定核矩阵对应的特征值对角矩阵中的负值替换为预设值(例如0.01),保持其他特征值不变,从而生成修正后的特征值对角矩阵。In these implementations, the above-mentioned preset value may be a non-negative value. As an example, the above executive body may replace the negative values in the eigenvalue diagonal matrix corresponding to the above indefinite kernel matrix with a preset value (for example, 0.01), and keep other eigenvalues unchanged, thereby generating a modified eigenvalue diagonal matrix .
在本实施例的一些可选的实现方式中,上述执行主体可以将上述步骤201所获取的不定核矩阵对应的特征值对角矩阵中的负值修正为上述负值的绝对值,生成修正后的特征值对角矩阵。In some optional implementations of this embodiment, the above-mentioned execution body may correct the negative value in the diagonal matrix of eigenvalues corresponding to the indeterminate kernel matrix obtained in the above step 201 to the absolute value of the above-mentioned negative value, and generate a modified The eigenvalue diagonal matrix of .
在这些实现方式中,作为示例,上述不定核矩阵对应的特征值对角矩阵中可以包括“-0.3”、“-0.8”。上述执行主体可以将上述“-0.3”、修正为“0.3”,将上述“-0.8”修正为“0.8”,保持其他特征值不变,从而生成修正后的特征值对角矩阵。In these implementations, as an example, the eigenvalue diagonal matrix corresponding to the above indefinite kernel matrix may include "-0.3" and "-0.8". The above-mentioned execution body can correct the above-mentioned "-0.3" to "0.3", and the above-mentioned "-0.8" to "0.8", and keep other eigenvalues unchanged, thereby generating the corrected eigenvalue diagonal matrix.
在本实施例的一些可选的实现方式中,上述执行主体可以按照如下步骤生成修正后的特征值对角矩阵:In some optional implementations of this embodiment, the above-mentioned execution body may generate a corrected diagonal matrix of eigenvalues according to the following steps:
第一步,将不定核矩阵对应的特征值对角矩阵中数值最小的特征值确定为目标值。In the first step, the eigenvalue with the smallest numerical value in the eigenvalue diagonal matrix corresponding to the indeterminate kernel matrix is determined as the target value.
在这些实现方式中,作为示例,上述不定核矩阵对应的特征值对角矩阵可以为diag(-0.3,0.6,0.1,-0.5)。上述执行主体可以将“-0.5”确定为目标值。In these implementations, as an example, the eigenvalue diagonal matrix corresponding to the above indefinite kernel matrix may be diag(-0.3, 0.6, 0.1, -0.5). The above executive body may determine "-0.5" as the target value.
第二步,对于不定核矩阵对应的特征值对角矩阵中的特征值,将该特征值与目标值的绝对值之和确定为修正后的特征值。In the second step, for the eigenvalue in the eigenvalue diagonal matrix corresponding to the indeterminate kernel matrix, the sum of the absolute value of the eigenvalue and the target value is determined as the corrected eigenvalue.
在这些实现方式中,作为示例,对于不定核矩阵对应的特征值对角矩阵中的特征值“-0.3,0.6,0.1,-0.5”,上述执行主体可以将各特征值与目标值的绝对值“0.5”之和确定为与原特征值对应的修正后的特征值,即将“0.2,1.1,0.6,0”确定为对“-0.3,0.6,0.1,-0.5”修正后的特征值。In these implementations, as an example, for the eigenvalues "-0.3, 0.6, 0.1, -0.5" in the eigenvalue diagonal matrix corresponding to the indeterminate kernel matrix, the above-mentioned executive body can compare the absolute value of each eigenvalue and the target value The sum of "0.5" is determined as the modified eigenvalue corresponding to the original eigenvalue, that is, "0.2, 1.1, 0.6, 0" is determined as the modified eigenvalue for "-0.3, 0.6, 0.1, -0.5".
第三步,根据所确定的修正后的特征值,生成修正后的特征值对角矩阵。In the third step, a modified diagonal matrix of eigenvalues is generated according to the determined modified eigenvalues.
在这些实现方式中,上述执行主体可以按照原始特征值对角矩阵中的特征值 排列方式,将修正后的特征值形成修正后的特征值对角矩阵。作为示例,上述执行主体可以生成修正后的特征值对角矩阵diag(0.2,1.1,0.6,0)。In these implementation manners, the above-mentioned execution body may form the modified eigenvalues into a modified eigenvalue diagonal matrix according to the arrangement of eigenvalues in the original eigenvalue diagonal matrix. As an example, the above-mentioned execution body may generate the corrected eigenvalue diagonal matrix diag(0.2, 1.1, 0.6, 0).
步骤203,根据不定核矩阵对应的特征向量矩阵和所修正后的特征值对角矩阵,生成修正后的正定矩阵。Step 203: Generate a modified positive definite matrix according to the eigenvector matrix corresponding to the indefinite kernel matrix and the modified eigenvalue diagonal matrix.
在本实施例中,根据步骤201所获取的不定核矩阵对应的特征向量矩阵和步骤202所生成的修正后的特征值对角矩阵,上述执行主体可以通过各种方式生成修正后的正定矩阵。其中,上述不定核矩阵对应的特征向量矩阵通常为对上述步骤201所获取的不定核矩阵进行特征分解所得到的特征向量矩阵。上述执行主体可以采用与上述特征分解相匹配的方式将步骤202所生成的修正后的特征值对角矩阵与上述对应的特征向量矩阵相乘,得到修正后的矩阵。通常,上述所得到的修正后的矩阵为正定矩阵。In this embodiment, according to the eigenvector matrix corresponding to the indeterminate kernel matrix obtained in step 201 and the modified diagonal matrix of eigenvalues generated in step 202, the above-mentioned executive body can generate the modified positive definite matrix in various ways. The eigenvector matrix corresponding to the above indefinite kernel matrix is usually an eigenvector matrix obtained by eigendecomposition of the indefinite kernel matrix obtained in the above step 201 . The above-mentioned execution body may multiply the corrected eigenvalue diagonal matrix generated in step 202 by the above-mentioned corresponding eigenvector matrix in a manner matching the above-mentioned eigendecomposition to obtain a corrected matrix. Usually, the modified matrix obtained above is a positive definite matrix.
步骤204,根据修正后的正定矩阵,利用预先训练的图像分类模型生成图像集合中各图像的分类信息。 Step 204 , according to the corrected positive definite matrix, use a pre-trained image classification model to generate classification information of each image in the image set.
在本实施例中,根据修正后的正定矩阵,上述执行主体可以利用预先训练的图像分类模型生成图像集合中各图像的分类信息。其中,上述图像分类模型用于表征正定矩阵与图像的分类信息之间的对应关系。其中,上述图像分类模型可以包括各种通过机器学习方式训练得到的模型,例如SVM(Support Vector Machine,支持向量机)。上述分类信息可以包括各种形式,例如用“0”、“1”表示两种不同的类别。In this embodiment, according to the corrected positive definite matrix, the above-mentioned executing subject may generate classification information of each image in the image set by using a pre-trained image classification model. The above-mentioned image classification model is used to represent the correspondence between the positive definite matrix and the classification information of the image. The above image classification model may include various models trained by machine learning methods, such as SVM (Support Vector Machine, support vector machine). The above classification information may include various forms, for example, "0" and "1" are used to represent two different categories.
继续参见图3,图3是根据本公开的实施例的基于量子核方法的图像分类方法的应用场景的一个示意图。在图3的应用场景中,后台服务器306可以获取不定核矩阵305。后台服务器306可以基于对上述不定核矩阵305进行特征分解后所得到的特征值对角阵中的负值进行修正,得到修正后的特征值对角矩阵。而后,后台服务器306可以根据对上述不定核矩阵305进行特征分解后所得到的特征向量矩阵和上述修正后的特征值对角矩阵,生成修正后的正定矩阵307。之后,后台服务器306将上述修正后的正定矩阵307输入至预先训练的图像分类模型308,生成各图像的分类信息309。Continue to refer to FIG. 3 , which is a schematic diagram of an application scenario of the image classification method based on the quantum kernel method according to an embodiment of the present disclosure. In the application scenario of FIG. 3 , the background server 306 can obtain the indeterminate kernel matrix 305 . The backend server 306 may modify the negative values in the diagonal matrix based on the eigenvalues obtained by eigendecomposition of the indefinite kernel matrix 305 to obtain a modified diagonal matrix of eigenvalues. Then, the backend server 306 may generate a modified positive definite matrix 307 according to the eigenvector matrix obtained by eigendecomposition of the indefinite kernel matrix 305 and the modified eigenvalue diagonal matrix. After that, the background server 306 inputs the above-mentioned corrected positive definite matrix 307 to the pre-trained image classification model 308 to generate classification information 309 of each image.
可选地,上述不定核矩阵305可以通过以下过程获取:用户可以通过终端设备301、302向量子计算机304发送待处理的图像(如图3中303示出的位于图 像空间x的图像x i、x j)。量子计算机304可以利用量子核函数将图像空间x的图像向高维转换,生成不定核矩阵305。之后,量子计算机可以将所生成的不定核矩阵305发送至上述后台服务器306。 Optionally, the above-mentioned indeterminate kernel matrix 305 can be obtained through the following process: the user can send the image to be processed to the quantum computer 304 through the terminal devices 301 and 302 (such as the image xi located in the image space x as shown in 303 in FIG. x j ). The quantum computer 304 can use the quantum kernel function to convert the image of the image space x to a higher dimension to generate an indeterminate kernel matrix 305 . After that, the quantum computer can send the generated indeterminate kernel matrix 305 to the above-mentioned background server 306 .
目前,现有技术之一通常没有考虑当前真实量子计算机的一些局限,导致量子计算机的噪声对基于量子核方法的分类准确度产生不良影响。而本公开的上述实施例提供的方法,通过对基于量子核方法得到的针对图像处理的不定核矩阵对应的特征值对角矩阵中的负值的修正,使得根据修正后的特征值对角矩阵生成的修正后的正定矩阵符合经典核方法的核矩阵要求,降低了量子计算机的噪声对图像分类结果准确度的不良影响,进而通过量子核方法和经典分类模型的结合提升图像分类模型的准确度。Currently, one of the existing techniques usually does not take into account some of the limitations of current real quantum computers, resulting in the noise of the quantum computer adversely affecting the classification accuracy of quantum kernel-based methods. However, in the method provided by the above embodiments of the present disclosure, by modifying the negative values in the eigenvalue diagonal matrix corresponding to the indeterminate kernel matrix for image processing obtained based on the quantum kernel method, the modified eigenvalue diagonal matrix The generated corrected positive definite matrix complies with the kernel matrix requirements of the classical kernel method, which reduces the adverse effect of the noise of the quantum computer on the accuracy of the image classification result, and then improves the accuracy of the image classification model through the combination of the quantum kernel method and the classical classification model. .
进一步参考图4,其示出了基于量子核方法的图像分类方法的一个实施例中训练得到图像分类模型的流程400。该训练得到图像分类模型的流程400,包括以下步骤:Further referring to FIG. 4 , it shows a process 400 of training an image classification model in an embodiment of the image classification method based on the quantum kernel method. The process 400 of obtaining an image classification model by training includes the following steps:
步骤401,获取训练样本。 Step 401, acquiring training samples.
在本实施例中,用于训练图像分类模型的执行主体可以从本地或通信连接的电子设备获取训练样本。其中,上述训练样本可以包括基于量子核方法对样本图像集合进行处理得到的样本不定核矩阵和与上述样本图像集合中的各样本图像对应的标注信息。其中,上述样本不定核矩阵中的元素可以用于表征上述样本图像集合中的样本图像之间的关联关系。In this embodiment, the execution subject for training the image classification model may acquire training samples from a local or communicatively connected electronic device. The above-mentioned training samples may include a sample indeterminate kernel matrix obtained by processing the sample image set based on the quantum kernel method and label information corresponding to each sample image in the above-mentioned sample image set. Wherein, the elements in the sample indeterminate kernel matrix may be used to represent the association relationship between the sample images in the sample image set.
在本实施例中,作为示例,上述样本图像集合中包括的样本图像的总数为n,则上述样本不定核矩阵的维度可以是n×n。其中,上述样本不定核矩阵中第1行、第1列的元素可以用于表征第一个样本图像经量子核函数处理后与其本身的内积。In this embodiment, as an example, the total number of sample images included in the sample image set is n, and the dimension of the sample indeterminate kernel matrix may be n×n. The elements in the first row and the first column in the sample indeterminate kernel matrix can be used to represent the inner product of the first sample image after being processed by the quantum kernel function and itself.
在本实施例的一些可选的实现方式中,上述样本图像集合通常属于原始样本图像集合的核心子集(core-set)。上述样本图像集合中包含的样本图像的数目通常小于第二预设阈值。In some optional implementations of this embodiment, the above-mentioned sample image set generally belongs to a core-set (core-set) of the original sample image set. The number of sample images included in the above-mentioned sample image set is usually less than the second preset threshold.
需要说明的是,发明人发现,图像集合中包含的样本图像的数目在达到一定程度时对图像分类准确性具有较大影响。区别于经典机器学习通常是样本数量越多,学习效果越好,即分类结果的准确性越高。基于量子核方法得到的不定核矩 阵的维度达到一定程度时,分类结果的准确性与经典机器学习相比的优势会有所降低。It should be noted that the inventor found that the number of sample images included in the image set has a great influence on the image classification accuracy to a certain extent. Different from classical machine learning, the larger the number of samples, the better the learning effect, that is, the higher the accuracy of the classification results. When the dimension of the indeterminate kernel matrix obtained by the quantum kernel method reaches a certain level, the accuracy of the classification results will be reduced compared with the advantages of classical machine learning.
基于上述可选的实现方式,本方案可以通过主动学习的查询策略从原始样本图像集合中提取核心子集,使得样本图像集合中包含的样本图像的数目小于第二预设阈值,从而保证使用量子核方法进行图像分类相比于经典计算机的图像分类的准确性优势。Based on the above-mentioned optional implementation manners, this solution can extract core subsets from the original sample image set through an active learning query strategy, so that the number of sample images contained in the sample image set is less than the second preset threshold, thereby ensuring the use of quantum The accuracy advantage of the kernel method for image classification compared to the classical computer image classification.
步骤402,将训练样本的样本不定核矩阵作为输入,将与输入的样本不定核矩阵对应的各样本图像对应的标注信息作为期望输出,训练得到图像分类模型。In step 402, the sample indeterminate kernel matrix of the training sample is used as input, and the annotation information corresponding to each sample image corresponding to the input sample indeterminate kernel matrix is used as the expected output, and an image classification model is obtained by training.
在本实施例中,上述执行主体可以将步骤401获取的训练样本的样本不定核矩阵作为输入,将与输入的样本不定核矩阵对应的各样本图像对应的标注信息作为期望输出,通过机器学习方法训练得到图像分类模型。其中,上述图像分类模型可以包括各种基于核方法的分类模型,例如SVM。In this embodiment, the above-mentioned execution body may use the sample indeterminate kernel matrix of the training sample obtained in step 401 as an input, and use the annotation information corresponding to each sample image corresponding to the input sample indeterminate kernel matrix as the expected output, through the machine learning method. Train to get an image classification model. The above-mentioned image classification models may include various classification models based on kernel methods, such as SVM.
需要说明的是,用于训练图像分类模型的执行主体与用于执行基于量子核方法的图像分类方法的执行主体可以相同或不同,在此不做限定。It should be noted that the executive body used for training the image classification model and the executive body used for executing the image classification method based on the quantum kernel method may be the same or different, which is not limited herein.
从图4中可以看出,本实施例中的基于量子核方法的图像分类方法中训练得到图像分类模型的流程体现了利用包括基于量子核方法对样本图像集合进行处理得到的样本不定核矩阵和与所述样本图像集合中的各样本图像对应的标注信息的训练样本进行模型训练的步骤。由此,本实施例描述的方案提供了一种基于量子核方法的图像分类模型的训练方法,从而提升了图像分类的准确性。It can be seen from FIG. 4 that the process of obtaining an image classification model by training in the image classification method based on the quantum kernel method in this embodiment embodies the sample indeterminate kernel matrix and the The step of performing model training on the training samples of annotation information corresponding to each sample image in the sample image set. Therefore, the solution described in this embodiment provides a training method of an image classification model based on the quantum kernel method, thereby improving the accuracy of image classification.
进一步参考图5,作为对上述各图所示方法的实现,本公开提供了基于量子核方法的图像分类装置的一个实施例,该装置实施例与图2或图4所示的方法实施例相对应,该装置具体可以应用于各种电子设备中。Further referring to FIG. 5 , as an implementation of the methods shown in the above figures, the present disclosure provides an embodiment of an image classification apparatus based on a quantum kernel method, which is similar to the method embodiment shown in FIG. 2 or FIG. 4 . Correspondingly, the apparatus can be specifically applied to various electronic devices.
如图5所示,本实施例提供的基于量子核方法的图像分类装置500包括获取单元501、修正单元502、生成单元503和分类单元504。其中,获取单元501,被配置成获取基于量子核方法对图像集合进行处理得到的不定核矩阵,其中,不定核矩阵中的元素用于表征图像集合中的图像之间的关联关系;修正单元502,被配置成基于对不定核矩阵对应的特征值对角矩阵中的负值的修正,生成修正后的特征值对角矩阵,其中,修正后的特征值对角阵中的特征值为非负值;生成单503元,被配置成根据不定核矩阵对应的特征向量矩阵和修正后的特征值对角矩 阵,生成修正后的正定矩阵;分类单元504,被配置成根据修正后的正定矩阵,利用预先训练的图像分类模型生成图像集合中各图像的分类信息。As shown in FIG. 5 , the image classification apparatus 500 based on the quantum kernel method provided in this embodiment includes an acquisition unit 501 , a correction unit 502 , a generation unit 503 and a classification unit 504 . Wherein, the acquiring unit 501 is configured to acquire an indeterminate kernel matrix obtained by processing the image set based on the quantum kernel method, wherein the elements in the indeterminate kernel matrix are used to represent the correlation between the images in the image set; the modifying unit 502 , is configured to generate a corrected eigenvalue diagonal matrix based on the correction of the negative values in the eigenvalue diagonal matrix corresponding to the indeterminate kernel matrix, wherein the eigenvalues in the corrected eigenvalue diagonal matrix are non-negative value; the generating unit 503 is configured to generate a modified positive definite matrix according to the corresponding eigenvector matrix of the indeterminate kernel matrix and the modified eigenvalue diagonal matrix; the classification unit 504 is configured to, according to the modified positive definite matrix, Use a pre-trained image classification model to generate classification information for each image in the image set.
在本实施例中,基于量子核方法的图像分类装置500中:获取单元501、修正单元502、生成单元503和分类单元504的具体处理及其所带来的技术效果可分别参考图2对应实施例中的步骤201、步骤202、步骤203和步骤204的相关说明,在此不再赘述。In this embodiment, in the image classification apparatus 500 based on the quantum kernel method: the specific processing of the acquisition unit 501 , the correction unit 502 , the generation unit 503 and the classification unit 504 and the technical effects brought by them can be implemented with reference to FIG. 2 respectively. The related descriptions of step 201 , step 202 , step 203 and step 204 in the example will not be repeated here.
在本实施例的一些可选的实现方式中,上述修正单元502可以被进一步配置成:将不定核矩阵对应的特征值对角矩阵中的负值修正为预设值,生成修正后的特征值对角矩阵,其中,预设值为非负值。In some optional implementations of this embodiment, the above-mentioned correcting unit 502 may be further configured to: correct the negative values in the diagonal matrix of eigenvalues corresponding to the indeterminate kernel matrix to preset values, and generate the corrected eigenvalues A diagonal matrix where the default values are non-negative.
在本实施例的一些可选的实现方式中,上述修正单元502可以被进一步配置成:将不定核矩阵对应的特征值对角矩阵中的负值修正为负值的绝对值,生成修正后的特征值对角矩阵。In some optional implementations of this embodiment, the above-mentioned modifying unit 502 may be further configured to: modify the negative value in the eigenvalue diagonal matrix corresponding to the indeterminate kernel matrix to the absolute value of the negative value, and generate a modified Eigenvalue diagonal matrix.
在本实施例的一些可选的实现方式中,上述修正单元502可以被进一步配置成:将不定核矩阵对应的特征值对角矩阵中数值最小的特征值确定为目标值;对于不定核矩阵对应的特征值对角矩阵中的特征值,将该特征值与目标值的绝对值之和确定为修正后的特征值;根据所确定的修正后的特征值,生成修正后的特征值对角矩阵。In some optional implementations of this embodiment, the above modification unit 502 may be further configured to: determine the eigenvalue with the smallest numerical value in the diagonal matrix of eigenvalues corresponding to the indeterminate kernel matrix as the target value; for the indeterminate kernel matrix corresponding to The eigenvalues in the diagonal matrix of eigenvalues of .
在本实施例的一些可选的实现方式中,上述量子核方法所依托的量子计算机的噪声可以小于第一预设阈值。In some optional implementations of this embodiment, the noise of the quantum computer on which the quantum kernel method is based may be smaller than the first preset threshold.
在本实施例的一些可选的实现方式中,上述预先训练的图像分类模型可以通过以下步骤训练得到:获取训练样本,其中,训练样本包括基于量子核方法对样本图像集合进行处理得到的样本不定核矩阵和与样本图像集合中的各样本图像对应的标注信息;将训练样本的样本不定核矩阵作为输入,将与输入的样本不定核矩阵对应的各样本图像对应的标注信息作为期望输出,训练得到图像分类模型。In some optional implementations of this embodiment, the above-mentioned pre-trained image classification model may be obtained by training through the following steps: acquiring training samples, wherein the training samples include indeterminate samples obtained by processing a sample image set based on a quantum kernel method The kernel matrix and the annotation information corresponding to each sample image in the sample image set; the sample indeterminate kernel matrix of the training sample is used as input, and the annotation information corresponding to each sample image corresponding to the input sample indeterminate kernel matrix is used as the expected output. Get an image classification model.
在本实施例的一些可选的实现方式中,上述样本图像集合可以属于原始样本图像集合的核心子集。上述样本图像集合中包含的样本图像的数目可以小于第二预设阈值。In some optional implementations of this embodiment, the above-mentioned sample image set may belong to a core subset of the original sample image set. The number of sample images included in the above-mentioned sample image set may be less than the second preset threshold.
本公开的上述实施例提供的装置,通过修正单元502对获取单元501所获取的基于量子核方法得到的针对图像处理的不定核矩阵对应的特征值对角矩阵中 的负值的修正,使得生成单元503根据修正后的特征值对角矩阵生成的修正后的正定矩阵符合经典核方法的核矩阵要求,降低了量子计算机的噪声对图像分类结果准确度的不良影响,进而通过量子核方法和经典分类模型的结合提升图像分类模型的准确性。In the apparatus provided by the above embodiments of the present disclosure, the correction unit 502 corrects the negative values in the diagonal matrix of eigenvalues corresponding to the indeterminate kernel matrix for image processing obtained by the acquisition unit 501 based on the quantum kernel method, so that the generation of The corrected positive definite matrix generated by the unit 503 according to the corrected eigenvalue diagonal matrix meets the requirements of the kernel matrix of the classical kernel method, which reduces the adverse effect of the noise of the quantum computer on the accuracy of the image classification result. The combination of classification models improves the accuracy of image classification models.
进一步参考图6,其示出了基于量子核方法的图像分类方法的一个实施例中各个设备之间交互的时序600。该基于量子核方法的图像分类系统可以包括:量子计算端(例如图1所示的服务器105)和经典计算端(例如图1所示的服务器107)。上述量子计算端,可以被配置成获取图像集合;利用预设的量子核函数对图像集合进行处理,生成不定核矩阵;将不定核矩阵发送至经典计算端。其中,上述不定核矩阵中的元素可以用于表征图像集合中的图像之间的关联关系。上述经典计算端,可以被配置成实现如前述实施例所描述的基于量子核方法的图像分类方法。With further reference to FIG. 6, a sequence 600 of interactions between various devices in one embodiment of the quantum kernel method-based image classification method is shown. The image classification system based on the quantum kernel method may include: a quantum computing terminal (eg, the server 105 shown in FIG. 1 ) and a classical computing terminal (eg, the server 107 shown in FIG. 1 ). The above quantum computing terminal can be configured to acquire an image set; use a preset quantum kernel function to process the image set to generate an indeterminate kernel matrix; and send the indeterminate kernel matrix to the classical computing terminal. Wherein, the elements in the above-mentioned indeterminate kernel matrix can be used to represent the relationship between the images in the image set. The above-mentioned classical computing terminal can be configured to implement the image classification method based on the quantum kernel method as described in the foregoing embodiments.
如图6所示,在步骤601中,量子计算端获取图像集合。As shown in FIG. 6, in step 601, the quantum computing terminal acquires an image set.
在本实施例中,上述量子计算端可以通过有线或无线连接的方式从本地或通信连接的电子设备(例如图1所示的终端设备101、102、103)获取图像集合。其中,上述图像集合通常可以包括至少一张待分类的图像。In this embodiment, the quantum computing terminal may acquire the image set from a local or communicatively connected electronic device (eg, terminal devices 101, 102, 103 shown in FIG. 1 ) through a wired or wireless connection. Wherein, the above-mentioned image set may generally include at least one image to be classified.
在步骤602中,量子计算端利用预设的量子核函数对图像集合进行处理,生成不定核矩阵。In step 602, the quantum computing terminal uses a preset quantum kernel function to process the image set to generate an indeterminate kernel matrix.
在本实施例中,量子计算端可以利用预设的量子核函数对步骤601所获取的图像集合进行处理,生成不定核矩阵。其中,上述不定核矩阵中的元素可以用于表征上述图像集合中的图像之间的关联关系。上述关联关系可以与前述实施例中的描述一致,此处不再赘述。In this embodiment, the quantum computing end may use a preset quantum kernel function to process the image set acquired in step 601 to generate an indeterminate kernel matrix. Wherein, the elements in the indeterminate kernel matrix can be used to represent the association relationship between the images in the above-mentioned image set. The above-mentioned association relationship may be consistent with the description in the foregoing embodiments, and details are not repeated here.
在步骤603中,量子计算端将不定核矩阵发送至经典计算端。In step 603, the quantum computing terminal sends the indeterminate kernel matrix to the classical computing terminal.
在本实施例中,量子计算端可以将步骤602所生成的不定核矩阵发送至经典计算端。其中,上述经典计算端即与量子计算机相对应的目前广泛采用的常规计算机。In this embodiment, the quantum computing terminal may send the indeterminate kernel matrix generated in step 602 to the classical computing terminal. Among them, the above-mentioned classical computing terminal is the currently widely used conventional computer corresponding to the quantum computer.
在步骤604中,经典计算端获取基于量子核方法对图像集合进行处理得到的不定核矩阵。In step 604, the classical computing terminal obtains the indeterminate kernel matrix obtained by processing the image set based on the quantum kernel method.
在步骤605中,基于对不定核矩阵对应的特征值对角矩阵中的负值的修正, 经典计算端生成修正后的特征值对角矩阵。In step 605, based on the correction of the negative values in the eigenvalue diagonal matrix corresponding to the indeterminate kernel matrix, the classical computing terminal generates a corrected eigenvalue diagonal matrix.
在步骤606中,根据不定核矩阵对应的特征向量矩阵和修正后的特征值对角矩阵,经典计算端生成修正后的正定矩阵。In step 606, according to the eigenvector matrix corresponding to the indefinite kernel matrix and the corrected eigenvalue diagonal matrix, the classical computing terminal generates a corrected positive definite matrix.
在步骤607中,根据修正后的正定矩阵,经典计算端利用预先训练的图像分类模型生成图像集合中各图像的分类信息。In step 607, according to the corrected positive definite matrix, the classical computing terminal generates classification information of each image in the image set by using the pre-trained image classification model.
上述步骤604至步骤607分别与前述实施例中的步骤201至步骤204及其可选的实现方式一致,上文针对步骤201至步骤204及其可选的实现方式的描述也适用于步骤604至步骤607,此处不再赘述。The above steps 604 to 607 are respectively consistent with the steps 201 to 204 and their optional implementations in the foregoing embodiment, and the above descriptions for the steps 201 to 204 and their optional implementations are also applicable to the steps 604 to 204. Step 607 is not repeated here.
本公开的上述实施例提供的基于量子核方法的图像分类系统,通过量子计算端对图像集合进行基于量子核方法的映射处理,生成不定核矩阵,通过经典计算端对基于量子核方法得到的针对图像处理的不定核矩阵对应的特征值对角矩阵中的负值的修正,使得根据修正后的特征值对角矩阵生成的修正后的正定矩阵符合经典核方法的核矩阵要求,降低了量子计算机的噪声对图像分类结果准确度的不良影响,进而通过量子核方法和经典分类模型的结合提升图像分类模型的准确度。The image classification system based on the quantum kernel method provided by the above embodiments of the present disclosure performs mapping processing based on the quantum kernel method on the image set through the quantum computing end to generate an indeterminate kernel matrix, and the classical computing end matches the image obtained by the quantum kernel method. The correction of the negative values in the eigenvalue diagonal matrix corresponding to the indeterminate kernel matrix of image processing makes the corrected positive definite matrix generated according to the corrected eigenvalue diagonal matrix conforms to the kernel matrix requirements of the classical kernel method and reduces the quantum computer. Therefore, the accuracy of the image classification model is improved by the combination of the quantum kernel method and the classical classification model.
下面参考图7,其示出了适于用来实现本公开的实施例的电子设备(例如图1中的服务器107)700的结构示意图。图7示出的服务器仅仅是一个示例,不应对本公开的实施例的功能和使用范围带来任何限制。Referring next to FIG. 7 , it shows a schematic structural diagram of an electronic device (eg, server 107 in FIG. 1 ) 700 suitable for implementing embodiments of the present disclosure. The server shown in FIG. 7 is only an example, and should not impose any limitation on the function and scope of use of the embodiments of the present disclosure.
如图7所示,电子设备700可以包括处理装置(例如中央处理器、图形处理器等)701,其可以根据存储在只读存储器(ROM)702中的程序或者从存储装置708加载到随机访问存储器(RAM)703中的程序而执行各种适当的动作和处理。在RAM 703中,还存储有电子设备700操作所需的各种程序和数据。处理装置701、ROM 702以及RAM 703通过总线704彼此相连。输入/输出(I/O)接口705也连接至总线704。As shown in FIG. 7 , an electronic device 700 may include a processing device (eg, a central processing unit, a graphics processor, etc.) 701 that may be loaded into random access according to a program stored in a read only memory (ROM) 702 or from a storage device 708 Various appropriate actions and processes are executed by the programs in the memory (RAM) 703 . In the RAM 703, various programs and data required for the operation of the electronic device 700 are also stored. The processing device 701, the ROM 702, and the RAM 703 are connected to each other through a bus 704. An input/output (I/O) interface 705 is also connected to bus 704 .
通常,以下装置可以连接至I/O接口705:包括例如触摸屏、触摸板、键盘、鼠标、等的输入装置706;包括例如液晶显示器(LCD,Liquid Crystal Display)、扬声器、振动器等的输出装置707;包括例如磁带、硬盘等的存储装置708;以及通信装置709。通信装置709可以允许电子设备700与其他设备进行无线或有线通信以交换数据。虽然图7示出了具有各种装置的电子设备700,但是应理解 的是,并不要求实施或具备所有示出的装置。可以替代地实施或具备更多或更少的装置。图7中示出的每个方框可以代表一个装置,也可以根据需要代表多个装置。In general, the following devices may be connected to the I/O interface 705: input devices 706 including, for example, a touch screen, touch pad, keyboard, mouse, etc.; output devices including, for example, a Liquid Crystal Display (LCD), speakers, vibrators, etc. 707; storage devices 708 including, for example, magnetic tapes, hard disks, etc.; and communication devices 709. Communication means 709 may allow electronic device 700 to communicate wirelessly or by wire with other devices to exchange data. While Figure 7 illustrates electronic device 700 having various means, it should be understood that not all of the illustrated means are required to be implemented or provided. More or fewer devices may alternatively be implemented or provided. Each block shown in FIG. 7 can represent one device, and can also represent multiple devices as required.
特别地,根据本公开的实施例,上文参考流程图描述的过程可以被实现为计算机软件程序。例如,本公开的实施例包括一种计算机程序产品,其包括承载在计算机可读介质上的计算机程序,该计算机程序包含用于执行流程图所示的方法的程序代码。在这样的实施例中,该计算机程序可以通过通信装置709从网络上被下载和安装,或者从存储装置708被安装,或者从ROM 702被安装。在该计算机程序被处理装置701执行时,执行本公开的实施例的方法中限定的上述功能。In particular, according to embodiments of the present disclosure, the processes described above with reference to the flowcharts may be implemented as computer software programs. For example, embodiments of the present disclosure include a computer program product comprising a computer program carried on a computer-readable medium, the computer program containing program code for performing the method illustrated in the flowchart. In such an embodiment, the computer program may be downloaded and installed from the network via the communication device 709, or from the storage device 708, or from the ROM 702. When the computer program is executed by the processing device 701, the above-described functions defined in the methods of the embodiments of the present disclosure are executed.
需要说明的是,本公开的实施例所述的计算机可读介质可以是计算机可读信号介质或者计算机可读存储介质或者是上述两者的任意组合。计算机可读存储介质例如可以是——但不限于——电、磁、光、电磁、红外线、或半导体的系统、装置或器件,或者任意以上的组合。计算机可读存储介质的更具体的例子可以包括但不限于:具有一个或多个导线的电连接、便携式计算机磁盘、硬盘、随机访问存储器(RAM)、只读存储器(ROM)、可擦式可编程只读存储器(EPROM或闪存)、光纤、便携式紧凑磁盘只读存储器(CD-ROM)、光存储器件、磁存储器件、或者上述的任意合适的组合。在本公开的实施例中,计算机可读存储介质可以是任何包含或存储程序的有形介质,该程序可以被指令执行系统、装置或者器件使用或者与其结合使用。而在本公开的实施例中,计算机可读信号介质可以包括在基带中或者作为载波一部分传播的数据信号,其中承载了计算机可读的程序代码。这种传播的数据信号可以采用多种形式,包括但不限于电磁信号、光信号或上述的任意合适的组合。计算机可读信号介质还可以是计算机可读存储介质以外的任何计算机可读介质,该计算机可读信号介质可以发送、传播或者传输用于由指令执行系统、装置或者器件使用或者与其结合使用的程序。计算机可读介质上包含的程序代码可以用任何适当的介质传输,包括但不限于:电线、光缆、RF(Radio Frequency,射频)等等,或者上述的任意合适的组合。It should be noted that the computer-readable medium described in the embodiments of the present disclosure may be a computer-readable signal medium or a computer-readable storage medium, or any combination of the above two. The computer-readable storage medium can be, for example, but not limited to, an electrical, magnetic, optical, electromagnetic, infrared, or semiconductor system, apparatus or device, or a combination of any of the above. More specific examples of computer readable storage media may include, but are not limited to, electrical connections with one or more wires, portable computer disks, hard disks, random access memory (RAM), read only memory (ROM), erasable Programmable read only memory (EPROM or flash memory), fiber optics, portable compact disk read only memory (CD-ROM), optical storage devices, magnetic storage devices, or any suitable combination of the foregoing. In embodiments of the present disclosure, a 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. Rather, in embodiments of the present disclosure, a computer-readable signal medium may include a data signal in baseband or propagated as part of a carrier wave, carrying computer-readable program code therein. Such propagated data signals may take a variety of forms, including but not limited to electromagnetic signals, optical signals, or any suitable combination of the foregoing. A computer-readable signal medium can also be any computer-readable medium other than a computer-readable storage medium that can transmit, propagate, or transport the program for use by or in connection with the instruction execution system, apparatus, or device . The program code contained on the computer-readable medium can be transmitted by any suitable medium, including but not limited to: electric wire, optical cable, RF (Radio Frequency, radio frequency), etc., or any suitable combination of the above.
上述计算机可读介质可以是上述电子设备中所包含的;也可以是单独存在,而未装配入该服务器中。上述计算机可读介质承载有一个或者多个程序,当上述一个或者多个程序被该服务器执行时,使得该服务器:获取基于量子核方法对图 像集合进行处理得到的不定核矩阵,其中,不定核矩阵中的元素用于表征图像集合中的图像之间的关联关系;基于对不定核矩阵对应的特征值对角矩阵中的负值的修正,生成修正后的特征值对角矩阵,其中,修正后的特征值对角阵中的特征值为非负值;根据不定核矩阵对应的特征向量矩阵和修正后的特征值对角矩阵,生成修正后的正定矩阵;根据修正后的正定矩阵,利用预先训练的图像分类模型生成图像集合中各图像的分类信息。The above-mentioned computer-readable medium may be included in the above-mentioned electronic device; or may exist alone without being assembled into the server. The above-mentioned computer-readable medium carries one or more programs, and when the above-mentioned one or more programs are executed by the server, the server: obtains an indeterminate kernel matrix obtained by processing an image set based on a quantum kernel method, wherein the indeterminate kernel The elements in the matrix are used to characterize the relationship between the images in the image set; based on the correction of the negative values in the eigenvalue diagonal matrix corresponding to the indeterminate kernel matrix, a revised eigenvalue diagonal matrix is generated, where the correction The eigenvalues in the eigenvalue diagonal matrix are non-negative; according to the eigenvector matrix corresponding to the indefinite kernel matrix and the revised eigenvalue diagonal matrix, a revised positive definite matrix is generated; according to the revised positive definite matrix, use The pre-trained image classification model generates classification information for each image in the image collection.
可以以一种或多种程序设计语言或其组合来编写用于执行本公开的实施例的操作的计算机程序代码,所述程序设计语言包括面向对象的程序设计语言—诸如Java、Smalltalk、C++,还包括常规的过程式程序设计语言—诸如“C”、Python语言或类似的程序设计语言。程序代码可以完全地在用户计算机上执行、部分地在用户计算机上执行、作为一个独立的软件包执行、部分在用户计算机上部分在远程计算机上执行、或者完全在远程计算机或服务器上执行。在涉及远程计算机的情形中,远程计算机可以通过任意种类的网络——包括局域网(LAN)或广域网(WAN)—连接到用户计算机,或者,可以连接到外部计算机(例如利用因特网服务提供商来通过因特网连接)。Computer program code for carrying out operations of embodiments of the present disclosure may be written in one or more programming languages, including object-oriented programming languages—such as Java, Smalltalk, C++, or a combination thereof, Also included are conventional procedural programming languages - such as "C", the Python language, or similar programming languages. The program code may execute entirely on the user's computer, partly on the user's computer, as a stand-alone software package, partly on the user's computer and partly on a remote computer, or entirely on the remote computer or server. In the case of a remote computer, the remote computer may be connected to the user's computer through any kind of network, including a local area network (LAN) or a wide area network (WAN), or may be connected to an external computer (eg, using an Internet service provider through Internet connection).
附图中的流程图和框图,图示了按照本公开的各种实施例的系统、方法和计算机程序产品的可能实现的体系架构、功能和操作。在这点上,流程图或框图中的每个方框可以代表一个模块、程序段、或代码的一部分,该模块、程序段、或代码的一部分包含一个或多个用于实现规定的逻辑功能的可执行指令。也应当注意,在有些作为替换的实现中,方框中所标注的功能也可以以不同于附图中所标注的顺序发生。例如,两个接连地表示的方框实际上可以基本并行地执行,它们有时也可以按相反的顺序执行,这依所涉及的功能而定。也要注意的是,框图和/或流程图中的每个方框、以及框图和/或流程图中的方框的组合,可以用执行规定的功能或操作的专用的基于硬件的系统来实现,或者可以用专用硬件与计算机指令的组合来实现。The flowchart and block diagrams in the Figures illustrate the architecture, functionality, and operation of possible implementations of systems, methods and computer program products according to various embodiments of the present disclosure. In this regard, each block in the flowchart or block diagrams may represent a module, segment, or portion of code that contains one or more logical functions for implementing the specified functions executable instructions. It should also be noted that, in some alternative implementations, the functions noted in the blocks may occur out of the order noted in the figures. For example, two blocks shown in succession may, in fact, be executed substantially concurrently, or the blocks may sometimes be executed in the reverse order, depending upon the functionality involved. It is also noted that each block of the block diagrams and/or flowchart illustrations, and combinations of blocks in the block diagrams and/or flowchart illustrations, can be implemented in dedicated hardware-based systems that perform the specified functions or operations , or can be implemented in a combination of dedicated hardware and computer instructions.
描述于本公开的实施例中所涉及到的单元可以通过软件的方式实现,也可以通过硬件的方式来实现。所描述的单元也可以设置在处理器中,例如,可以描述为:一种处理器,包括获取单元、修正单元、生成单元、分类单元。其中,这些单元的名称在某种情况下并不构成对该单元本身的限定,例如,获取单元还可以被描述为“获取基于量子核方法对图像集合进行处理得到的不定核矩阵的单元, 其中,不定核矩阵中的元素用于表征图像集合中的图像之间的关联关系”。The units involved in the embodiments of the present disclosure may be implemented in software or hardware. The described unit may also be set in the processor, for example, it may be described as: a processor, including an acquisition unit, a correction unit, a generation unit, and a classification unit. Among them, the names of these units do not constitute a limitation of the unit itself in some cases. For example, the acquisition unit can also be described as "a unit that acquires an indeterminate kernel matrix obtained by processing an image set based on a quantum kernel method, where , the elements in the indeterminate kernel matrix are used to characterize the association between the images in the image collection".
以上描述仅为本公开的较佳实施例以及对所运用技术原理的说明。本领域技术人员应当理解,本公开的实施例中所涉及的发明范围,并不限于上述技术特征的特定组合而成的技术方案,同时也应涵盖在不脱离上述发明构思的情况下,由上述技术特征或其等同特征进行任意组合而形成的其它技术方案。例如上述特征与本公开的实施例中公开的(但不限于)具有类似功能的技术特征进行互相替换而形成的技术方案。The above description is merely a preferred embodiment of the present disclosure and an illustration of the technical principles employed. Those skilled in the art should understand that the scope of the invention involved in the embodiments of the present disclosure is not limited to the technical solution formed by the specific combination of the above-mentioned technical features, and should also cover, without departing from the above-mentioned inventive concept, the above-mentioned Other technical solutions formed by any combination of technical features or their equivalent features. For example, a technical solution is formed by replacing the above-mentioned features with the technical features disclosed in the embodiments of the present disclosure (but not limited to) with similar functions.

Claims (11)

  1. 一种基于量子核方法的图像分类方法,包括:An image classification method based on the quantum kernel method, including:
    获取基于量子核方法对图像集合进行处理得到的不定核矩阵,其中,所述不定核矩阵中的元素用于表征所述图像集合中的图像之间的关联关系;obtaining an indeterminate kernel matrix obtained by processing an image set based on a quantum kernel method, wherein the elements in the indeterminate kernel matrix are used to characterize the correlation between the images in the image set;
    基于对所述不定核矩阵对应的特征值对角矩阵中的负值的修正,生成修正后的特征值对角矩阵,其中,所述修正后的特征值对角阵中的特征值为非负值;Based on the correction of the negative values in the eigenvalue diagonal matrix corresponding to the indefinite kernel matrix, a revised eigenvalue diagonal matrix is generated, wherein the eigenvalues in the revised eigenvalue diagonal matrix are non-negative value;
    根据所述不定核矩阵对应的特征向量矩阵和所述修正后的特征值对角矩阵,生成修正后的正定矩阵;According to the eigenvector matrix corresponding to the indefinite kernel matrix and the modified eigenvalue diagonal matrix, a modified positive definite matrix is generated;
    根据所述修正后的正定矩阵,利用预先训练的图像分类模型生成所述图像集合中各图像的分类信息。According to the corrected positive definite matrix, a pre-trained image classification model is used to generate classification information of each image in the image set.
  2. 根据权利要求1所述的方法,其中,所述基于对所述不定核矩阵对应的特征值对角矩阵中的负值的修正,生成修正后的特征值对角矩阵,包括:The method according to claim 1, wherein, generating a corrected eigenvalue diagonal matrix based on the correction of negative values in the eigenvalue diagonal matrix corresponding to the indeterminate kernel matrix, comprising:
    将所述不定核矩阵对应的特征值对角矩阵中的负值修正为预设值,生成修正后的特征值对角矩阵,其中,所述预设值为非负值。The negative values in the eigenvalue diagonal matrix corresponding to the indeterminate kernel matrix are corrected to a preset value, and a corrected eigenvalue diagonal matrix is generated, wherein the preset value is a non-negative value.
  3. 根据权利要求1所述的方法,其中,所述基于对所述不定核矩阵对应的特征值对角矩阵中的负值的修正,生成修正后的特征值对角矩阵,包括:The method according to claim 1, wherein, generating a corrected eigenvalue diagonal matrix based on the correction of negative values in the eigenvalue diagonal matrix corresponding to the indeterminate kernel matrix, comprising:
    将所述不定核矩阵对应的特征值对角矩阵中的负值修正为所述负值的绝对值,生成修正后的特征值对角矩阵。Correcting the negative values in the eigenvalue diagonal matrix corresponding to the indeterminate kernel matrix to the absolute value of the negative values, and generating the corrected eigenvalue diagonal matrix.
  4. 根据权利要求1所述的方法,其中,所述基于对所述不定核矩阵对应的特征值对角矩阵中的负值的修正,生成修正后的特征值对角矩阵,包括:The method according to claim 1, wherein, generating a corrected eigenvalue diagonal matrix based on the correction of negative values in the eigenvalue diagonal matrix corresponding to the indeterminate kernel matrix, comprising:
    将所述不定核矩阵对应的特征值对角矩阵中数值最小的特征值确定为目标值;Determine the eigenvalue with the smallest numerical value in the eigenvalue diagonal matrix corresponding to the indefinite kernel matrix as the target value;
    对于所述不定核矩阵对应的特征值对角矩阵中的特征值,将该特征值与所述目标值的绝对值之和确定为修正后的特征值;For the eigenvalue in the eigenvalue diagonal matrix corresponding to the indefinite kernel matrix, the sum of the absolute value of the eigenvalue and the target value is determined as the corrected eigenvalue;
    根据所确定的修正后的特征值,生成修正后的特征值对角矩阵。Based on the determined corrected eigenvalues, a corrected eigenvalue diagonal matrix is generated.
  5. 根据权利要求1所述的方法,其中,所述量子核方法所依托的量子计算机的噪声小于第一预设阈值。The method according to claim 1, wherein the noise of the quantum computer on which the quantum kernel method relies is smaller than a first preset threshold.
  6. 根据权利要求1-5任一所述的方法,其中,所述预先训练的图像分类模型通过以下步骤训练得到:The method according to any one of claims 1-5, wherein the pre-trained image classification model is obtained by training through the following steps:
    获取训练样本,其中,所述训练样本包括基于量子核方法对样本图像集合进行处理得到的样本不定核矩阵和与所述样本图像集合中的各样本图像对应的标注信息;Obtaining a training sample, wherein the training sample includes a sample indeterminate kernel matrix obtained by processing a sample image set based on a quantum kernel method and annotation information corresponding to each sample image in the sample image set;
    将所述训练样本的样本不定核矩阵作为输入,将与输入的样本不定核矩阵对应的各样本图像对应的标注信息作为期望输出,训练得到所述图像分类模型。The image classification model is obtained by training the sample indefinite kernel matrix of the training sample as input, and the label information corresponding to each sample image corresponding to the input sample indeterminate kernel matrix as expected output.
  7. 根据权利要求6所述的方法,其中,所述样本图像集合属于原始样本图像集合的核心子集,所述样本图像集合中包含的样本图像的数目小于第二预设阈值。The method according to claim 6, wherein the sample image set belongs to a core subset of the original sample image set, and the number of sample images included in the sample image set is less than a second preset threshold.
  8. 一种基于量子核方法的图像分类装置,包括:An image classification device based on quantum kernel method, comprising:
    获取单元,被配置成获取基于量子核方法对图像集合进行处理得到的不定核矩阵,其中,所述不定核矩阵中的元素用于表征所述图像集合中的图像之间的关联关系;an acquiring unit, configured to acquire an indeterminate kernel matrix obtained by processing an image set based on a quantum kernel method, wherein the elements in the indeterminate kernel matrix are used to characterize the relationship between the images in the image set;
    修正单元,被配置成基于对所述不定核矩阵对应的特征值对角矩阵中的负值的修正,生成修正后的特征值对角矩阵,其中,所述修正后的特征值对角阵中的特征值为非负值;a correction unit, configured to generate a corrected eigenvalue diagonal matrix based on the correction of negative values in the eigenvalue diagonal matrix corresponding to the indefinite kernel matrix, wherein, in the corrected eigenvalue diagonal matrix The eigenvalues of are non-negative;
    生成单元,被配置成根据所述不定核矩阵对应的特征向量矩阵和所述修正后的特征值对角矩阵,生成修正后的正定矩阵;a generating unit, configured to generate a modified positive definite matrix according to the eigenvector matrix corresponding to the indefinite kernel matrix and the modified eigenvalue diagonal matrix;
    分类单元,被配置成根据所述修正后的正定矩阵,利用预先训练的图像分类模型生成所述图像集合中各图像的分类信息。The classification unit is configured to use a pre-trained image classification model to generate classification information of each image in the image set according to the modified positive definite matrix.
  9. 一种基于量子核方法的图像分类系统,包括:An image classification system based on the quantum kernel method, including:
    量子计算端,被配置成获取图像集合;利用预设的量子核函数对所述图像集合进行处理,生成不定核矩阵,其中,所述不定核矩阵中的元素用于表征所述图 像集合中的图像之间的关联关系;将所述不定核矩阵发送至经典计算端;The quantum computing end is configured to acquire an image set; use a preset quantum kernel function to process the image set to generate an indeterminate kernel matrix, wherein the elements in the indefinite kernel matrix are used to represent the images in the image set. correlation between images; send the indeterminate kernel matrix to the classical computing terminal;
    所述经典计算端,被配置成执行实现如权利要求1-7中任一所述的方法。The classical computing terminal is configured to execute the method according to any one of claims 1-7.
  10. 一种服务器,包括:A server that includes:
    一个或多个处理器;one or more processors;
    存储装置,其上存储有一个或多个程序;a storage device on which one or more programs are stored;
    当所述一个或多个程序被所述一个或多个处理器执行,使得所述一个或多个处理器实现如权利要求1-7中任一所述的方法。The one or more programs, when executed by the one or more processors, cause the one or more processors to implement the method of any of claims 1-7.
  11. 一种计算机可读介质,其上存储有计算机程序,其中,该程序被处理器执行时实现如权利要求1-7中任一所述的方法。A computer-readable medium having a computer program stored thereon, wherein the program, when executed by a processor, implements the method of any one of claims 1-7.
PCT/CN2022/070264 2021-03-29 2022-01-05 Quantum kernel method-based image classification method and apparatus, server, and system WO2022206092A1 (en)

Applications Claiming Priority (2)

Application Number Priority Date Filing Date Title
CN202110334853.9A CN115222948A (en) 2021-03-29 2021-03-29 Image classification method, device, server and system based on quantum kernel method
CN202110334853.9 2021-03-29

Publications (1)

Publication Number Publication Date
WO2022206092A1 true WO2022206092A1 (en) 2022-10-06

Family

ID=83457888

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/CN2022/070264 WO2022206092A1 (en) 2021-03-29 2022-01-05 Quantum kernel method-based image classification method and apparatus, server, and system

Country Status (2)

Country Link
CN (1) CN115222948A (en)
WO (1) WO2022206092A1 (en)

Citations (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN109978064A (en) * 2019-03-29 2019-07-05 苏州大学 Lie group dictionary learning classification method based on image set
CN110781766A (en) * 2019-09-30 2020-02-11 广州大学 Grassmann manifold discriminant analysis image recognition method based on characteristic spectrum regularization

Patent Citations (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN109978064A (en) * 2019-03-29 2019-07-05 苏州大学 Lie group dictionary learning classification method based on image set
CN110781766A (en) * 2019-09-30 2020-02-11 广州大学 Grassmann manifold discriminant analysis image recognition method based on characteristic spectrum regularization

Non-Patent Citations (1)

* Cited by examiner, † Cited by third party
Title
IVÁN GARCÍA-HERNÁNDEZ HÉCTOR, TORRES-RUIZ RAYMUNDO, SUN GUO-HUA: "Image Classification via Quantum Machine Learning", ARXIV: 2011.02831V2, 22 December 2020 (2020-12-22), XP055973755, Retrieved from the Internet <URL:https://arxiv.org/pdf/2011.02831.pdf> [retrieved on 20221021] *

Also Published As

Publication number Publication date
CN115222948A (en) 2022-10-21

Similar Documents

Publication Publication Date Title
CN108509915B (en) Method and device for generating face recognition model
WO2020155907A1 (en) Method and apparatus for generating cartoon style conversion model
CN108898186B (en) Method and device for extracting image
CN107633218B (en) Method and apparatus for generating image
WO2020000879A1 (en) Image recognition method and apparatus
US20190087686A1 (en) Method and apparatus for detecting human face
US11436863B2 (en) Method and apparatus for outputting data
CN108416310B (en) Method and apparatus for generating information
WO2020062493A1 (en) Image processing method and apparatus
WO2023005386A1 (en) Model training method and apparatus
WO2022105118A1 (en) Image-based health status identification method and apparatus, device and storage medium
EP4006909B1 (en) Method, apparatus and device for quality control and storage medium
WO2022007651A1 (en) Data protection method and apparatus, and server and medium
WO2020211573A1 (en) Method and device for processing image
US20210200971A1 (en) Image processing method and apparatus
WO2020244151A1 (en) Image processing method and apparatus, terminal, and storage medium
WO2022105536A1 (en) Method and apparatus for generating page
CN111311480A (en) Image fusion method and device
CN117315758A (en) Facial expression detection method and device, electronic equipment and storage medium
CN110046670B (en) Feature vector dimension reduction method and device
WO2022206092A1 (en) Quantum kernel method-based image classification method and apparatus, server, and system
WO2020006962A1 (en) Method and device for processing picture
WO2022194130A1 (en) Character position correction method and apparatus, electronic device and storage medium
JP2023085353A (en) Feature extraction model training method, image classifying method, and related apparatus
WO2022206091A1 (en) Data generation method and apparatus

Legal Events

Date Code Title Description
121 Ep: the epo has been informed by wipo that ep was designated in this application

Ref document number: 22778281

Country of ref document: EP

Kind code of ref document: A1

NENP Non-entry into the national phase

Ref country code: DE

32PN Ep: public notification in the ep bulletin as address of the adressee cannot be established

Free format text: NOTING OF LOSS OF RIGHTS PURSUANT TO RULE 112(1) EPC (EPO FORM 1205A DATED 13/02/2024)