Skip to main content
Figure 3 | EPJ Quantum Technology

Figure 3

From: Quantum adversarial metric learning model based on triplet loss function

Figure 3

Overview of quantum adversarial metric learning (QAML) model. Panel (a) shows the framework of quantum adversarial metric learning. \(\mathit{Reg}.s\) is the sample register that stores triplet sets, and \(\mathit{Reg}.1\) and \(\mathit{Reg}.2\) are ancilla registers used distinguishing different samples. The model firstly adopts principal component analysis (PCA) to reduce the input dimension. Subsequently, anchor, negative and positive samples are encoded into a quantum superposition state by controlled qubit encoding. The transformation of Hilbert space is implemented by parameterized quantum circuit \(W(\theta )\) and the subsequent qubit encoding \(U_{1}(x_{i})\). Finally, Hadamard and measurement operations act on ancilla registers to simultaneously compute the inner products for the positive and negative sample pairs, and the triplet loss function is further obtained. In each iteration, the parameters θ are updated by optimizing the triplet loss function with a classical optimizer. Panel (b) shows the quantum dimension reduction circuit to reduce the number of output qubits. In each module, only one qubit is measured, and the controlled unitary based on its measurement result acts on another qubit. Panel (c) shows another case of the QAML model, where adversarial samples are built and added to the training process. \(V^{\prime }(\lambda \nabla _{i}^{a})\) is the unitary operation based on the gradient of anchor sample \(x_{i}^{a}\) and acts on the encoded quantum states to produce its adversarial sample. In the QAML model training process, natural and adversarial samples alternatively serve as input

Back to article page