# Fuzzy Logic with Deep Learning for Detection of Skin Cancer
## 3 Proposed Method
### Segmentation
The pre-processed image undergoes segmentation using dynamic threshold calculation based on standard deviation methods and ensemble logics. This process generates a binary mask (depicted in Figure 4b) and identifies the segmented region of the lesion (shown in Figure 4a) through the utilization of the algorithm. **Phase-2**  
Once we have evaluated the affected area, we proceed to perform additional accurate image segmentation. Initially, we choose a threshold for phase-1 assessment based on the assumed ground truth. However, we observe that some non-affected regions are still included in the image segmentation results. In order to reduce this, we introduce an additional threshold assessment with a value lower than T, which defines the completely affected region. The following question remains, however: how much of the affected region lies in between the phase-1 and phase-2 threshold assessment rate? It is difficult to determine what should be the definite threshold assessment rate such that we can address the affected section and dispose of the highest non-affected region. To address the inherent uncertainty and imprecision in human perception, we introduced the concept of L-Function fuzzy number during the second iterative step of the image segmentation technique. By incorporating the L-Function fuzzy number, we aimed to tackle the uncertainty and improve the overall outcome compared to the first iteration. Additionally, we developed a defuzzification scheme specifically for the L-Function fuzzy number to convert it into a crisp value. This defuzzified result serves as the threshold assessment rate for the second phase of the segmentation process. A fuzzy number \(\widetilde{\text{S}}\) is said to be an L-R type fuzzy number if:  
\[\mu_{\widetilde{\text{P}}}(x)=\begin{cases}\text{L}\frac{(\text{a}-\text{i})} {\text{I}},\text{ for i }\leq\text{a},\text{ j}>0\\ \text{R}\  
**De-fuzzification of L-Fuzzy Number:** A linear L-fuzzy number \(\widetilde{\rm S}_{\rm FN}\) can be transformed into a crisp number using the area approximation system. The mathematical formulation is,  
\[\varnothing={\rm A}_{\rm L}({\rm j})+{\rm A}_{\rm R}({\rm j}) \tag{5}\]  
where, \({\rm A}_{\rm L}\) (j) = Area of left Zone (Rectangular shape (Figure 6a))  
\[=1.{\rm j}={\rm j}\]  
\({\rm A}_{\rm R}\) (j) = Area of Right Zone (Triangular area (Figure 6b))  
\[=\frac{1}{2}({\rm k}-{\rm j}).\ 1=\frac{({\rm k}-{\rm j})}{2}\]  
Thus, Defuzzification value:  
\[\varnothing={\rm A}_{\rm L}({\rm j})+{\rm A}_{\rm R}({\rm j})=\frac{({\rm k}+{ \rm j})}{2} \tag{6}\]  
Figure 7 showcases the outcome of the second sub-stage of segmentation, along with its corresponding mask. The mask in Figure 7 demonstrates a more suitable and precise representation compared to the output of the first sub-stage of segmentation. Figure 5: The graphical depiction of the L-Function fuzzy number is illustrated. Figure 6: (a): Left Zone (b): Right Zone. Figure 7: The segmentation outcome following the second phase is presented in (a) as the segmented output of the lesion, and in (b) as the segmented mask of the lesion.