Deep neural networks have shown promising results in the classification of skin lesion images, particularly when they focus on the most significant regions of an image. However, the identification of melanoma continues to pose a significant challenge, primarily because of the substantial variability both within and between classes in images of moles. A new framework is proposed in this paper to develop an innovative method for effective melanoma diagnosis, presenting a new approach for Skin Lesion Classification (SLC) that combines a modified Inception ResNet v2 and Efficient Net-B4 in an ensemble. In the modified Inception ResNet v2, we incorporate a Soft-Attention (SA) mechanism. The goal is to enhance the network’s performance by using the SA mechanism to highlight informative features and suppress those that induce noise. Given the diversity of skin lesions in terms of type, texture, color, shape, and distribution, our proposed method extracts crucial features from the images by employing both the SA and merging the features of two layers of Inception ResNet v2.Furthermore, we have modified EfficientNet-B4 by adding two dense layers to improve its classification capabilities. After classifying the images with these two models, we employ soft voting for the final classification. We evaluated the performance of our proposed method on the ISIC-2017 and ISIC-2018 datasets, considering metrics such as Accuracy, Precision, Recall, and F-measures. Experimental results and a comparison with existing techniques demonstrate that our method achieves higher accuracy than current state-of-the-art methods.