Facial Expression Recognition on a Quantum Computer
Riccardo Mengoni, Massimiliano Incudini, Alessandra Di Pierro
FFacial Expression Recognition on a QuantumComputer
Riccardo Mengoni, Massimiliano Incudini, Alessandra Di Pierro
Department of Computer ScienceUniversity of Verona, Italy
Abstract
We address the problem of facial expression recognition and showa possible solution using a quantum machine learning approach. Inorder to define an efficient classifier for a given dataset, our approachsubstantially exploits quantum interference. By representing face ex-pressions via graphs, we define a classifier as a quantum circuit thatmanipulates the graphs adjacency matrices encoded into the ampli-tudes of some appropriately defined quantum states.We discuss the accuracy of the quantum classifier evaluated on thequantum simulator available on the IBM Quantum Experience cloudplatform, and compare it with the accuracy of one of the best classicalclassifier.
Keywords :Quantum Machine Learning, Quantum Computing, GraphTheory, Facial Expression Recognition
A modern approach to Pattern Recognition is the use of Machine Learn-ing (ML) and, in particular, of supervised learning algorithms for patternclassification. This task essentially consists in assigning a class in a givenpartition of a dataset to an input value, on the basis of a set of trainingdata whose classes are known. As witnessed by the emerging of the field ofQuantum Machine Learning (QML) [4, 18, 20], Quantum Computation [11]offers a number of algorithmic techniques that can be advantageously applied1 a r X i v : . [ qu a n t - ph ] F e b or reducing the complexity of classical learning algorithms. This possibilityhas been variously explored for pattern classification, see e.g. [17] and thereferences therein, and the more recent paper [12].One of the most important application of pattern classification is FacialExpression Recognition [14]. In this field, graph theory [5] provides a suitablemathematical model of a human face. In this paper we address the problemof graph classification for implementing the final stage of a facial expressionrecognition system, namely the stage where an expression, described by a setof features, is assigned to one of several classes representing basic emotionssuch as anger, happiness, sadness, joy, etc.Starting from a set of features that were retrieved from a face region in aprevious stage, we associate a graph representation to each facial expressionby following two alternative strategies: one generates complete graphs, whilethe other uses a triangulation algorithm to output meshed graphs. We thendefine a quantum supervised learning algorithm that recognizes input imagesby assigning a specific class label to each of them.A crucial passage of our method is the representation of graphs as quan-tum states, for which we will make use of the amplitude encoding technique,i.e. the encoding of the input features into the amplitudes of a quantumstate and their manipulation through quantum gates. Since a state of n qubits is described by n complex amplitudes, such an encoding automati-cally produces an exponential compression of the data. Combined with anappropriate use of quantum interference, this technique is at the base of thecomputational speed-up of many quantum algorithms; for example it is re-sponsible for the exponential speed-up in the performance of all quantumalgorithms based on the Quantum Fourier Transform [11]. However, in ourcontext, an exponential speedup of the overall algorithm is not to be taken forgranted, as the nature of the data may require a computationally expensiveinitialization of the quantum state.The quantum circuit we construct is inspired by the work in [16]. Thiscircuit performs a classification similar to the k-nearest neighbors classifica-tion algorithm used in classical ML, but exploits quantum operations withno classical counterpart, such as those that realize quantum interference:Hadamard gates are used to interfere the new input with the training inputsin a way that a final measurement of a class qubit identifies the class of theinput. As already pointed out in [16], this approach uses quantum techniquesfor implementing ML tasks rather than simply translating ML algorithms formaking them run on a quantum computer.2e show the results of an experimental testing of our algorithm that wehave performed by using the IBM open-source quantum computing softwaredevelopment framework Qiskit [1]. We compare the results obtained on thisquantum simulator with those obtained by using a classical algorithm thatalso uses distances for classifying the data. Our experiments show that theaccuracy of the quantum classification follows very closely that of the classicalclassification if we use the meshed strategy for representing the input data. Inthe complete graph approach we observe, instead, a much better performanceof the classical algorithm. We will argue that this can be explained in termsof the preliminary encoding of the data into quantum states and the highererror rate in the implementation of the complete graphs approach.This paper is structured as follows. In Section 2, we introduce the datasetemployed for face recognition as well as the preprocessing methodology thatextracts a meaningful graph representation of the data. In Section 3 we ex-plain how to define an encoding of face graphs into quantum states. Section 4and Section 5 are devoted to the construction of the quantum classificationcircuit, the explanation of the algorithms implementing it, and a discussionof our experimental results. Finally, in Section 6 we draw a conclusion andgive directions for possible improvements. For our experiments we use the freely available Extended Cohn-Kanade(CK+) database [8]. This collects multiple photos of people labeled by theirfacial expression, as in the examples shown in the left-hand side of Fig. 1 andFig. 2. Each photo is identified with a point cloud of points, ( x, y ) ∈ R ,as shown in the right hand side of Fig. 1 and Fig. 2.From this point cloud we select only those 20 points associated to the mouth as shown in Fig. 3 for the happy expression.With the objective of using this dataset for the inputs of a quantumcircuit implementing a classifier of expressions, we first associate a graph toeach object of the data set by following two alternative strategies.The first strategy considers the weighted complete graph whose verticesare the n landmark points of the mouth and whose edge-weights w ij corre-spond to the Euclidean distance of vertex i from vertex j . Since a complete We will consider here only parts of a facial expression in order to keep the encodingas simple as possible for the sake of the experiments feasibility. n vertices has n ( n − / edges, its construction requires O ( n ) steps.The second strategy is based on the Delaunay triangulation of a set S of n points in R [3]. This is a technique for subdividing a planar object into tri-angles (and a general geometric object in R d into simplices), which constructsa partition of R in triangles (or polyhedral in R d ) as follows: for each point p in the set S , consider the convex hulls of the set of points that are closer to p than to any other point in S , with respect to the Euclidean distance; thentake all the convex hulls together with their faces. The most straightforwardalgorithm finds the Delaunay triangulation of a set of n points in O ( n ) byrandomly adding one vertex at a time and triangulating again the affectedparts of the graph. However, it is possible to improve this algorithm andreduce the runtime to O ( n log n ) as shown in [7]. By applying the Delaunaytriangulation to the points of the mouth of the facial expressions, we obtainmeshed weighted graphs, where weights are the same as those used for thecomplete graphs.Given a mouth landmark point cloud as in Fig.3, the outputs of thesetwo strategies are shown in Figure 4.Clearly, one can expect that a classification based on the complete graphsstrategy gives a higher accuracy than the meshed one, as it can exploit aricher description of the data. As we will see later, although this is true forthe classical case, the quantum algorithm we present may achieve a betteraccuracy with the meshed strategy, due to a lower error rate occurring inthis case (matrices are sparser than those for complete graphs). Consider an undirected simple graph G = ( V G , E G ) , where V G is the set ofvertices and E G the set of edges in G . By fixing an ordering of the vertices { v i } i =1 ,..n , a graph G is uniquely identified by its adjacency matrix A G withgeneric element a ij = (cid:40) if e ij ∈ E G , if e ij / ∈ E G . Therefore if the cardinality of V G is n , i.e. the graph G has n vertices, then A G is a n × n square matrix with zeros on the diagonal. Since we are dealingwith undirected simple graphs, A G is also symmetric and this means that the5 omplete graphMeshed graph Figure 4: Complete and meshed graphs obtained from the mouth landmarkpoints of the happy face, using all the 20 nodes that identify the mouth.6eaningful information about graph G is contained in the d = ( n − n ) / elements of the upper triangular part of A G . We can now vectorize thoseelements and rename them as follows: a G = (cid:0) a , a , .., a n , a , .., a n , .., a ( n − n (cid:1) T = (cid:16) g ( G )1 , g ( G )2 , .., g ( G ) d (cid:17) T (1)where g ( G ) k ≡ a i,j for k = i × n − i ( i + 1)2 − n + j. Following the approach in [15], from vector a G we construct a quantumstate | G (cid:105) associated to graph G by encoding the elements of the adjacencyvector into the amplitudes of the quantum state: | G (cid:105) = 1 γ d (cid:88) k =1 g k | k (cid:105) , (2)where γ is a normalization constant given by γ = (cid:115) (cid:88) { k s . t . g k (cid:54) =0 } | g k | . (3)This encoding can be extended to the case of weighted graphs G = ( V G , E G , w ij ) ,where w ij ∈ R ≥ is the weight associated to the edge e ij ∈ E G . In this case,the adjacency matrix is defined as a ij = (cid:40) w ij if e ij ∈ E G , if e ij / ∈ E G . Quantum state encoding is then performed as in Equations (1), (2), (3).This allows us to represent a classical vector of d elements into a quantumstate of N = (cid:100) log( d ) (cid:101) qubits, i.e., in our case, with a number of qubits thatgrows linearly with the number n of the graph vertices.On the IBM Qiskit framework [1], states expressed by Equation (2) arerealized by using a method proposed by Shende et al. in [19]. This methodis based on an asymptotically-optimal algorithm for the initialization of aquantum register, which exploits the fact that an arbitrary n -qubit state canbe decomposed into a separable (i.e. unentangled) state by applying the twocontrolled rotation R z and R y . By recursively applying this transformation7o the n -qubit register with the desired target state (i.e. | G (cid:105) , in our case),we can construct a circuit that takes it to the n -qubit | ... (cid:105) state. This canbe done using a quantum multiplexor circuit U , which is finally reversed inorder to get the desired initialization circuit. In our case, we identify suchan initialization circuit with the unitary G that manipulates a register of N qubits initially in | (cid:105) as follows: G | ... (cid:105) = | G (cid:105) , where G represents the following circuit with elementary components CX , R y ( θ ) and R z ( φ ) : G = R y ( − θ ) R z ( − φ ) R y ( − θ ) R z ( − φ ) . . . R y ( − θ N − − ) R z ( − φ N − − ) † Unfortunately, the construction of G in this way requires O (2 N +1 ) gates,thus representing a bottleneck for our algorithm. It will be the subject offuture work to try different state preparation schemes by investigating otherapproaches such as those in [2, 6, 10, 13, 13, 21]. Let’s select n = 4 random vertices among those belonging to the mouthlandmark points. The complete graph constructed for these points looks likethe one in Fig. 5.Such a graph is encoded into the quantum state | G (cid:105) defined by | G (cid:105) = 1 γ ( g | (cid:105) + g | (cid:105) + g | (cid:105) + g | (cid:105) + g | (cid:105) + g | (cid:105) ) , where γ is a normalization constant. The quantum circuit G that realizes | G (cid:105) , i.e. such that G | (cid:105) = | G (cid:105) , via the method proposed by Shende etal. in [19] is shown in Fig.6, where the gate U ( θ ) is defined by U ( θ ) = (cid:20) cos( θ/ − sin( θ/ θ/
2) cos( θ/ (cid:21) a : | (cid:105) X >b : | (cid:105) X U ( . ) X U ( . ) >c : | (cid:105) U ( . ) • • • >a : U ( . ) X U ( − . ) X X X >b : • • • >c : • >a : U ( . ) X U ( . ) X X b : • • c : • Figure 6: Quantum circuit constructing the state G . Three qubits areemployed in the circuit, which are denoted by a , b and c .9s claimed before, this algorithm is exponential in the number of theinput qubits and represents a bottleneck to the speed of the whole algorithm.Thus, finding a more efficient encoding of the data into quantum states iscrucial for achieving a better performance of the overall algorithm we aregoing to define in the next section. This would also benefit from a morecomplex connection between physical qubits in the hardware that would allowus to reduce the number of swap gates used to adapt the quantum circuit tothe topology of the quantum computer. The first implementation of a quantum classifier on the IBM quantum com-puter appears in [16], where data are encoded in a single qubit state. Weextend the work in that paper by constructing a circuit that is able to dealwith multiple qubit state representations of a dataset.Given a dataset D , consider the training set, D train = { ( G { } , y { } ) , ..., ( G { M } , y { M } ) } , of M pairs ( G { m } , y { m } ) , where G { m } are graphs (e.g. representing the faceof an individual) while y { m } ∈ { c l } Ll =1 identify which of the L possible classlabels are associated to a graph. Classes partition graphs according to somefeatures, which in our case correspond to sad vs happy face expressions.Given a new unlabeled input G test , the task is to assign a label y test to G test using the distance d ( G , G ) = (cid:112) | a G − a G | = (cid:118)(cid:117)(cid:117)(cid:116) d (cid:88) i =1 (cid:12)(cid:12)(cid:12) g ( G ) i − g ( G ) i (cid:12)(cid:12)(cid:12) , and then classifying according to min c l (cid:88) m s.t. y { m } = c l d (cid:0) G test , G { m } (cid:1) . (4)In the case of binary classification, where there are only two classes, i.e. y { m } ∈ { +1 , − } , the classifier of Equation (4) can be expressed as y test = − sgn (cid:34) M (cid:88) m =1 y { m } d (cid:0) G test , G { m } (cid:1)(cid:35) . (5)10he quantum circuit that implements such a classification requires fourmulti-qubit quantum registers. In the initial configuration,• | (cid:105) a is an ancillary qubit that is entangled to the qubits encoding boththe test graph and the training graphs;• | .. (cid:105) m is a register of (cid:100) log( M ) (cid:101) qubits that stores the index m of thetraining graphs G { m } ;• | .. (cid:105) g is a register of (cid:100) log( d ) (cid:101) qubits used to encode both test andtraining graphs;• | .. (cid:105) c is a register of (cid:100) log( L ) (cid:101) qubits that stores the classes y { m } ∈{ c l } Ll =1 of the G { m } .In the case of a training set of two graphs, one per class, the circuit isimplemented as shown in Fig. (7). | (cid:105) a H • X • • H a | (cid:105) m H • X • •| .. (cid:105) g G test G { } G { } | (cid:105) c c Figure 7: Quantum binary classifier circuit.After the first two Hadamard gates, the circuit is in state
12 ( | (cid:105) a + | (cid:105) a ) ( | (cid:105) m + | (cid:105) m ) | .. (cid:105) g | (cid:105) c . The
Control - G test gate, followed by an X operator on the ancilla producesthe state | G test (cid:105) = 1 γ test d (cid:88) k =1 g testk | k (cid:105) , | (cid:105) a state of the ancilla. Then a G { } gate iscontrolled by both the first qubit a and by the second one m , which is alsosubjected to an X gate afterwards. This has the effect of creating the stateassociated to the training graph G { } , namely | G { } (cid:105) = 1 γ { } d (cid:88) k =1 g { } k | k (cid:105) , and entangling it with both | (cid:105) a and | (cid:105) m . Then, the double controlled G { } gate has a similar effect, entangling the second training graph state | G { } (cid:105) with | (cid:105) a and | (cid:105) m . At this stage, the Control - X gate entangles the m indexof the two test graphs with the correct class state, i.e. either | (cid:105) c or | (cid:105) c . Thestate of the circuit at this point can be written as √ M M − (cid:88) m =0 (cid:16) | (cid:105) a | G test (cid:105) g + | (cid:105) a | G { m } (cid:105) g (cid:17) | m (cid:105) m | y { m } (cid:105) c . Finally, the Hadamard gate applied to the ancilla generates the state √ M M − (cid:88) m =0 (cid:104) | (cid:105) a (cid:0) | G test (cid:105) g + | G { m } (cid:105) g (cid:1) + | (cid:105) a (cid:0) | G test (cid:105) g − | G { m } (cid:105) g (cid:1) (cid:105) | m (cid:105) m | y { m } (cid:105) c . Measuring the ancilla in the state | (cid:105) a produces the state (cid:113)(cid:80) m (cid:80) i | g ( G test ) i + g ( G { m } ) i | M − (cid:88) m =0 d (cid:88) i =1 (cid:16) g ( G test ) i + g ( G { m } ) i (cid:17) | i (cid:105) g | m (cid:105) m | y { m } (cid:105) c , and a subsequent measurement of the class qubit | y { m } (cid:105) gives the outcomecorresponding to state | (cid:105) c with probability p( y { m } = 0) = 1 (cid:80) m (cid:80) i | g ( G test ) i + g ( G { m } ) i | (cid:88) m s.t. y { m } =0 d (cid:88) i =1 (cid:12)(cid:12)(cid:12) g ( G test ) i + g ( G { m } ) i (cid:12)(cid:12)(cid:12) == 1 − (cid:80) m (cid:80) i | g ( G test ) i + g ( G { m } ) i | (cid:88) m s.t. y { m } =0 d ( G test , G { m } ) . This probability depends on the distance between the test graph G test andall those training graphs belonging to the class c = 0 . Therefore, if its valueis lower than . , then the test set is classified as y class = − while if it ishigher, then the test set is classified as y class = +1 . The quantum circuithence realizes the classification expressed by Equation (5).12 Classification Algorithm and Experimental Re-sults
The number of qubits used by the quantum classifier scales with the number, n , of vertices in the graphs, which are randomly selected among those ofthe mouth landmark points. As shown in Table 1 the encoding allows foran exponential compression of resources since only a number O ( log ( n )) ofqubits are needed to represent a complete graph of n nodes. In the table,the number of elements in the adjacency matrix that identify the graphs isdenoted by d and its value is n ( n − / . n d ≈ O ( n ) qubits used by the algorithm3 9 74 16 85 25 810 100 1020 400 1250 2500 15100 10000 17500 250000 211 × × qasm_simulator available through the IBM cloud platform.We compared the results with a classical binary classifier based on the Fröbe-nius norm between graph adjacency matrices defined by || A || = (cid:115)(cid:88) i,j | a ij | , so that the distance used in Equation (5) becomes d (cid:0) G test , G { m } (cid:1) = (cid:115)(cid:88) ij | ( g testi − g { m } i ) | . (6)13n order to perform our experiments, we proceeded as follows. By ran-domly selecting 10 different test graphs G test and 25 different pairs of labeledgraphs { G sad , G happy } , we constructed 250 items of the form { G test , G sad , G happy } for the classical classifier and the IBM quantum simulator. Vertices were se-lected randomly among the 20 landmark points of the mouth, the number n of vertices given in input to the algorithm was gradually increased, and aone-time sample of the vertices was shared with all methods.Based on this, we have devised an algorithm for classification that is di-vided into two main steps. The first step consists in a procedure, named ClassifyWrtSingleFace , that considers each item { G test , G sad , G happy } in-dividually and classifies G test as happy or sad, based only on the distances d ( G test , G sad ) and d ( G test , G happy ) . The procedure AccuracyWrtSingleFace evaluates the accuracy of such a classification by essentially counting thenumber of correct answers for all the test graphs. In the second step, anotherprocedure, named
ClassifyWrtWholeSet , performs a different classificationwhere each face G test is labeled depending on the output of ClassifyWrtSingleFace calculated on the whole set { G happy , G sad } .We have compared the accuracy obtained with different number n oflandmark points of the mouth ranging from to . The points caseconsiders all the points of the mouth. The n < cases consider subsets ofthe mouth landmark points which are chosen randomly and uniformly in thecoordinates. For each n we have picked up 20 randomly chosen subsets, andwe have calculated the accuracy of the classifier for each n as the mean ofthe accuracies obtained by varying such subsets. procedure ClassifyWrtSingleFace ( G test , G sad , G happy ) d ← Distance ( G test , G sad ) − Distance ( G test , G happy ) if abs( d ) < 0.001 then return unknown end if if d < 0 then return happy else return sad end if end procedure { G test , G sad , G happy } . The circuit is executed 1024 times.Given the set of all test graphs G = { ( G i , (cid:96) i ) | i = 1 , ..., n } , the followingprocedure describes the calculation of the accuracy of the classification withrespect to a single face. procedure CalculateAccuracyWrtSingleFace ( G ) correct ← wrong ← G sad = { G | ( G, (cid:96) ) ∈ G ∧ (cid:96) = sad } G happy = { G | ( G, (cid:96) ) ∈ G ∧ (cid:96) = happy } for all ( G test , (cid:96) test ) ∈ G do for all G sad ∈ G sad , G happy ∈ G happy do if ClassifyWrtSingleFace ( G test , G sad , G happy ) = (cid:96) test then correct ← correct +1 else wrong ← wrong +1 end if end for end for AccuracyWrtSingleFace ← correct / ( correct + wrong ) return AccuracyWrtSingleFace end procedure
The values of the accuracy of procedure
ClassifyWrtSingleFace thatwe obtained with the qasm_simulator are reported in Table 2 and describedby the plot in Fig. 8.Fig. 8 and Table 2 show that the highest value of the
AccuracyWrtSingleFace procedure is obtained with the classical classifier, using the complete graphstrategy. The classical classifier with meshed graphs reveals a worse perfor-mance. This is due to the fact that meshed graphs, on average, carry lessinformation about the shape of the mouth. The performance gap betweenthe complete and meshed approach is not so evident for what concerns thequantum simulation. This may be due to the fact that the encoding of a15igure 8: Results of the procedure
AccuracyWrtSingleFace on graphs withnumber of vertices n ∈ [4 , , obtained with the qasm_simulator comparedwith the classical classifier. Plots show the average accuracy of the classifierswith shadow indicating the max and min accuracies.16 CC meshed CC complete QC meshed QC complete4 0.88 0.94 0.66 0.616 0.87 0.98 0.77 0.728 0.91 0.99 0.86 0.7110 0.83 0.99 0.79 0.7112 0.87 0.99 0.84 0.7614 0.90 0.98 0.87 0.7516 0.89 0.98 0.87 0.7018 0.87 0.99 0.85 0.7520 0.92 0.99 0.82 0.84Table 2: Average accuracy of the
ClassifyWrtSingleFace procedure ob-tained with the qasm_simulator (QC), and the classical classifier (CC).complete graph into a quantum state is much more complex than for meshedgraphs since for complete graphs there are always n ( n − / amplitudes thatare different from zero. In the meshed case, the graphs are sparse and muchless amplitudes are needed in the quantum states for encoding them. Clearly,the complexity of the quantum states negatively affects the robustness of thecircuit. Moreover, it is interesting to notice how the accuracy of the quan-tum simulation with meshed graphs closely follows the trend of the accuracyobtained by its classical counterpart. We now refine the classification by comparing G test with the entire set ofgraphs, { G happy , G sad } , so that a face is classified as happy if by runningprocedure ClassifyWrtSingleFace we obtain more times happy than sad,and sad otherwise.The
ClassifyWrtWholeSet procedure is described below. procedure ClassifyWrtWholeSet ( G test , G ) happycounter ← sadcounter ← G sad = { G | ( G, (cid:96) ) ∈ G ∧ (cid:96) = sad } : G happy = { G | ( G, (cid:96) ) ∈ G ∧ (cid:96) = happy } for all G sad ∈ G sad , G happy ∈ G happy do if ClassifyWrtSingleFace ( G test , G sad , G happy ) = happy then happycounter ← happycounter +1 else sadcounter ← sadcounter +1 end if end for if happycounter == sadcounter then return unknown end if if happycounter > sadcounter then return happy else return sad end if end procedure The accuracy of the above procedure is calculated by the following algo-rithm as the frequency of the correct answers returned by the
ClassifyWrtWholeSet procedure. procedure CalculateAccuracyWholeSet ( G ) correct ← wrong ← for all ( G test , (cid:96) test ) ∈ G do if ClassifyWrtWholeSet ( G test , G ) = (cid:96) test then correct ← correct +1 else wrong ← wrong +1 end if end for AccuracyWholeSet ← correct / ( correct + wrong ) return AccuracyWholeSet end procedure
CalculateAccuracyWholeSet procedure forthe qasm_simulator and the classical binary classifier are shown in Fig. 9and Table 3. n CC meshed CC complete QC meshed QC complete4 0.93 0.99 0.83 0.886 0.90 1.0 0.86 0.848 0.93 1.0 0.92 0.8710 0.97 1.0 0.96 0.9612 0.96 1.0 0.96 0.9614 0.90 1.0 0.89 0.9916 0.93 1.0 0.93 0.9418 0.86 1.0 0.85 0.9820 1.0 1.0 1.0 1.0Table 3: Results of the average
AccuracyWholeSet procedure on graphs withnumber of vertices n ∈ [4 , , obtained with the qasm_simulator (QC) andthe classical classifier (CC).As in Step 1, the highest value of the accuracy is obtained with the clas-sical classifier using the complete graph strategy: the fact that all distancesbetween landmark points are considered makes the classifier very faithful.However, it is worth noticing that we only considered small graphs (up to20 nodes), thus reducing the amount of resources needed to deal with largecomplete graphs. In applications where graph dimensions are several ordersof magnitude higher, a complete graph classification approach may not be aviable option.A trade-off between graph complexity and accuracy of the classificationis reached in the classical case by employing the meshed graphs encoding;good levels of accuracy are obtained with our AccuracyWholeSet algorithm,which never go below . .In the quantum simulation, the complete graph strategy performs clearlyworse than its classical counterpart, while the quantum meshed approachshows an average accuracy which is very close to the classical one.19igure 9: Results of the procedure AccuracyWholeSet on graphs with num-ber of vertices n ∈ [4 , , obtained with the qasm_simulator compared withthe classical classifier. Plots show the average accuracy of the classifiers withshadow indicating the max and min accuracies.20omparing Fig. 9 and Fig. 8, we can also observe that in the latter, thequantum complete graph strategy has a smaller deviation (blue shadows inFig.8 ) than for the quantum meshed graph approach; this is not the case for AccuracyWholeSet , where we achieve comparable results.
In this work we have addressed the problem of classifying graphs represent-ing human facial expressions. Graphs are obtained by selecting some of theface landmark points and connecting them either via a triangulation of thepoints or via a complete graph construction. We have shown the construc-tion of quantum states whose amplitudes encode the graphs, and devised aninterference-based quantum circuit that performs a distance-based classifi-cation for the encoded graphs. We have implemented this quantum circuitby means of the IBM open-source quantum computing framework Qiskit [1],and tested it on a collection of images taken from the Cohn-Kanade (CK)database, one of the most widely used test-beds for algorithm developmentand evaluation in the field of automatic facial expressions recognition.The tests have been performed on the qasm_simulator , and the resultshave been compared with the classical classifier. A calculation of the accuracyrevealed that the classical classifier achieves better results when a completegraph approach is employed, while the simulated quantum classifier achievescomparable results with both the meshed and the complete strategy.Future work should investigate the possibilities of different and more effi-cient graph encodings into quantum states. Moreover, interesting extensionsof the results we have presented could be obtained by exploiting other quan-tum classification schemes, such as those based on the SWAP test along thelines of [12], or on Variational Quantum Circuits [9].
References [1] Aleksandrowicz, G., Alexander, T., Barkoutsos, P., Bello, L., Ben-Haim,Y., Bucher, D., . . . , Zoufal, C.: Qiskit: An Open-source Framework forQuantum Computing (2019). doi:10.5281/zenodo.2562110[2] Arunachalam, S., Gheorghiu, V., Jochym-O’Connor, T., Mosca, M.,Srinivasan, P.V.: On the robustness of bucket brigade quantum21AM. New Journal of Physics (12) (2015). doi:10.1088/1367-2630/17/12/123010[3] de Berg, M., van Kreveld, M., Overmars, M., Schwarzkopf, O.C.: De-launay Triangulations, pp. 183–210. Springer (2000). doi:10.1007/978-3-662-04245-8_9[4] Biamonte, J., Wittek, P., Pancotti, N., Rebentrost, P., Wiebe, N.,Lloyd, S.: Quantum machine learning. Nature , 195–202 (2017).doi:doi.org/10.1038/nature23474[5] Bondy, J.A.: Graph Theory With Applications. Elsevier Science (1976)[6] Ciliberto, C., Herbster, M., Ialongo, A.D., Pontil, M., Rocchetto,A., Severini, S., Wossnig, L.: Quantum machine learning: a clas-sical perspective. Proceedings of the Royal Society A: Mathemati-cal, Physical and Engineering Sciences (2209), 20170551 (2018).doi:10.1098/rspa.2017.0551[7] de Berg, M., Cheong, O., van Kreveld, M., Overmars, M.: Computa-tional Geometry: Algorithms and Applications. Springer-Verlag BerlinHeidelberg (2008)[8] Lucey, P., Cohn, J.F., Kanade, T., Saragih, J., Ambadar, Z., Matthews,I.: The Extended Cohn-Kanade Dataset (CK+): A complete datasetfor action unit and emotion-specified expression. In: 2010 IEEE Com-puter Society Conference on Computer Vision and Pattern Recognition– Workshops, pp. 94–101 (2010). doi:10.1109/CVPRW.2010.5543262[9] McClean, J.R., Romero, J., Babbush, R., Aspuru-Guzik, A.: The the-ory of variational hybrid quantum-classical algorithms. New Journal ofPhysics (2), 023023 (2016). doi:10.1088/1367-2630/18/2/023023[10] Mottonen, M., Vartiainen, J.J., Bergholm, V., Salomaa, M.M.: Trans-formation of quantum states using uniformly controlled rotations.Quant. Inf. Comp. (467) (2005)[11] Nielsen, M.A., Chuang, I.L.: Quantum Computation and Quantum In-formation, 10th anniversary edn. Cambridge University Press (2011)2212] Park, D.K., Blank, C., Petruccione, F.: The theory of the quantumkernel-based binary classifier. Physics Letters A p. 126422 (2020).doi:10.1016/j.physleta.2020.126422[13] Park, D.K., Petruccione, F., Rhee, J.K.K.: Circuit-Based QuantumRandom Access Memory for Classical Data. Scientific Reports (1),3949 (2019). doi:10.1038/s41598-019-40439-3[14] Piatokowska, E., Martyna, J.: Computer recognition of facial expres-sions of emotion. In: P. P. (ed.) Machine Learning and Data Mining inPattern Recognition. MLDM 2012, Lecture Notes in Computer Science ,vol. 8862. Springer, Berlin, Heidelberg (7376). doi:10.1007/978-3-642-31537-4_32[15] Rebentrost, P., Mohseni, M., Lloyd, S.: Quantum support vector ma-chine for big data classification. Phys. Rev. Lett. , 130503 (2014).doi:10.1103/PhysRevLett.113.130503[16] Schuld, M., Fingerhuth, M., Petruccione, F.: Implementing a distance-based classifier with a quantum interference circuit. EPL (EurophysicsLetters) (6), 60002 (2017). doi:10.1209/0295-5075/119/60002[17] Schuld, M., Sinayskiy, I., Petruccione, F.: Quantum computing for pat-tern classification. In: P.S. Pham DN. (ed.) Trends in Artificial Intel-ligence. PRICAI 2014,
Lecture Notes in Computer Science , vol. 8862.Springer, Cham (2014). doi:10.1007/978-3-319-13560-1_17[18] Schuld, M., Sinayskiy, I., Petruccione, F.: An introduction to quan-tum machine learning. Contemporary Physics (2), 172–185 (2015).doi:10.1080/00107514.2014.964942[19] Shende, V.V., Bullock, S.S., Markov, I.L.: Synthesis of quantum-logic circuits. IEEE Transactions on Computer-Aided Designof Integrated Circuits and Systems25