Automated Design of Affordable Modular Custom Insoles By Multi-Classification Algorithms

Abstract Custom designed insoles are a niche product that is not always affordable to all who need them. When commercial insoles are fabricated using advanced technologies, the insoles in this study are assembled out of pre-cut modular components to keep the production cost down, hence their price. In this study, algorithms driven by a fuzzy inference were proposed in comparison with a decision tree in order to select the best component combination. One hundred and twelve subjects were recruited to collect foot data extracted from their foot images. Approximately 95% of 182 AI-designed insole pads were found in perfect agreement with the professional podiatrist’s decision with acceptable 5% deviation. Differences in the algorithms’ strength were also discussed. In addition to their superior performance, both algorithms allow the podiatrists to speed up the diagnosis and design phases. This approach, when integrated with applications of mobile devices for remotely retrieving foot data, will expand another simple yet effective customer-oriented product design service.


INTRODUCTION
In developing countries, healthcare services are inaccessible to many patients, particularly those with limited financial or physical capacity. While high-quality and wellequipped service providers are concentrated in urban areas, rural public hospitals are always understaffed. They are struggling to serve an increasing number of patients. Their staff end up suffering from chronic fatigue leading to mental and physical health deterioration. For patients, lack of appropriate and timely diagnosis and treatments deteriorates their quality of life or, in some cases, costs their lives. The situation is worsening during the COVID-19 pandemic when access to the hospital is restrained by city lockdown and stringent disease control. Nowadays various commercial service providers exploit information and telecommunication technology (ICT) to develop their telehealth systems, promoting accessibility for people in need. Developed at an incredibly fast pace, ICT will soon become a core mechanism around which medical applications evolve [1] . Even now, it is clearly evident that digital health systems operated on the ICT platform are playing an important role in healthcare service industry [2]. During the COVID-19 pandemic, travel restrictions are in effect in most parts of the world as a measure to suppress the spread of the disease. Hospital and clinic visits are limited to critical and emergency cases only. Inaccessibility of health services has left people helpless with chronic conditions, a channel for remote diagnosis must therefore be developed. As sensors and mobile devices, especially smartphones and mobile tablets are becoming indispensable in daily life, they hold the key to emerging remote diagnosis technology. These devices can offer high resolution digital blueprints of the patient's conditions at virtually no cost.
Considerable effort in utilizing digital information in medical diagnosis and treatment has been made during the past years. A great proportion of such has been dedicated to designing and manufacturing foot orthotics which focuses primarily on custom insoles for patients with foot abnormality as shown in Figure 1. It was reported that around 90% of clinic visits are due to pronation [3], and supination, though less common, causing difficulties and pain that could lead to more serious conditions if not timely treated. Diagnosis of patient's foot parameters is traditionally performed using specific equipment at a foot clinic.

Fig. 1 Abnormal foot alignment (right foot)
In this work, custom insoles designed by a traditional approach handled by a foot expert are compared with ones obtained from a newly proposed system. For the latter, foot parameters are assumedly to be extracted from images remotely submitted by individual patients. By doing so, the number of hospital visits can be minimized, responding to a preventive measure in a contagious area. However, the parameters obtained are of great uncertainty and variability, and there are no definite rules for determining the insole assembly most suitable for each case. The use of artificial intelligence (AI) techniques is needed. In this research, the system driven by an AI algorithm is developed to suggest the insole that provides healing effect and most comfort fit in a fraction of time and at an affordable price of around $30, a 10-16 folds reduction compared with the prices of commercial insoles. When the insoles are designed by the proposed AI system, lead-time is significantly shortened, relieving the hospital from its high workload. It is expected in the future that the system will be installed in provincial health facilities to improve accessibility to the service. Our proposed system will play a part in the digital tele-healthcare ecosystem which will be the standard of the new normal during and beyond the COVID-19 pandemic.

LITERATURE REVIEW
ICT innovations offer remote foot measurement which patients can submit their own foot images for preliminary diagnosis. Key foot parameters of an individual can be obtained in a form of digital information [4,5]. Walking behavior of an individual such as step count, gait speed and stride length could be monitored by the help of a mobile phone camera [6,7,8]. The devices together with recently developed design applications such as "FitMyFoot" [9] and "Doc Sols" [10] are among new advancements in custom insole design and manufacturing. As complicated as their shapes are, custom insoles are more effectively designed and manufactured by computer-assisted technologies such as finite element analysis [11,12], CAD/CAM/CNC [13,14,15,16] or additive manufacturing [12,17,18] than the conventional processes. Moreover, high quality commercial custom insoles available in the market are made of special materials to provide healing effects with great comfort. In-vestment in such a procedure drives the price of commercial custom insoles to the point where only customers in the upper niche market can afford ($300-$500). An approach with lower cost and simpler construction of the custom insole is needed, especially for those with limited healthcare resources and personal income. Benefits of such affordable technology are even more prominent when travel restrictions and social distancing are in effect. As a regional public healthcare center in one of developing countries, the hospital in our case study deals with a number of patients suffering from either pronation or supination seeking diagnosis and treatment every day. The current procedure as shown in Figure 2 starts with an incoming patient who is referred by a doctor registering for diagnosis. If the doctor decides that the treatment would involve a custom insole, the patient's foot will be carefully examined and measured by a podiatrist. The patient will then be released and come back once again for an insole trial, which takes approximately 25-60 days on average. If the insole fits the patient's foot as expected, the design procedure is complete, otherwise the insole will be fixed for another trial in the next visit which could again take months. This lengthy waiting period is also a common problem in many countries, even the developed one such as Sweden [19]. It is even longer during the pandemic due to the limited entry policy of patients to the hospital. This has led to extended suffering and deterioration of the patient's condition. Although studies related to custom insole design can widely be found; no previous work has discussed how to automatically and optimally arrange modular components to obtain an insole that serves individual's fit in real time.

Fig. 2 Schematic diagram of the current design procedure at the podiatric unit
By adopting the telecommunication technology, foot measurement can be carried out with much less effort. The bottleneck now has shifted to the design and assembly processes. To control the production cost, the podiatrist put together the pre-cut modular insole components ( Figure 3).

Insole Design
Insole Assembly Insole Try-on Delivery to Patient

Insole Adjustment
If it does not fit properly

153
The components, which will be later detailed, are made of polymer that can absorb pressure at particular areas under the foot. Component selection relies heavily on foot diagnosis carried out by knowledgeable and experienced podiatrists.

METHODOLOGY OF RESEARCH Sample Collection
In this study, adults between 18 and 60 years of age with and without abnormalities of foot supination and pronation were recruited. Subjects with a history of serious foot injury or who had undergone foot surgery were excluded. One hundred and twelve subjects (47 males and 65 females) were included, resulting in 182 subjects which was sufficient for conclusive clinical trials [20]. Both left and right feet were assessed for most of the subjects, while some had only one foot measured. All subjects gave their informed consent for inclusion before participating in the study. The study was conducted in accordance with the Declaration of Helsinki, and the protocol was approved by the Office of Human Research Ethics Committee (HREC) of an affiliated institution.

Modular Insole Components
Upon deriving foot parameters from the images, traditionally a podiatrist will deliberately select the components summarized in Table 1 to accommodate abnormality revealed by the parameters.
Along the longitudinal (lengthwise) and lateral side of the foot and sole wedge Along the longitudinal (lengthwise) and medial side of the foot Due to variability sourced from a patient's foot structure and a measurement process, the podiatrist's skills and experiences are of utmost importance. To alleviate reliance on the expert and allow more rapid design of the insole, a computerized system is proposed to identify the right pieces to be put together to make the most suitable insole for the patient.

Heel and Sole Wedge
A heel and sole wedge (H-SW) is one piece of material supporting the foot along the sole down to the heel. It can correct the abnormal foot alignment or deviation of the forefoot in the posterior view. In this study, lateral and medial H-SWs can be chosen from two available sizes (⅜ in and ¼ in). A lateral H-SW is suitable for foot misalignment as a result of supination of the foot. That is when the pronated foot needs a medial H-SW to correct its misalignment.

Arch Support
An arch support is an insole component designed to restore natural foot functions. It corrects the posture and provides balance to flat footed patients. It also benefits individuals with high arches by offering proper foot alignment and stability. Runners with normal arches need arch supports for injury prevention and shock absorption. Arch-support orthotics are also prescribed to those with discomfort and/or abnormal skeletal alignments in the structures of the lower extremity [21]. In our setup, arch supports are available in two sizes: (1) Height ¼ in · Length 4½ in · Width 1 in, and (2) Height ½ in · Length 5½ in · Width 1½ in.

Heel Wedge
A heel wedge is a piece of material supporting the heel area. The heel wedge helps ease pressure and stress on muscles, tendons, and joints, alleviate lateral or medial heel pain, and prevent harmful ankle twisting. In addition, heel wedges can help neutralize pronated and supinated heel angles. In this study, heel wedges are divided into the lateral heel wedge and the medial heel wedge. Each comes in two sizes: (1) Height ⅛ in · Length 3 in · Width 1¼ in, and (2) Height ¼ in · Length 4 in · Width 1½.

Insole Designed by the Traditional Method
The subjects' feet were personally examined by an expert using a Harris mat and a goniometer which are traditional, simple, quick, cost-effective diagnostic tools. The Harris mat set includes an imprint mat, prescription paper, an inkpad and a roller. This measurement method is currently operated at the clinic in the hospital where this study was conducted to obtain foot parameters needed for a diagnosis. It produces a weight bearing imprint of the foot, thereby measuring pressure disbursement and arch shape. In the experiment, each subject was measured twice and the contour lines outside the foot and toes were drawn to obtain accurate shape data. An arch pattern is clearly revealed by the footprint, as shown in Figure 4. A goniometer was used to measure the angle of the foot. Using the measurement obtained from personal contact with the subject, the expert put together the insole components to create a custom insole out of his knowledge and experiences.

Insole Designed by the Proposed Automated Method
Along with the traditional method, the automated method was also conducted to determine if both approaches could be used interchangeably. With the automated approach, the foot parameters were extracted from foot images, instead of directly measured from the subjects. An image acquisition procedure was designed to be as simple as it could be handled by a common handheld device, yet informative enough to extract the key design parameters. Alignment of the camera was controlled by the patient or their relative following simple instructions. In a setup, the camera was to be first aligned with the object, as shown in Figure 5, otherwise, distortion or deviation would be induced.

Fig. 5 Foot and camera alignment for side view and back view imaging
In this study, the resolution for acceptable quality images, allowing a podiatrist to make an accurate judgment, was 720 pixels by 1280 pixels, which can be taken by a 1-megapixel camera. The extraction of the design parameters from the foot image can be simplified and are self-explanatory and provide examples to patients. Techniques for extracting foot parameters from digital image files are widely available in academic reports, commercial software. Hence, this article mainly focuses on the system driven by an algorithmic procedure to identify the most suitable design alternative once the parameters are obtained from the images.

System Inputs (Design Parameters)
Challenges of this automated approach lied in the determination of parameters critical in designing the orthotic insole, and views of the foot that could expose those parameters. Redmond [22] classified foot features using the foot posture index (FPI). The measurement procedure documented in his worksheet is a diagnostic clinical tool to quantify the degree of abnormalities, pronated or supinated, with scores from 1 to 5. The FPI measurement is well-illustrated and simple to conduct from foot images of two different views. In this study, after our preliminary analysis, only three out of original six indices were considered sufficient by the podiatrist for selecting the pre-cut insole components for mild abnormality. The first indicator was inversion/eversion of calcaneus represented by a divergence of the midline of the foot away from (eversion) or towards (inversion) the ideal vertical line, called the "Heel Angle". The second one was the height of the medial longitudinal arch from the ground to the curvature of the arch, designated as the "Arch Height". The last indicator was abduction/adduction of the forefoot on the rear foot, designated as "Deviation" in the posterior view by comparing the lateral and medial side of the foot. These indices are referred to in this study as insole design parameters or system inputs, which also indicate the degree of abnormalities following the standard in the worksheet [22]. As such, only two views of the foot: the rear and side views were sufficient to reveal the abnormalities of the foot.
After receiving the foot images from the patient, the images were processed and analyzed to extract the design parameters; "Heel Angle", "Arch Height", and "Deviation". The parameters were quantitatively evaluated by Java Version 1.6 of ImageJ application. ImageJ is an open-source image processing program developed at the National Institutes of Health (NIH) for scientific analysis of multidimensional images. Details of each parameter are as follows.

Heel angle
For each foot, "Heel Angle" (θ) can be obtained by measuring from the inside of the foot. There are two types of posterior view of the rear foot: valgus and varus as shown in Figure 6a and Figure 6b, respectively.

Fig. 6 Valgus and varus (a) valgus of the left and right feet, and (b) varus of the left and right feet
Arch height Preliminarily, "Arch Height" was measured according to the worksheet [22] from the ground to the highest point of the arch. However, in an obese subject the true arch height was obscure due to excessive body fat. "Arch Height" of a foot was obtained by measuring the navicular height of the foot [4,23]. The navicular height is defined as a perpendicular distance between the horizontal refer-  Table 2, these definite rules cannot be practically applied as vagueness between the adjacent categories causes classification uncertainty.  [23].

Deviation
"Deviation" is a difference in distance between the lateral and medial sides. However, in mild pronation and supination, the deviation was found to be very minimal and had little influence on designing the insole. So, it was not further explored in this study. Since there are no crisp rules for designing the modular insole, a podiatrist basically assembles the components from his knowledge and experiences. To shorten the design lead time, the following algorithmic systems were developed based on the decision criteria of the specialists in the podiatric unit of the hospital.  Table 3. Some alternatives were excluded if the components conflict with each other. In this study, AI systems that choose the most likely alternative to be selected by the expert out of all feasible design alternatives are proposed.

Table 3 All combinations of pre-cut insole components
System Architecture Artificial intelligent techniques have been employed in various diagnoses and treatments of patients' health conditions. Their recent advances in healthcare product design can be found in [24,25,26]. In this study, a fuzzy inference technique, long-known but still holding a dominant position in this field, was tested against the newer algorithm, the decision tree algorithm.

Fuzzy inference technique
In this study, a fuzzy inference technique was chosen to deal with the vagueness of the design parameters before classifying them into an appropriate design solution. Compared to other more complicated fuzzy models, a simple fuzzy constructed from IF-THEN rules can easily represent human reasoning and decision making. Its schematic concept is shown in Figure 8.

Fig. 8 Fuzzy inference method for proposing an appropriate design alternative of an insole
Its application in product development is widely found, and Lee et. al. [27] discussed this in a case of a modular personal computer. In this fuzzy model, the inputs (independent variables) were "Heel Angle" and "Arch

No. of components
Feasible design alternative N0. 0 N1. 1 lateral heel wedge (height ⅛ in · length 3 in · width 1¼ in) : : : N11. 2 lateral heel wedge (height ⅛ in · length 3 in · width 1¼ in) arch support (height ¼ in · length 4 ½ in · width 1 in) : : : lateral heel wedge (height ⅛ in · length 3 in · width 1¼ in) arch support (height ¼ in · length 4 ½ in · width 1) lateral heel and sole wedge (height ⅜ in · length 4 in · width 1½ in) : : : Height" while "Design Soln." is the output (dependent variable). The input and output variables were first transformed or fuzzified into fuzzy sets defined by their membership function ( Table 4). For simplicity and sufficiency, triangular and trapezoidal functions were used to construct the functions. Relationships between the input and output variables were established based on decision and judgement of the expert, and these were expressed in the form of fuzzy rules ( Table 5). After inferencing, the fuzzy sets will be defuzzified into a particular choice or a crisp real value. There are many different methods of defuzzification: center of area, center of gravity, center of sums, center of largest area, first of maxima, middle of maxima in which centroid method (also called center of area, center of gravity) is the most favored method. Using the centroid method, a crisp value (x * ) from a membership function µ(x) can be obtained as follows: For example, when Heel Angle is 86.99 ̊ and Arch Height is 6.46 cm, Design Soln. of the insole (N) can be calculated from the aggregation of Rule 4 and Rule 7. Defuzzifying the aggregated function arrives at 5.7, hence Design Soln is N6.

Decision tree
In product development, there are always many design alternatives to be contemplated, and in many occasions, they are associated with uncertainty. When this is the case, a decision tree is worth mentioning and proved to be effective as in a smartphone project [28]. A decision tree is a classifier used to visually display a decision scheme. For multiple classification, a decision tree, unlike logistics regression, can handle non-linear relationship between variables. In this study, 7 classes of foot pattern were under consideration using 2 continuous "Heel Angle" and "Arch Height" as predictors. Salford Prediction Modeller (SPM 8.3) was used to construct the tree with 10-fold cross validation. The decision tree consisted of 11 nodes and its rule are as shown in Figure 9.

RESULTS OF RESEARCH Performance Evaluation of the AI Systems
To evaluate the performance of the techniques proposed in this article, the results were compared with those of the expert or podiatrist who examined the same cases in person (referred herein as "the traditional method"). One hundred and eighty-two foot images were also collected from the subjects before being randomly partitioned into two independent sets: training and test sets. The first set, training set, was used for developing the classification system. The test set was subsequently evaluated in comparison with the expert decisions to indicate the system performance. Examples of prediction from the fuzzy system are shown in Table 6 and the summaries of classification results from both techniques are in Table 7 and 8.

DISCUSSION
In this study, confusion matrices were used to represent classification performance. The matrices display numbers of cases decided by the expert against those predicted using the fuzzy system (Table 9) and the decision tree (Table  10).
In the tables, performance measures clearly show agreement (true positive and true negative) and disagreement (false positive and false negative) between the expert and the computerized systems. In this multi-class performance evaluation, for easier interpretation, the confusion matrix shows the results with respect to the Design Soln. For the case predicted as Design Soln i, it was labeled as "true positive" (TP) when the expert also said so or "false positive" (FP) when the expert said otherwise. If the expert chose Design Soln i for any cases, but the system predicted something else, it was called "false negative" (FN), and "true negative" (TN) is the summation of cases in the matrix that did not belong to any of the previously mentioned measures.  Using only Eq. 6 to evaluate both classifiers, their accuracies turn out to be equally the same which are 94.59%. However, to determine which classifier has better performance, further analysis is needed. Weak classification systems can be simply identified by low accuracy, which may result either from low true positive (TP) or high false positive (FP) rate. Sources of weakness can be distinguished by the generalized precision (P), recall (R), and F1-score. In this study, precision of Design Soln i is a proportion of cases predictively fit with Design Soln i (TTP+TFP) that also are chosen by the expert (TTP). Recall of any Design Soln is a ratio of correctly predicted cases over a total number of cases the expert chose for that Design Soln. Both precision and recall are generally preferably close to 1. However, in some occasions one can be found very high when the other is unacceptably low, then it is inconclusive to report the performance. If a single measure representing them is needed for the sake of convenient indicator, F1score is considered more reliable than the accuracy value.
In most real-life problems, the cost of wrong prediction (false positive and false negative) could be highly significant and accuracy falls short of taking it into account. F1score, a harmonic mean of precision and recall, gives a better measure of the incorrectly predicted cases than accuracy. Both techniques: a fuzzy inference and a decision tree, have exactly the same number of true positive (35), hence the same overall accuracy (94.59%). However, slight difference between their precisions and recalls is observed, leading to a little greater F1-score of the decision tree. In Table 11 and Table 12, the decision tree has a perfect precision in all Design Solns except only N3. Using the fuzzy system, this problem is also detected, but even worse with a false positive found with N15 in addition. Similar comments are applicable with recall.
For the fuzzy inference, a few observations of wrong predictions were found in 2 cases where the system chose N0 and N5 (arch support: Height ¼ in · Length 4½ in · Width 1 in) as the most suitable alternatives. Without knowing this, the expert found N3 and N15 the best insoles for the individuals (N3 (medial heel wedge: Height ⅛ in · Length 3 in · Width ¼ in) and N15 (medial heel wedge: Height ⅛ in · Length 3 in ·Width 1¼ in and arch support: Height ¼ in · Length 4½ in Width 1 in), respectively). The disagreement occurred when the measured design parameters were in an overlapping area between neighboring fuzzy sets. With the decision tree, wrong predictions were found in only N0 (no insole needed) cases, instead of N3 (medial heel wedge: Height ⅛ in · Length 3 in · Width 1¼ in). For such cases in-depth analysis showed that the insole designs proposed by both techniques were slightly different from the expert's decision but still acceptable to the podiatrist. In sum, the subjects recruited in this study were ordinary people without any obvious abnormalities. After the experiment, some subjects realized that they have had symptoms of either pronation or supination and agreed to continue with getting the insoles predicted by the proposed techniques, certainly at an affordable price. Most people would not seek help unless they experience pains or injuries, and that is probably too late. It would be ideal for the public to have a convenient and affordable access to the service providers for foot diagnosis. Overall, both AI techniques demonstrated superior performance in choosing a suitable design alternative in a fraction of time with the decision tree expressing slightly more reliability. Both can work interchangeably with the expert in this task for a promising future of the online custom insole design. However, when compared with the decision tree technique, the fuzzy inference is more tedious in construction. Testing the insole, the podiatrist assembled the insole components according to the design chosen. Five patients were asked to come in for the insole trial and the podiatrist examined suitability of the insole when put on the shoe. The insoles were expected to either normalizing an abnormal heel angle by pushing up the sole in case of pronation or supporting the arch in case of supination. The subjects were real patients who visited the podiatric clinic because of their feet conditions. It was evident that the insoles chosen from this study had a great impact on the abnormal feet. They helped straighten up the tilted feet structure, that expectedly relieved unbalanced foot pressure and alleviate foot pain.
Overall, foot images submitted by a patient are informative enough for remote diagnosis, so that the computerized system can choose an insole design to fit each patient. Without investment in advanced equipment in crafting, the custom insole could now be accessible and affordable to all patients and to a larger public needing foot care related to pronation and supination. A practical telehealth system to serve this type of preliminary diagnoses is being developed.

CONCLUSION
In summary, foot images with sufficient resolution submitted by a patient are informative enough for the system to choose an insole design that fits the patient's needs. Without investment in advanced equipment in crafting, the custom insole could now be accessible and affordable to all patients and to a larger public needing foot care related to pronation and supination. A practical online system to serve this type of preliminary diagnoses is being developed; however, the proposed models still have some limitations and deserve intensive investigation in the following issues. − The samples participated in this study did not cover all possible foot abnormalities. More complicated and severe cases should be investigated. − Performance of the models can be improved by introducing more parameters. − Derivation of foot data in this study requires such a skillful operator as a podiatrist to work on the images. A powerful automated image processing application is in need to help retrieve the data with lesser assistance of the podiatrist. The system based on the approach developed in this study can help relieve an influx of patients coming to hospitals and clinics with foot abnormalities. This remote diagnosis system supports travel restriction and social distancing policies in the midst of difficult circumstances of