*8.3. Training Proposed Model*

Feature extraction and classification are the two crucial components of the proposed image detection system. The quality of the extracted features was critical to the success of the classification process. Therefore, the extracted features were used to train the model in order to demonstrate its effectiveness in feature extraction. Figure 6 shows an image after applying the *k*-means clustering technique with feature selection. The resulting image was divided into two main clusters, black and white, in the first stage of learning. This clustered image was then used as a map for pixel-based feature extraction, where each pixel was assigned to its corresponding cluster based on the mapped image.

In the next step, the pixel values were processed with their original values for the image detection process. This approach provided two benefits. Firstly, any outlier pixels due to the X-ray device or CT-scan process were removed. Secondly, a new feature was added to the image pixels, which was the pixel group. The cluster value associated with each pixel provided valuable information for image feature extraction and detection. By considering the cluster value, we could efficiently extract the relevant features from the image and ignore the noise and other irrelevant pixels. This approach significantly improved the accuracy of image detection and reduced false positives. When processing an X-ray image, the proposed solution began by extracting the lung features of the patient and then determined whether the lungs were normal or abnormal by classifying them as positive or negative, accordingly.
