Shipping inspection trial of quantum machine learning toward sustainable quantum factory

In recent years, the diversification of consumer values has led to an increase in the number of small-quantity, high-mix products. For many manufacturing companies, shipping inspections of such products are of great importance. As all products have the same value, good and defective products need to be efficiently identified. Now, a promising future application of quantum technology is considered to be quantum machine learning. We believe that the quantum classifier for SVMs using quantum kernels is one of the areas where quantum advantages can be demonstrated. At present, there are few examples of quantum classifiers applied to real problems in manufacturing processes. In this study, we aim to build a classifier that can demonstrate the quantum advantage and compare SVMs using classical and quantum kernels with conventional ResNet. Initially, a binarised image was generated after image pre-processing. After principal component analysis and dimensionality reduction were performed on the images, SVM with kernels was carried out. The kernel-based SVMs was then compared with the conventionally implemented Residual neural network (ResNet) using an evaluation index: F1-score. The results showed that the F1-score of SVMs using classical kernels was equivalent to that of Resnet. In addition, SVMs using quantum kernels showed higher F1-score than ResNet. In addition, the impact of the feature map and principal components of the quantum kernel was also investigated. It was found that when the feature map became more complex, conversely, circuit generation took more time. It was also found that the principal components are highly relevant to the image and cannot lead to simple results. In the future, we plan to accumulate more experimental data, look for scenes where quantum machine learning can be used and apply it to the manufacturing field.  


INTRODUCTION
In recent years, quantum technology has begun to attract increasing attention.In particular, quantum machine learning (QML) is considered to be one of the most promising applications of quantum technology (Liu et al., 2021).Now, support vector machines (SVMs) are one of the most commonly used methods in various machine learning.This method is based on statistical machine learning and is a type of supervised learning.It is a versatile classifier with little data due to two features: margin maximization and kernel estimation.It is one of the most widely used algorithms in machine learning.
Kernel estimation is one of the methods to estimate the entire distribution from a finite number of sample points and is a typical example of non-parametric estimation that cannot be expressed by parametric estimation.The inner product space is used for discrimination.Therefore, kernel estimation matches the mapping to Hilbert spaces and is a promising method for SVMs as classifiers.Kernel SVMs are widely used in image processing applications such as pattern recognition, as they can separate non-linear feature spaces by using inner products.
The product inspection process is one of the most important processes for many manufacturing industries.In recent years, an increasing number of small-quantity, high-mix products have been produced, and efficient classification of good and defective products is required.Classification can be based on image data, text or sound.Image classification is widely used in remote sensing, biological inspection, construction and engineering and manufacturing.The inspection of defective products is a critical issue in inspection processes in the manufacturing industry.In such inspection processes, twoclass classification learning models are used.In recent years, the learning size (good and defective products) has been limited due to the production of a large number of products 4th Asia Pacific Conference of the Prognostics and Health Management, Tokyo, Japan, September 11 -14, 2023 PS02-03 in small quantities.Therefore, machine learning models are needed that enable classification with limited and small data.
However, kernel estimation has two problems, one of which is computational cost.As the number of features increases, the embedding function into the feature space become more complicate, which requires a huge computational cost.The other is the limitation of embedding functions: when using kernel tricks in SVMs, complex functions have to be handled.
As a means of solving the above problems, there are two attempts to use kernel estimation to embed feature maps with quantum entanglement in quantum Hilbert space.One is the quantum kernel SVM, which introduces Z-ZZ feature maps as quantum entanglements in an exponentially large feature space (Havlíček et al., 2019).The other is a kernel estimation neural network, which proposes a methodology to assess the potential quantum advantage in a learning task (Huang et al., 2021).
The aim of this research is to build a highly accurate learning model with a small amount of training.
Chapter 1 described the background of the study.Chapter 2 describes our attempts towards a sustainable quantum factory.
Chapter 3 provides an overview of the factory's shipping inspections.Chapter 4 describes the SVM methods for classical and quantum kernel estimation used in this study.
Chapter 5 describes the results obtained.Chapter 6 discusses the benefits of quantum machine learning and two key issues: feature maps and principal components.Chapter 7 presents the conclusions and future perspectives of the study.

TOWARD SUSTAINABLE QUANTUM FACTORY
In general, quantum computing has 4 merits compared to classical computing and 4 applications as shown in Fig. 1.One in the merits is sustainability, second is computing speed, third is the no-cloning theorem, and fourth is dealing with the unskilled problems.The greatest merit in the figure is sustainability.
Logical irreversibility and thermal diffusion are linked by a relationship proposed by Landauer in 1961.The logic circuits of current classical computers is irreversibility.If reversible computation is possible, it can be executed without consuming energy because no information is lost.Quantum computing is a reversible computation and therefore has the potential to create a sustainable ecosystem.From this perspective, we are thinking that the quantum computing in manufacturing is important for building sustainable factories.
Let us consider the application in figure 1.As applications 1, Quantum cryptography is based on the quantum nonreplicability theorem.As application 2, Quantum simulations can be considered to be suitable for analyzing the quantum world.As application 3, Quantum AI is expected to solve the unskilled problems of classical computers due to its affinity for graph theory, which is easy to apply to qubits, and matrix-based computation.We are focusing quantum cryptography and quantum AI for sustainable factory in NISQ era.On the hardware side, Intel has announced QPU (name: Tunnel Fall, 15 Jun 2023) and it is assumed that NISQ can be installed locally in factories soon.The era of hybrid utilization of classical and quantum computers, known as Noisy Intermediate-Scale Quantum Computer (NISQ), will be expected to last from 2020 to around 2050.The era in Fault Tolerant Quantum Computer (FTQC) which is capable of error correction will be perfected is assumed to be after 2050.
The application area is expanding to delivery optimization, material & process informatics, Schedule, Inspection & Anomaly detection, production sales planning, automatic delivery and so on.Here, we focus on the inspection in figure 2. The applicability of quantum machine learning to this shipping inspection is then examined.

SHIPPING INSPECTION
There are three inspection processes on shipping inspections, as shown in Fig. 3. On the inspection 3, our purpose is to pick up scratch (defect) in the product X. Figure 4 shows image size and the size of the scratches.The scratch size is the 5 × 5 size and the scratch are scattered all over the image (250 × 250).The rate is 0.02 and the degree of scratch is at a level that can be sought out by careful searching.
Our objective is to build a classifier to identify these scratches with the ML using discriminative model (ML classifier).

SVM WITH/WITHOUT QUANTUM KERNEL
In the NISQ era, quantum machine learning uses quantumclassical hybrid methods.The methods can be divided into two main categories as shown in Fig. 5.One is the quantum variational method and the other is the quantum kernel method.
The quantum variational method (QVM) alternates between QPU, and CPU as shown in Compared to the quantum variational method, the quantum kernel method does not require repeated use of the QPU and the CPU, so the incoherent noise of the QPU is less.
We decrease coherent noise because the kernel circuit can be shallower.We considered that, from this perspective, the quantum kernel method is suitable for practical use in the NISQ era.
The algorithm flow for SVM with embedded classical and quantum kernels is shown in Fig. 6.We first generated a binarized image after several pre-processing step.After principal component analysis, dimensionality reduction is performed.We split the data into training and testing data.
The classical and quantum kernels are generated on the training data.The kernels are embedded in the SVMs to build the training model.Classification is carried out using the constructed learning model f(x).The learning models were evaluated in terms of F1-score.
Figure 6.Algorithm flow of SVM with/without quantum kernel.
The balanced data sets are preferred for building learning models.Therefore, Principal component analysis was carried out on that image with 100 good products against 100 defective products.The ratio of good to defective products was set to 1:1.
On the other hand, the factory outgoing inspection is in reality an unbalanced data set.Pre-tests were carried out on unbalanced datasets ranging from 1/3, 1/4 to 1/10, and learning models could be built for the 1/3 and 1/4 datasets.We therefore used a dataset with a 1/4 proportion of defective products.After dimensional reduction on each principal component, the ratio of good to bad products was set at 3:

RESULTS
Initially, the relationship between the number of training and F1-score in the feature maps (Y, Z and Z-ZZ) is shown in Fig. 8. Here, we use the number of principal components is 5.
In the pre-experiment, we confirmed that the images reconstructed with n=5 recreated the scratches of defective products.Therefore, it was thought that a learning model could be constructed.When considering the learning process, the F1-score of the harmonic mean was chosen as the performance indicator rather than accuracy.This result suggests that the number of principal components affected the increase in F1-score.However, the F1-score of SVMs with classical and quantum kernels become larger and the difference of F1-score between classical and quantum become smaller as n decreases from 10, 5 and 3.The difference between classical and quantum in F1-score was 0.017 when n is 3.When the principal components are less than 10, the relationship between the number of trainings and the F1score is shown in Figure 10.
It was found that as the principal components became smaller (10, 5 and 3), the learning model was built with fewer trainings.It was also observed that when the principal components were 3 and 5, the learning model was built faster for quantum than for classical.However, the difference in F1score between classical and quantum was smaller.
Though the cumulative contribution rate is 0.55 when n=3, we confirmed that we could clearly recognize the scratches that determine a defective product using reconstructed image.Therefore, we are thinking we could distinguish good and defective product.

DISCUSSION
Two main aspects are discussed.The first is the feature map and the second is the principal components.
We consider the first, feature maps.Quantum kernels are generated by feature mapping.They report an ideal accuracy of 0.95-1.00using the Z-ZZ feature map, with experimental values from actual equipment in the range (Havlíček et al., 2019).The figure showed that the accuracy were between 0.6-1.0 with a high degree of scatter.They also reported that use of Z-ZZ feature maps using quantum entanglement is important.However, in our study, the Y and Z Pauli feature maps with superposition obtained higher F1-score as well as our previous work (Tomono & Natsubori, 2022).Again, the F1-score using Z-ZZ feature map goes up to 0.95 with 100 trains, but the training model could not be built early.
The second is the principal components.The influence of the principal components is very significant.In the present study, when the principal component was 10, the F1-score were minimum.When principal components were less or more than 10, the F1-score became larger.The reasons for this may include the following.The fact that scratch is reproduced in the reconstruction of the third and fifth principal components means that scratch appears between the first and third principal components, indicating that the learning model is built with cumulative contributions rate up to the third principal component.On the other hand, the other components have little to do with scratching, suggesting that the F1 score decreases as the number of principal components increases.It is also considered that the f1 score increased from the tenth principal component onwards, as the overall cumulative contribution rate is reflected in the reconstruction of the image.In the classification of breast cancer (Havlíček et al., 2019), quantum kernel learning was performed on 32 features by narrowing them down to the first and second principal components using principal component analysis.Cumulative contribution rates are not stated.Cumulative contribution rates are not listed, but the following principal components may not have been listed because the first and second principal components explain the disease.

CONCLUSION
Our objective is to build a learning model for high-mix lowvolume production.
ResNet requires more than 1000 data sets.Compared to ResNet, we found that classical SVM and quantum SVM can build learning models with fewer datasets than ResNet.Furthermore, SVMs with quantum kernels were found to be able to construct learning models with better accuracy.
There are few examples of quantum machine learning applied to real data.In this study, a classifier was constructed using real image data from a factory outgoing inspection process.
The defective images contain scratches that can be identified by the naked eye.The scratches are scattered throughout the image.As these images are easy to separate, the SVM was able to build a training model quickly.Moreover, the quantum kernel was shown to be more promising than the classical kernel, with a higher F1 score.
Further data accumulation will consolidate the construction of a learning model using quantum kernels, which will contribute to improving the efficiency of the production line.

Takao
Tomono et al.This is an open-access article distributed under the terms of the Creative Commons Attribution 3.0 United States License, which permits unrestricted use, distribution, and reproduction in any medium, provided the original author and source are credited.

Figure 1 .
Figure 1.The merit of quantum computing and its industrial application.AI and ML stand for artificial Intelligence and machine learning.

Figure 2 .
Figure 2. The technology roadmap for sustainable quantum factory in NISQ era (Personal opinion).
Figure a shows the overall diagram of the inspection process.It comprises existing Inspection 1, Inspection 2, and Inspection 3. The inspection 1 is an inspection using image processing.The inspection 2 is machine learning (ML) using Discriminative Model.The model is the Residual neural network (ResNet).The inspection 3 is ML using Generative Model. Figure b shows how the training model of ResNet is constructed.The number of layers is 50 and 1132 images are used to build the learning model.

a
Figure 3. Shipping inspection flow of industrial product X and algorithm flow on ResNet as Discriminative model.

a
Figure 5.Quantum machine learning method in NISQ era.
1. Images reconstructed by dimensional reduction were used as the dataset.The data was then divided into training and test data.The training data was used to build the learning model.We generated classical and quantum kernels on the training data.Here, we used RBF for the classical kernel.The quantum kernel was generated using the quantum circuit diagram shown in Figure7(Tomono & Natsubori, 2022).The initial status was |0⟩ on each qubit wire.The number of qubits is set the same as feature volume that is the same as principal component.The data from the factory cannot be shared outside the company for confidentiality reasons.Therefore, a simulator was installed on-site server of factory to perform the quantum calculations.The number of qubits is therefore limited to 15.The functions (  ) used were the Yfeature map (Superposition), the Z-feature map (Superposition) and Z-ZZ feature map (Superposition and Entanglement).

Figure 8 .
Figure 8.The relationship between the number of training size and F1-score in the feature maps (Y, Z and Z-ZZ).p5 means that the number of principal components is 5. C, Y, Z, Z-ZZ means classical, Y, Z, and Z-ZZ feature maps.

Y
and Z are Pauli feature maps, which use the effect of superposition on each quantum gate, while the Z-ZZ feature map uses quantum entanglement.The figure shows that for all feature maps, the F1-score become larger increased as the number of trainings increased.When the number of trainings exceeded 30, the F1-score of the Y and Z feature maps exceeded 0.96 and then remained constant.However, the F1score of the Z-ZZ feature map ranged from 0.7-0.76.Although not shown in the figure, the learning model was then slowly built up, reaching 0.95 at 100 training.Compared to the Y, Z feature maps, it was found that it took longer to build the learning model.Therefore, the Z-ZZ feature map not investigated in the following evaluation index: f1-score.Next, we examined cumulative contribution ratio shown in Figure7.As the principal components increase with n = 3, 5, 10 and 15, the cumulative contribution ratio become larger up to 0.55, 0.64, 0.75 and 0.82.We compared the accuracy and F1-score of SVMs to one of ResNet as shown in table 2. Here, we use the number of principal components is 15.The reason is that the Cumulative contribution of principal components is generally considered sufficient for machine learning if about 0.8 of the data can be reproduced.The SVM with classical kernel denoted an Accuracy and F1-score of 0.944 and 0.964, which were values close to the ResNet accuracy and F1-score of 0.940 and 0.958.On the other hand, SVM with quantum kernel denoted a very high Accuracy and F1-score of 0.984 and 0.990 for the Y-feature map and 0.988 and 0.990 for the Zfeature map.While ResNet requires 1132 datasets, SVMs with classical and quantum kernel can construct a training model with 400 datasets.The number of datasets is about one-third.Furthermore, the SVM with quantum kernels (Ry, Rz) achieved an accuracy and F1-score of more than 0.988 and 0.990.Next, the F1-score of the classical and quantum kernels (Yand Z-feature map) was compared when the number of principal components n was set to 3, 5, 10 and 15.The results are shown in Figure9.As n increases from 10 to 15, the F1score of the classical and quantum kernels become larger.

Figure 9 .
Figure 9.The relationship between the F1-score of each kernel and the number of principal components.

Figure 9 .
Figure 9.The relationship between number of components and cumulative contribution rate.P3, p5, p10 stand for 3, 5, and 10 of principal component number.C and Rz stand for classical and Z-future map.

Figure 10 .
Figure 10.The relationship between the training size and F1score.P3, p5, and p10 stand for the number of principal components.C and Z stand for classical kernel and Z feature map.

Table 1 .
The relationship between Principal component and Cumulative contribution rate.

Table 2 .
The Accuracy and F1-score of each kernel learning compared to Existing ML classifier (ResNet).Here, principal component is 15.C and Q are classical and quantum.