1 Introduction

The skin is the largest organ of the human body, and various types of inflammatory, bacterial, and viral infections spread all over it, resulting in a multitude of skin diseases and health problems [1]. Common skin diseases are termed vitiligo, wrinkles, psoriasis, wounds, photoaging, melanoma, morphea, alopecia, atopic dermatitis, and acne. Malignant melanoma is the deadliest variety among all kinds of skin cancers. While early diagnosis is a major problem for patient survival, the primary stage of malignant skin lesion detection is curable. Among various forms of tumors, melanoma is the primarily lethal attacker type because it contributes to enormous death rates and has the enormous susceptibility of prevailing in nearby tissues [2]. Similarly, the common type of malignant epidermal lesion is basal cell carcinoma (BCC). The gold standard imaging techniques such as dermatoscopy or dermoscopy are utilized by radiological experts and doctors for the purpose of pigmented skin lesion diagnosis. Advanced image analysis approaches and computer-based diagnostic systems are beneficial and of great interest for experts and clinicians to obtain important data for skin disease treatment as well as early diagnosis.

The early treatment of skin cancer identification is a challenging issue and has been examined in recent years [3]. Without treatment of the skin, symptoms such as inflamed skin condition, psoriasis, fungal skin, scleroderma, varicella, candidiasis, cellulitis, and acne cause severe deaths. Differentiating skin diseases is complex due to the similarity among various complex appearances such as color, texture, and shape with different skin lesions. The melanocytic skin lesion characterizes the similarity in the dysplastic nevi and manifestation of melanoma. All over the world, more than 1000 million people are affected by various kinds of skin disorders. Skin lesions are categorized into primary and secondary stages [4]. The bulla, cyst, pustule, vesicle, nodule, discoloration, plaque, pimples, and spots are primary skin lesions. Similarly, the second stage has phyma, umbilication, maceration, atrophy, induration, fissure, ulcer, scale, excoriation, erosion, and crust. Distribution and configuration are related to skin lesions. Distribution tells about the lesion’s localization and the grouping of the lesions corresponding to the configuration [5,6,7,8].

In most of the existing research, the three major skin diseases including seborrheic keratosis (SK), squamous cell (SC), and melanoma are considered. In the last few decades, many researchers have introduced different methods for diagnosing skin diseases. Furthermore, they introduced the natural computing framework, the region of interest (ROI), gray-level co-occurrence matrix (GLCM), fractal-based regional texture analysis (FRTA) feature extraction methods, different machine learning algorithms such as artificial neural network (ANN), convolutional neural network (CNN), generative adversarial networks (GANs) with support vector machine (SVM), naive Bayes (NB), K-nearest neighboring (kNN), and so on [9,10,11]. These methods yielded better classification accuracy in terms of skin disease identification but have few shortcomings [12,13,14,15,16,17] in terms of higher dimensionality space computational complexity, more processing time, overfitting problem, noisy environment, cannot detect a particular object with light intensity variation, sensitivity to noise fully depends on the region threshold for integration, computationally expensive, user-dependent, and uses large feature vector dimensions [18,19,20,21,22,23,24].

To overcome this, we proposed a support vector machine–based black widow optimization (SVM-BWO) algorithm for effective skin disease classification. The clustering process is improved in the proposed work using the spatial information from fuzzy c-means clustering and level set technique. Five different kinds of skin disease images are taken such as psoriasis, paederus, herpes, melanoma, and benign with healthy images which are selected for skin disease classification. Next, the novel fuzzy set segmentation algorithm subsequently segments the skin lesion region. From this, the color, GLCM texture, and shape features are extracted for further process. The SVM-BWO algorithm is used to classify both the normal and abnormal skin disease classes. The proposed method demonstrates better performances in terms of accuracy, specificity, sensitivity, precision, and recall measures compared to existing methods such as radial basis function (RBF) and SVM [10], DCNN [25], DNN [26], and ANN [27]. According to the classification results, healthy, psoriasis, paederus, herpes, melanoma, and benign provide 100%, 97%, 95%, 91%, 89%, and 88% accuracies. The major contribution of this article is summarized as follows:

  • The combination of the level set fuzzy c-means (FCM) is called a novel fuzzy set algorithm, which is used for the segmentation of the lesion region.

  • The classification performance of support vector machine (SVM) is boosted up with the help of the black widow optimization (BWO) algorithm.

  • The dataset images were collected from the ISIC-2018 dataset which belongs to five classes such as psoriasis, paederus, herpes, melanoma, and benign.

  • The proposed method accomplishes higher classification accuracy than other methods such as SVM, DCNN, DNN, and ANN.

The rest of the paper is prearranged as follows: Section 2 explains the related works based on existing approaches of skin disease classification. Section 3 formulates the proposed methodology followed by the results which are discussed in Section 4. Ultimately, Section 5 concludes the paper.

2 Review of related works

The integrated computer-aided mechanism was proposed by Chatterjee et al. [10] to identify skin diseases. Prior to the classification, different kinds of quantitative features were extracted by analyzing skin lesion shape, color, texture, and irregular border. The textural information is quantified via fractal-based regional texture analysis (FRTA) and gray-level co-occurrence matrix (GLCM). The radial basis function and support vector machine were used to evaluate the performance of classification. The experimental analysis delivers 99.65%, 97.54%, and 98.99% for BCC, dysplastic nevi, and melanoma classification, but the feature dimensionality space is higher. The computer-aided classifier system was introduced by Birkenfeld et al. [11] to diagnose suspicious pigmented lesions. For this study, the authors selected 133 patients with a multitude of skin lesions. A board-certified dermatologist examines all lesions, which are categorized into whether the image is normal or abnormal. For suspicious pigmented lesions, the sensitivity of 100% is achieved based on the testing set. At a population level, this computer-aided classifier system is very helpful for skin screening.

Balaji et al. [28] proposed a dynamic graph cut algorithm (DGCA) and naive Bayes (NB) classifier for the segmentation and classification of skin disease. The experimental datasets are chosen from the International Skin Imaging Collaboration (ISIC) website (ISIC 2017) dataset that demonstrates better results while comparing to the state-of-the-art approaches such as SegNet and FCN. Here, three kinds of diseases such as keratosis, melanoma, and benign cases were considered. The comprehensive study demonstrates 92.9%, 91.2%, and 94.3% for keratosis, melanoma, and benign disease classification. The deep convolutional neural network (DCNN) classifier was suggested by Al-Masni et al. [25] to classify skin diseases. The DenseNet-201, Inception-ResNet-v2, ResNet-50, and Inception-v3 are included in the convolutional neural network classifier. The full resolution convolutional network (FrCN) segments the skin lesion boundaries from the entire dermoscopy images. The ISIC 2016, ISIC 2017, and ISIC 2018 datasets are used for the performance analysis of convolutional neural network classifiers in the case of skin disease classification.

Chatterjee et al. [29] proposed multi-label classification techniques to detect skin diseases such as SK, BCC, nevus, and melanoma. The cross-spectrum and cross-correlation methods were introduced for feature extraction. Both spectral feature extraction and spatial feature extraction are explicated with appropriate kernel patches and similar visual impacts. The epidermal, benign melanocytic, and benign melanocytic skin lesion classifications are performed via a multi-label ensemble multiclass skin lesion classification mechanism. The generative adversarial networks (GANs) were introduced by Qin et al. [30] to classify the skin lesions. The skin lesion classification performances are improved by the GAN-based data augmentation method. High-quality skin lesion images are synthesized by adjusting both the discriminator and generator. The quantitative evaluation measures such as recall, precision, inception distance (FID), and inception score (IS) evaluate the performance of skin lesion style–based GAN. From the experimental analysis, 96.6% average precision, 74.3% specificity, 83.2% sensitivity, and 95.2% accuracy are obtained.

Bajwa et al. [26] proposed a deep neural network (DNN) for skin disease identification. The skin disease images were chosen from DermNet and ISIC Archive datasets. The experimental results demonstrate better reproducibility and accuracy. However, it takes more execution time. The DNN for skin disease classification was proposed by Zhang et al. [31]. The Union Medical College Hospital provided dataset details and DNN achieved 87.25% accuracy. The experimental results demonstrate efficient classification with higher computational complexity. The deep neural network (DNN) was suggested by Khan et al. [32] to effectively classify skin diseases. The dermoscopic datasets such as ISBI 2016, ISBI 2017, and HAM 10000 provide the image dataset details. Based on the experimental result, good accuracy with better reliability is achieved. However, this model required a better feature selection model. The deep learning technique problems are solved using a wide range of optimization techniques such as PSO, ABC, CS, and ACO.

Qinghe Zheng et al. [12] improved the generalization capability of the deep CNN using implicit regularization via a two-stage training process. They used regularization to enhance the generalization capacity of the DCNN and minimize overfitting. Their proposed method gave a 76.64% accuracy for the CIFAR100 dataset and 76.23% for the ILSVRC2012 dataset. Zheng et al. [13] presented a layer-wise learning-based stochastic gradient descent (LLb-SGD) method to optimize the DCNN. An adaptive learning rate is set for each layer of the neural network using a cross-media propagation mechanism. This technique is insensitive to hyperparameters and can be applied to different datasets and architecture. Qinghe Zheng et al. [14] proposed a probably approximately correct (PAC) Bayesian framework based on the drop path technique to improve the generalization capability of DCNN. This technique reduces the model size based on the generalization error boundary. Their proposed method offered an accuracy of 81.4% for the ImageNet dataset and 96.80% for the CIFAR10 dataset.

For natural image classification, Qinghe Zheng et al. [15] offered a full stage data augmentation model for DCNN to improve its accuracy. The data augmentation done during the training and testing phases can improve its generalization ability and optimize the networks. When applied to both the coarse-grained (CIFAR10) and fine-grained (CIFAR100) datasets, the model achieves an accuracy of 93.41% and 70.22%. Qinghe Zheng et al. [16] demonstrated a spectrum interface based on two-level data augmentation testing in deep learning for automatic modulation classification. A model ensemble is used to compute the data augmentation at the testing phase. The stability and classification performance are increased via the majority voting scheme. The classification accuracy of the proposed technique using data augmentation in the training and testing stages is 58.75%. The existing methodologies used in skin disease classifications are reviewed in Table 1.

Table 1 A literature review of skin disease classification

3 Proposed approach

This study demonstrates the classification of different kinds of skin lesions such as psoriasis, paederus, herpes, melanoma, and benign. The steps involved in skin lesion identifications are image pre-processing, lesion area segmentation, feature extraction, and classification. The workflow diagram of the proposed methodology is depicted in Fig. 1.

Fig. 1
figure 1

Workflow diagram of the proposed approach

3.1 Pre-processing

Initially, the semi-automated image preprocessing method is used to pre-process the input image. Camera-specific software with input raw images is converted into the format of Tagged Image File Format (TIFF). A diameter greater than 3 mm of a single lesion in the input image is manually clipped and stored separately [11]. In this analysis, dermoscopic images were acquired under different lighting conditions and with various dermoscopic conditions. Since the gray world constancy algorithm is used for normalization, irregular lighting of light is corrected, and color variance is present in the images [10]. Image noise is an undesirable side effect that occurs as a result of image processing. As light hits the lens, sensors in a digital camera misalign, resulting in noise. Even if noise is clearly seen in an image, only a few types of image noise are bound to occur. The input is influenced by Gaussian noise, which is removed in the pre-processing stage using the Wiener filter. During pre-processing, the color standardization and image acquisition with noise removal are carried out for further process.

3.2 Image segmentation using novel fuzzy set algorithm

After pre-processing, the lesion regions are accurately segmented using the novel fuzzy set algorithm. The fuzzy clustering requires spatial information during adaptive optimization, so the intermediate morphological operations are eliminated. The combination of level set [33] and fuzzy c-means (FCM) [34] algorithms is the major reason for the models of computation, which is applied to any dimension issues. For better performance, the image segmentation is feasible to receive the specific circumstances advantage. For skin lesion region segmentation, the novel fuzzy level set algorithm is proposed. The level set evolutions regularized with the controlling parameters are estimated. The discrete stages of the image segmentation scheme are depicted in Fig. 2.

Fig. 2
figure 2

Discrete stages of the image segmentation scheme

By using spatial fuzzy clustering, the initialization and the parameter configuration of level set segmentation are automated in the presence of novel fuzzy level set algorithms. The contours of interest approximation in the medical images are determined by employing spatial and FCM restrictions. Improved level set functions accomplish the results of FCM by benefitting from the initialization of flexible as shown in Eq. (1).

$$ {\phi}_0\left(a,b\right)=\left\{\begin{array}{l}-D,\kern0.72em {\phi}_0\left(a,b\right)<0\;\\ {}D,\kern1.08em \mathrm{else}\end{array}\right. $$
(1)

where ϕ0 is the level set function and the initial contour is ϕ0(a, b) with the customizable constant D. Hence, Sk : {sk = ηmk, m = a × Mb + b} is the interest component in FCM results, and the level set function is initiated as follows:

$$ {\phi}_0\left(a,b\right)=-4\psi \left(0.5-{X}_k\right) $$
(2)

From Eq. (2), the constant regulating the Dirac function is ψ [35]. Equation (3) explains the Dirac function.

$$ \delta (a)=\left\{\begin{array}{l}0,\kern4.919997em \left|a\right|>\psi \\ {}\frac{1}{2\psi}\left[1+\cos\;\left(\frac{\pi a}{\psi}\right)\right],\kern1.08em \left|a\right|\le \psi \end{array}\right. $$
(3)

Here, the binary image Xk is obtained using Eq. (4). The adjustable threshold is x0(∈(0, 1)).

$$ {X}_k={S}_k\ge {x}_0 $$
(4)

Table 2 associates the level set methods with several controlling parameters (convergence behaviors, numerical cost of level set methods, etc.), which are very essential for skin lesion segmentation. By incorporating a regularized/hole nucleation technique into the optimization scheme, the traditional or generalized Hamilton-Jacobi level set technique [36] can be improved. However, this procedure is often complicated and requires several variables. Unfortunately, this varies from case to case, so it is important to set them up roughly. A few basic guidelines govern the setup of these parameters. Many thumb rules are applied by trial and error for the right level set segmentation. For stable evolution, the penalty coefficient (γ × η) and time step product are less than 0.25. While comparing to 2ε, the parameter D is higher. The level set evolution down has shown the larger value of D, and the boundary leakage risks have occurred. Hence, the level set evolution is accelerated by larger u. For the lesion region segmentation, the above-mentioned guidelines are very essential, but it is not enough to predict the best configuration.

Table 2 Level set segmentation based on the controlling parameters

According to Eq. (2), the initial level set function ϕ0 is convenient to determine the area β and length ℓ.

$$ \beta =\underset{1}{\int }G\left({\phi}_0\right) da\; db $$
(5)
$$ \mathrm{\ell}=\underset{1}{\int}\delta \left({\phi}_0\right) da\; db $$
(6)

where G(ϕ0) is the Heaviside function.

$$ G\left({\phi}_0\right)=\left\{\begin{array}{l}1,\kern0.96em {\phi}_0>0\\ {}0,\kern0.96em {\phi}_0<0\end{array}\right. $$
(7)

If the interest variable is larger, we observe level set evolution, and the larger ratio is denoted as follows:

$$ \zeta =\raisebox{1ex}{$\beta $}\!\left/ \!\raisebox{-1ex}{$\mathrm{\ell}$}\right. $$
(8)

In the fuzzy set algorithm, reasonably allocate the time step γ as ζ. The following equation sets the penalty coefficient η:

$$ \eta =\raisebox{1ex}{$0.2$}\!\left/ \!\raisebox{-1ex}{$\zeta $}\right. $$
(9)

For stable evolution, the product (γ × η) is lower than 0.25. From the FCM Eq. (2), we obtain the initial level set function ϕ0:

$$ \rho =0.1\zeta $$
(10)

where ρ is the contour length coefficient for smoothness regulation. The Mamdani fuzzy inference rule is used in our fuzzy technique. The two laws governing the balloon force’s level set evolution are u.

  1. (i)

    IF the expansion means negative THEN the shrinkage means positive signs in which level set function with advancing direction is determined using the sign.

  2. (ii)

    IF the fatter level set evolves THEN the value u is larger.

Set the controlling parameter u as the global constant in the standard level set function, which makes the faster level set function. When ϕ is beyond the genuine boundary, the direction of the level set function is changed automatically. The quantitative index to regularize the level set function and the initial FCM segmentation is determined. The membership degree of each image pixel ηk is taken with a novel fuzzy set algorithm. Equation (11) explains the improved balloon force.

$$ H\left({S}_k\right)=1-2{S}_k $$
(11)

At each image pixel, the variable pushing or pulling force with the balloon force output matrix is H(Sk)(∈[−1, 1]). According to FCM [37], the image gradient information incorporates ζ(h, ϕ) as given below:

$$ \zeta \left(h,\phi \right)=\gamma \delta \left(\phi \right)\left(h\frac{\nabla \phi }{\left|\nabla \phi \right|}\right)+ uh\delta \left(\phi \right) $$
(12)

Equation (12) is rewritten as follows:

$$ \zeta \left(h,\phi \right)=\gamma \delta \left(\phi \right)\mathit{\operatorname{div}}\left(h\frac{\nabla \phi }{\left|\nabla \phi \right|}\right)+ hH\left({S}_k\right)\delta \left(\phi \right) $$
(13)

The improvement of image segmentation provides many functional advantages. According to the spatial fuzzy clustering algorithm, the balloon force is directly derived. The distance to the genuine object adapts to the level set evolution. Stabilize the level set evolution automatically because the conservative ρ is presumed. For robust segmentation, the flexibility selects the larger evolution iteration T. In order to avoid excessive or insufficient segmentation, the operator keeps an alert to the level set evolution without enhancement [38].

3.3 Feature extraction

In this section, the shape, color, and texture features are extracted from the segmented lesion image. The asymmetry, color, and texture feature extraction process are explained in detail as shown below.

3.3.1 Asymmetry feature extraction

Most of the skin lesion images are asymmetrical in nature. The two parts of the segmented region never match if we categorize the region using the line. The melanoma and benign grow asymmetrically according to skin physicians. Subtracting the segmented shape area on the side of the axis design is the asymmetry value. Equation (14) explains the resulting two area differences [39].

$$ {A}_{\mathrm{symmetry}}=\left(\frac{A_{\mathrm{min}}}{A_{\mathrm{total}}}\right)\ast 100 $$
(14)

From Eq. (14), the lowest absolute difference value among various sub-regions of the given input image is Amin. The detected skin lesion shape region is Atotal. The gravity center of the pre-processed skin input image is detected thereby calculating the asymmetry of the skin lesion region. The symmetricity between bulkiness (B) is a dimensionless value, which is measured using Eq. (15).

$$ B=\frac{\mathrm{Equivalent}\kern0.34em \mathrm{Ellipse}\kern0.17em \mathrm{Area}}{\mathrm{Original}\kern0.34em \mathrm{Area}} $$
(15)

The skin lesion image occupies a similar inertia moment. Nearly 75.5% of skin lesions are malignant because of their bulkiness value. The skin lesion separated into two sections calculates the geometric asymmetry. All the points of the skin lesion are signified by presenting the space (0, a, b). The below steps calculate the symmetry rate for the given input image.

  1. (i)

    Two principle axes follow the creation of object rotation.

  2. (ii)

    Make the intersection between the thought object and the original image.

3.3.2 Color feature extraction

Melanocytic lesions are characterized by red or blue spots, tan tones, and black and brown shades. Various color features or properties involved inside the lesion are described by color descriptors [39]. Furthermore, color descriptors from different color channels, such as standard deviation and color, are considered. The following section explains the extracted color descriptors from the segmented image.

The average color value is given by the mean.

$$ \mu =\frac{1}{M}\sum \limits_{k=1}^MR $$
(16)

The square root of the variation is the standard deviation (SD).

$$ \sigma =\sqrt{\frac{1}{M}\sum \limits_{k=1}^M{\left({R}_k-\mu \right)}^2} $$
(17)

The asymmetry degree is determined using skewness.

$$ {S}_{\mathrm{kewness}}=\sqrt[3]{\frac{1}{M}\sum \limits_{k=1}^M{\left({R}_k-\mu \right)}^3} $$
(18)

The variance is given as below:

$$ {V}_{\mathrm{ariance}}=\frac{1}{M}\sum \limits_{k=1}^M{\left({R}_k-\mu \right)}^2 $$
(19)

where M represents the total sample size, R represents the color channel of the image at a specific pixel, and μ is the mean value. Equations (16) and (17) were used to calculate the color distribution characteristics. Color indexing plays a vital role in this study.

3.3.3 Texture feature extraction

At the given offset over the segmented input image, the gray-level co-occurrence matrix (GLCM) is a histogram of co-occurring grayscale pixel values [27]. From the GLCM, we extract homogeneity, energy, contrast, and correlation parameters. The skin pixels, namely, YCbCr (luminance and chrominance) color models, HSV (hue, saturation, and value), and RGB (red, green, and blue), are extracted using GLCM. The GLCM of an image computes the distance and angular relationship between the pixels in the specific region and for an image X of size M×M, the GLCM is formed as follows:

$$ R\left(j,k\right)=\sum \limits_{j=1}^M\sum \limits_{k=1}^M\left\{\begin{array}{cc}1,& r\left(a,b\right)=j\;\mathrm{and}\;X\left(a+\Delta a,b+\Delta b\right)=k\\ {}0,& \mathrm{Or}\kern0.17em \mathrm{Else}\end{array}\right. $$
(20)

The joint probability of intensities j and k is R(j,k) at any point and is defined using Δa and Δb, where a and b represent the particular position in the image, Δa represents the angle between pixels, and Δb represents the distance between pixels.

  1. (i)

    The element distribution in the matrix closeness is determined using the homogeneity parameter.

$$ {H}_{\mathrm{omogenetity}}=\sum \limits_{j,k}\frac{R\left(j,k\right)}{1+\left|j-k\right|} $$
(21)
  1. (ii)

    The sum of squared features in the GLCM corresponds to the angular second moment or energy.

$$ {E}_{\mathrm{nergy}}=\sum \limits_{j,k}R{\left(j,k\right)}^2 $$
(22)
  1. (iii)

    The local variations present in the co-occurrence conditions are measured with the help of the contrast parameter.

$$ {C}_{\mathrm{ontrast}}=\sum \limits_{j,k}{\left|j-k\right|}^2R\left(j,k\right) $$
(23)
  1. (iv)

    The possibility incidences of the identified pixel pairs are presented using correlation.

$$ {C}_{\mathrm{orrelation}}=\sum \limits_{j,k}\frac{\left(j-\mu j\right)\;\left(k-\mu k\right)R\left(j,k\right)}{\sigma_j{\sigma}_k} $$
(24)

where σj and σk are the standard deviation values of j and k, respectively. From the segmented image region, one of the influential tools is GLCM to extract image features. From the segmented image region, another interesting feature such as entropy is extracted. The differences among the two nearby pixels are similar if Rj represents the probability.

$$ {E}_{\mathrm{ntropy}}=-\sum \limits_j{R}_j\left({\log}_2{R}_j\right) $$
(25)

The correct regularity rate of the image is inferred at the end of the procedure by taking maximum values. The classification operation is performed once the entire features are extracted. Finally, the shape, color, texture, and asymmetry features are effectively extracted from the segmented image. For classification, the GLCM, color, shape, and texture features are extracted. From each segmented image, the entropy, homogeneity, energy, correlation, and contrast information features are extracted.

3.4 Classification

Next to feature extraction, these extracted features are fed to the classification process. In this study, the classification operation is performed via support vector machine (SVM) thereby the parameters present in SVM are tuned with the help of the black widow optimization (BWO) algorithm, and the newly developed classification approach is termed as the SVM-BWO algorithm. The step involved in the SVM-BWO algorithm for skin disease classification is explained below.

3.4.1 Black widow optimization algorithm

This section explains the black widow optimization (BWO) algorithm. The air-breathing arthropods are called spiders that contain venomous fangs with eight legs. These species are the largest order of arachnids among all organisms’ orders. Due to excessive neurotoxic venom potential, the spider subfamily Latrodectus consists of renowned black widows [40]. The female spider is called a black widow. The black widow optimization (BWO) inspires the lifestyle of black widows. The step-by-step process of the BWO algorithm is formulated in the following sub-section.

Population initialization

For the solution of the current problem, the problem value variables must form a suitable structure in order to solve the optimization problems. According to PSO and GA terminologies, these structures are termed particle and chromosome. The black widow spider considers the potential solution to each problem. The values of problem variables are represented using each black widow spider. The structure must be considered as an array in order to solve the benchmark functions [40]. The solution problem is represented by the widow array of 1 × Mvariables in a Mvariables dimensional optimization problem. Equation (26) explains the black widow arrays.

$$ {W}_{\mathrm{idow}}=\left[{z}_1,{z}_2,{z}_3,\dots, {z}_{M_{\mathrm{variables}}}\right] $$
(26)

where, \( \left({z}_1,{z}_2,{z}_3,\dots, {z}_{M_{\mathrm{variables}}}\right) \) is the floating number of each variable value. In this work, the black widow fitness f is evaluated as shown below.

$$ f=f\left({z}_1,{z}_2,{z}_3,\dots, {z}_{M_{\mathrm{variables}}}\right) $$
(27)

The initial population with the candidate widow matrix size (MPopulation × Mvariable) is generated to start the optimization algorithm.

Procreate

By mating, the parent pairs are randomly chosen to execute the procreating step. During or after that, the female black widow eats the male. To produce the new generation, they start to mate since the pairs are independent of each other. In each matching, approximately 1000 eggs are produced. Ultimately, few stronger spider babies lived. The array of gamma is generated, and this gamma generates the offspring. From Eq. (28), the offspring γ are x1 and x2 as well as the parents are denoted as z1 and z2.

$$ \left\{\begin{array}{l}{x}_1=\gamma \times {z}_1+\left(1-\gamma \right)\times {z}_2\\ {}{x}_2=\gamma \times {z}_2+\left(1-\gamma \right)\times {z}_1\end{array}\right. $$
(28)

When the randomly selected numbers are not duplicated, then the process is repeated for Mvariables/2 times. Finally, both mom and children are combined into new arrays and sorted by their fitness value. Few of the best individuals are fed to the newly generated population based on the rating of cannibalism.

Cannibalism

There are three types of cannibalism present in the BWO, which are presented as follows:

  • During or after mating, the male black widow is eaten by a female black widow, which is sexual cannibalism. The males and females are recognized for their fitness values.

  • The weaker siblings are eaten by strong spiderlings during sibling cannibalism. The number of survivors is detected to set the cannibalism rating as CR.

  • If the baby spiders eat their mother, then the third kind of cannibalism is often observed. The weak and strong siblings are determined via fitness value.

Mutation and convergence

From the population, the Mutepop numbers of individuals are selected randomly. Two elements in the array are exchanged by each of the randomly selected solutions. Finally, no trade observance in the fitness value of the best widow is believed to reach a certain level of accuracy over several iterations, and a predefined number of iterations are known to be stopping criteria. Algorithm 1 explains the overall steps of BWO.

figure e

3.4.2 Support vector machine tuning based on BWO (SVM-BWO)

One of the common machine learning algorithms used to solve the optimization problem is called support vector machine (SVM). The linear SVM is focused on this section which is optimized for large-scale learning. The complex tasks in various domains such as disease prediction, monitoring metal-oxide surge arrester conditions, sensor multi-fault diagnosis, and image classifications are executed via SVM [41]. The SVM is widely used for many practical problems, and it solves linear and non-linear problems. Nevertheless, the SVM is unsuitable for datasets, and the target classes are overlapping. If the number of features for each data point exceeds the number of training data samples, the SVM will crash. Hence, we used BWO to enhance the performance of SVM in terms of regularization, loss function, and kernel during classification. Figure 3 depicts the image disease classification performance based on the SVM-BWO algorithm.

Fig. 3
figure 3

SVM-BWO algorithm for skin disease classification

The SVM is trained using the hyperplane to divide the training data that corresponds to the five skin disease classes. They are mainly represented using the support vectors which are usually a subset of vectors present in the training set. By identifying the vectors selected as support vectors, one can enhance the decision-making capability of the SVM. Let us consider that the training vectors in the two classes are yj ∈ m,   J = 1, …, l and vector x ∈ l : xj = {1, −1}, where the weight vector (W) is generated using a linear classifier. Hence, the decision function is explained in Eq. (29).

$$ \operatorname{sgn}\left({W}^Ty\right) $$
(29)

The following primal problems are solved by the L2-regularized L1-loss support vector classifier.

$$ \underset{W}{\min}\frac{1}{2}{W}^TW+D\sum \limits_{j=1}^l\left(\max\;\left(0,1-{x}_j{W}^T{y}_j\right)\right) $$
(30)

where

$$ \underset{\beta }{\min}\frac{1}{2}{\beta}^T\overline{P}\beta -{e}^T\beta $$
(31)

Subject to 0 ≤ βj ≤ V,    j = 1, . . , l

where \( {P}_{jk}={x}_j{x}_k{y}_j^T{y}_k \) and the vector of all ones are e and the diagonal matrix is \( \overline{P}=P+d \).

$$ {\displaystyle \begin{array}{l}\mathrm{For}\kern0.24em L1-\mathrm{loss}\kern0.24em \mathrm{SVC}:\kern0.84em {d}_{jj}=0\;\mathrm{for}\;\mathrm{all}\;j\kern0.24em \mathrm{and}\;V=d\\ {}\mathrm{For}\kern0.24em L2-\mathrm{loss}\kern0.24em \mathrm{SVC}:\kern0.84em {d}_{jj}=\raisebox{1ex}{$1$}\!\left/ \!\raisebox{-1ex}{$2d$}\right.\mathrm{for}\;\mathrm{all}\;j\kern0.24em \mathrm{and}\;V=\infty \end{array}} $$
(32)

The sparse solution W is generated by L1-regularization. The below primal issue is solved using L1-regularized L2-loss SVC.

$$ \underset{W}{\min }{\left\Vert W\right\Vert}_1+D\sum \limits_{j=1}^l{\left(\max \left(0,1-{x}_j{W}^T{y}_j\right)\right)}^2 $$
(33)

where the penalty parameter is D > 0 and ‖⋅‖1 represents the 1-norm.

For linear SVM training, the penalty or cost parameter of error term D is selected by SVM-BWO, which increases the classification accuracy effectively. The cross-validated grid search predefines the starting value D. The red rectangle with region bounded depicts the SVM-BWO. According to [42, 43], the subset of split testing data is subjected to the selection of training data size. The computational effort and time required to train classifiers are substantially decreased, resulting in lower accuracy. This approach is expanded by a majority voting ensemble, which is represented as DL{m} _ SVM − BWO and the number of classifiers m in which the classification performances are enhanced for SVM-BWO. Furthermore, the SVM-BWO is suitable for both multi-class and binary tasks. From Fig. 2, R1 and R2 represent the random vectors. The inertia coefficients are W and the number of classes is D, where k is the different number of classes. Finally, the SVM-BWO algorithm effectively classifies the diseases based on relevant disease classes with training and testing data. The proposed SVM-BWO algorithm steps for skin disease classification are delineated in Algorithm 2.

figure f

4 Results and discussion

This section validates the proposed work performance in terms of skin disease classification. The implementation procedure of the proposed model is handled in MATLAB 2018a with Intel ® i7-4070. Different kinds of performance analysis with state-of-the-art comparisons are carried out to analyze the performance of the proposed work.

4.1 Dataset details

The key focus of this research is skin diseases such as psoriasis, paederus, herpes, melanoma, and benign classification. The experimental images are collected from the International Skin Imaging Collaboration-2018 (ISIC-2018), which is called Human Against Machine 10000 (HAM 10000) dataset [44]. This dataset consists of different kinds of skin diseases. From this dataset, we have chosen five kinds of skin diseases with 2565 sample images for training and 905 sample images for the testing process. Table 3 illustrates the list of training and testing parameters. Furthermore, the sample images with segmentation and classification outputs are depicted in Fig. 4.

Table 3 List of training and testing parameters
Fig. 4
figure 4

Sample images with segmentation and classification outputs: a, f psoriasis; b, g paederus; c, h herpes; d, i melanoma; and e, j benign

4.2 Evaluation measures

The accuracy, specificity, sensitivity, dice score, precision, and recall metrics are used in this study for the analysis of classification performance, which are formulated as follows:

$$ {A}_{\mathrm{ccuracy}}=\raisebox{1ex}{$\left( tp+ tn\right)$}\!\left/ \!\raisebox{-1ex}{$\left( tp+ fp+ tn+ fn\right)$}\right. $$
(34)
$$ {S}_{\mathrm{pecificity}}= tn/\left( tn+ fp\right) $$
(35)
$$ {S}_{\mathrm{ensitivity}}= tp/\left( tp+ fn\right) $$
(36)
$$ {D}_{\mathrm{ice}}\kern0.24em {S}_{\mathrm{core}}=\frac{2 tp}{\left(\left( fp+ tp\right)+\left( tp+ fn\right)\right)} $$
(37)
$$ {P}_{\mathrm{recision}}= tp/\left( tp+ fp\right) $$
(38)
$$ {R}_{\mathrm{ecall}}= tp/\left( tp+ fn\right) $$
(39)

where tp is true positive based on healthy images categorized as healthy, tn is true negative based on unhealthy images categorized as unhealthy, fp is false positive based on healthy images categorized as unhealthy, and fn is false negative based on unhealthy images categorized as healthy.

4.3 Performance analysis

The dice score performance for skin disease image segmentation is depicted in Table 4. DGCA [28], Otsu [44], fuzzy c-means (FCM) algorithm [34], modified level-set (MLS) [35], and the proposed method are used for this experiment. Based on this investigation, the proposed segmentation model demonstrates better segmentation results than existing methods.

Table 4 Performances of segmentation using dice score value

The texture features based on various skin disease performances are formulated in Table 5. The texture feature from the segmented skin image is selected using energy, uniformity, entropy, correlation, and contrast parameters. We use these parameters with their maximum and minimum values and five skin diseases for this experiment. The five skin disease types concerning GLCM texture feature performances are evaluated below. For maximum, psoriasis, paederus, herpes, melanoma, and benign accomplish 205.103, 121.507, 345.289, 1437.6, and 873.670 energy values. The 3.450, 3.294, 3.290, 3.923, and 3.902 maximum uniformity values are obtained from psoriasis, paederus, herpes, melanoma, and benign. For maximum entropy, psoriasis, paederus, herpes, melanoma, and benign deliver 0.5663, 0.1267, 0.5634, 0.3026, and 0.3890 values than the minimum entropy values. Furthermore, 40.289, 87.987, 178.345, 188.098, and 89.006 maximum uniformity values are obtained from psoriasis, paederus, herpes, melanoma, and benign.

Table 5 Performances of texture features based on various skin diseases

Figure 5 shows the feature extraction efficiency in terms of color, texture, and symmetry. In this work, we have extracted the color, GLCM texture, and asymmetry features from the segmented image, and these features concerning the accuracy, specificity, and sensitivity are formulated. The color feature provides 90% accuracy, 91% specificity, and 95% sensitivity. Similarly, 70% accuracy, 72% specificity, and 68% sensitivity are obtained for GLCM texture features. The asymmetry features demonstrate 80% accuracy, 82% specificity, and 80% sensitivity.

Fig. 5
figure 5

Feature extraction performances

In Fig. 6, the classification accuracy for various skin disease types is depicted. The total number of images corresponding to each category is plotted according to Table 3. In this work, 2014 healthy images with 275 psoriasis, 427 paederus, 348 herpes, 276 melanoma, and 130 benign are chosen. From this, the accuracy value of each category is represented as follows. Hence, the classification accuracies for healthy, psoriasis, paederus, herpes, melanoma, and benign are 100%, 97%, 95%, 91%, 89%, and 88%, respectively.

Fig. 6
figure 6

Classification performance with respect to the accuracy

4.4 Comparative analysis

Figure 7 depicts the convergence efficiency in comparison to state-of-the-art approaches. The genetic algorithm (GA), ant bee colony (ABC), ant colony optimization (ACO), particle swarm optimization (PSO), and black widow optimization (BWO) algorithms are used here, each with a different number of iterations and populations. The search algorithm with its convergence rate is more important than the final outputs in the case of unimodal test functions. When compared to the other methods, the proposed BWO yields a faster convergence rate with desirable outputs. The algorithms such as GA, ABC, ACO, and PSO often get trapped in the local minima and offer poor exploration capability; hence, the convergence performances of the FBWO algorithm are higher. The BWO has a higher convergence rate with a faster global optimum than other methods based on Fig. 6. The run time of the algorithm in both of the training and testing phases is explained in Table 6.

Fig. 7
figure 7

Convergence performance with respect to state-of-the-art methods

Table 6 The run time of the algorithm in both of the training and testing phases

Figure 8 plots the state-of-the-art comparison based on segmentation results. This experiment validates the segmentation performance of the proposed novel fuzzy set segmentation algorithm with other state-of-the-art methods including the dynamic graph cut algorithm (DGCA) [28], full resolution convolutional network (FrCN) [28], Otsu’s method [11], and watershed algorithm [32]. While compared to the existing methods, the proposed novel fuzzy set segmentation algorithm demonstrates better segmentation results.

Fig. 8
figure 8

State-of-the-art comparison based on segmentation results

State-of-the-art comparison based on classification results is shown in Fig. 9. In this experiment, we have selected four state-of-the-art methods including RBF and SVM [10], DCNN [25], DNN [26], artificial neural network (ANN) [27], and proposed SVM-BWO algorithms with classification measures such as accuracy, specificity, sensitivity, precision, and recall measure. While comparing to all methods, the proposed SVM-BWO only accomplishes higher performance measures. Hence, the proposed SVM-BWO method demonstrates 92% accuracy, 90% specificity, 78% sensitivity, 80% precision, and 76% recall values. Anyway, the proposed SVM-BWO outperforms better classification performances than other methods.

Fig. 9
figure 9

State-of-the-art comparison based on the classification

The segmentation performance of the proposed fuzzy level set algorithm is evaluated by comparing it with other techniques such as DGCA-NB [28], DCNN [25], GAN [30], and DNN [26]. Table 7 presents the comparison results in terms of generalization error for the different techniques along with the time taken for training and testing. From the results shown in Table 7, it is clear that the SVM offers higher segmentation accuracy when compared to the DGCA-NB [28], DCNN [25], GAN [30], and DNN [26] techniques. The DCNN, GAN, and DGCA-NB techniques have increased error rates and higher time complexity mainly due to the computational complexity associated with these techniques. Hence, it can be concluded that the segmentation performance of the fuzzy level set algorithm is higher than the others.

Table 7 Generalization performance comparison for segmentation techniques

4.5 Discussion

Figure 4 presents the results of the skin disease–affected image and the segmented scar tissue. There is a single layer of scar tissue present in both the benign and malignant skin images. Segmenting the cancerous tissues from the skin is considered a complex task because of the irregular and deprived boundaries. Despite the difficulty of determining the exact level set parameters and optimum initialization, FCM-based clustering outperforms other methods in terms of level set initialization. Since it is always necessary to monitor the motion of level set contours, the proposed fuzzy level set algorithm appears to be successful in segmenting the medical image without specific boundaries. The fuzzy level set algorithm automatically identifies the controlling parameters for fuzzy clustering and achieves precise solutions in most scenarios. Hence, the fuzzy level set algorithm serves as an excellent choice for image segmentation.

Both the neural network and deep learning techniques rely on the number of training samples used. The SVM’s segmentation performance is evaluated with the instances present in the training dataset. The generalization performance of the SVM technique in terms of generalization error is presented in Table 8 along with the time taken for training and testing. The proposed methodology is also compared with artificial neural network (ANN) [27] and deep neural network (DNN) [16]. The ANN and DNN show higher generalization errors when compared to the other techniques mainly due to the low number of training samples. The SVM technique is capable of offering high accuracy and low generalization error even with the low number of training samples; hence, the generalization error is low for the proposed technique when compared to the ANN and DNN.

Table 8 Comparison in terms of generalization performance

5 Conclusion

This paper proposed SVM-BWO for skin disease classification. The proposed model is implemented using MATLAB 2018 software. Five skin diseases including psoriasis, paederus, herpes, melanoma, and benign with healthy images are chosen. The number of training and testing images is tabulated in the above section. During feature extraction, the psoriasis, paederus, herpes, melanoma, and benign diseases accomplish optimal maximum and minimum values in terms of energy, uniformity, entropy, correlation, and contrast features. Based on the classifications, the healthy, psoriasis, paederus, herpes, melanoma, and benign provide 100%, 97%, 95%, 91%, 89%, and 88% accuracies. The convergence rate of BWO is higher and better than PSO, ABC, ACO, and GA methods. The proposed method demonstrates better performances in terms of accuracy, specificity, sensitivity, precision, and recall measures. In the future, we will explore this research into the data balancing effect for multi-class disease classification. The proposed work can be utilized by medical professionals to identify the abnormalities present in the skin at an early stage and offer appropriate treatment at the right time.