Lung infection represents one of the most perilous indicators of Covid-19. The most efficient diagnostic approach entails the analysis of CT scan images. Utilizing deep learning algorithms and machine vision, computer scientists have devised a method for automated detection of this disease. This study proposes a two-stage approach to identifying lung infection. In the initial stage, image features are extracted through a transfer learning framework employing ResNet50, with the last two layers being fixed. Subsequently, a CNN neural network is constructed for image detection and categorization in the second stage. By employing superior image feature selection and minimizing non-informative features, this proposed method achieves impressive accuracy metrics: 98.99% accuracy, 98.91% sensitivity, and 99.10% specificity. Furthermore, a comparative analysis is conducted between this method and six other architectures (Inception, InceptionResNetV2, ResNet101, ResNet152, VGG16, VGG19), with and without transfer learning. The findings demonstrate that the proposed method attains 98% accuracy on test data, without succumbing to overfitting.