PURPOSE: The largest cause of cancer-related fatalities worldwide is lung cancer. The dimensions and positioning of the primary tumor, the presence of lesions, the type of lung cancer like malignant or benign, and the good mental health diagnosis all play a part in the diagnosis of the disease. METHODS: Three processes should be used by standard computer-assisted diagnosis (CAD) systems to detect lung cancer: preprocessing, feature extraction, and classification. Fast nonlocal means filter is first used for preprocessing (FNLM). The lung pictures are processed using the Binary Grasshopper Optimization Algorithm (BGOA) to extract the features. RESULTS: The 10 levels of the neural network architecture which automatically gathers data and categorizes them are added to the current study's suggested model, which subtracts the five levels of Imagenet. Using the same Modèle dataset, the proposed model was compared to deep learning techniques. CONCLUSION: In terms of accuracy and sensitivity, the suggested model performed better than the existing techniques (99.53% accuracy and 98.95% sensitivity). The effectiveness of the suggested strategy is superior to that of alternative methods when it is near the true positive values at the ROC curve.