The most dangerous and quickly spreading form of cancer in the world is lung cancer. In terms of fatalities among cancer diseases, it comes in first place, and therapy is made more challenging by late-stage diagnosis. Early identification and detection are crucial for treating this lethal condition, though. Benign and malignant tumors are the two forms that manifest in the early stages of this illness. These are visible with a computed tomography (CT) scan. Thanks to machine learning, these pictures can be used to determine the stages of cancer. In this study, a machine learning framework is presented using the proposed convolutional neural network techniques in order to develop a reliable and precise classification model for the diagnosis of lung cancer and to address the problem of class imbalance datasets, a general problem in medical data that results in difficulties and mistakes in prediction. The data source for the investigation was the IQ-OTHNCCD dataset. Scale Invariant Feature Transform (SIFT) and Watershed were the best feature extraction methods employed in this work, which was provided as a segmentation method. A dataset imbalance is later resolved by data augmentation, and CNN is used to achieve classification. In the malignant lung image, we finally identify the nodule. An accuracy rate of 0.97% is achieved with the proposed CNN-based classification of CT scan pictures.