# An Efficient Retrieval Technique for Trademarks Based on the Fuzzy Inference System
## 4 Similarity Measurement
### Local Similarity Measurement
#### 4.2.1 Node Similarity Measurement  
The FIS is used to estimate the node similarity between the tree nodes with corresponding local features in the separated weighting subtrees. It is the core method of the local similarity measurement. The FIS aims to instruct the weight assignment among the five geometric features of a node. The process of the FIS is called the 'fuzzification-fuzzy inference engine-defuzzification' routine. The key step, the fuzzy inference engine, is executed by a logical rule consisting of some IF-THEN rules established using fuzzy logic. * Fuzzification: The first step is to transform the input crisp values such as either '0' or '1' into grades of membership for the linguistic terms of fuzzy sets. The membership function is used to associate a grade with each linguistic term. Selecting a proper membership function is an application dependent problem. Some of most commonly used prototype membership functions are cone, exponential, and triangular functions. Two factors are considered when selecting the membership function for our system: the retrieval accuracy and the computational burden for evaluating a membership function. We chose the triangular function as the membership function since it has good expressiveness and high computational efficiency in the literature [30; 33], as shown in Figure 5. The input and output linguistic terms of this paper are \(\widetilde{A}\) = {'not similar','similar'} and \(\widetilde{B}\) = {'not similar','similar','very similar'}, respectively. To satisfy the requirement of the membership function in the FIS, the input crisp values must be transformed into similarity values, \(x_{f}\). The designed formula based on the Manhattan distance is defined as: \[x_{f}=1-\frac{D_{f}}{\max(F_{f}^{d},F_{f}^{r})}\] (17) where \(f=1,\ldots,5\), \(D_{f}=\left|F_{f}^{q}-F_{f}^{r}\right|\), and \(F_{f}^{q}\) and \(F_{f}^{r}\) are the \(f\)-th local geometric features of the query and retrieved image, respectively. Using Equation (17), the five features of a node described in Section 3, namely, (1) convexity, (2) eccentricity, (3) compactness, (4) circle variance, and (5) elliptic variance are transformed to the similarity crisp values, \(x_{f}\). The similarity crisp values are further converted into grades of membership \(\widetilde{x}_{f}\) for the linguistic terms of fuzzy sets. \(\bullet\) Fuzzy inference engine: The fuzzy inference engine employs fuzzy IF-THEN rules to express input-output relationships and models the qualitative inputs and reasoning process for creating the output. The law to design or build a set of fuzzy rules is based on a human being's knowledge or experience, which depends on each different actual application. The IF part is mainly used to capture knowledge using the elastic conditions, and the THEN part can be utilized to give the conclusion in linguistic variable form. This IF-THEN rule is widely used by the fuzzy inference system to compute the degree to which the input data matches the condition of a rule. In this paper, there are five input variables and two linguistic terms, so we have \(2^{5}=32\) possible rules. One of the fuzzy IF-THEN rules is represented by: \[R^{L}:\;IF\,\widetilde{x}_{1}\,\text{is}\,\,\widetilde{A}_{1}^{L},\ldots,\, \text{and}\,\widetilde{x}_{5}\,\text{is}\,\,\widetilde{A}_{5}^{L},\,\text{THEN }\,\widetilde{y}\,\text{is}\,\widetilde{B}^{L}\] (18)  
Figure 5: The input and output membership functions. (**a**) Input: \(x_{1},x_{2},\ldots,x_{5}\); (**b**) Output: \(y\). where \(L\in\{1,\,2,\ldots,\,N_{L}\}\) and \(N_{L}\) is the number of fuzzy rules. In addition, \(\widetilde{A}_{f}^{L}\) and \(\widetilde{B}^{L}\) are denoted as the linguistic terms for the grade of membership, \(\widetilde{x}_{f}\) and \(\widetilde{y}\), in the \(L\)-th rule, respectively.