The new diagnosis-guided loss weighting method outperforms other methods and allows for effective training when facing class imbalance, and pretrained architectures can be readily used with high-resolution images without downsampling.
<italic>Objective:</italic> This paper addresses two key problems of skin lesion classification. The first problem is the effective use of high-resolution images with pretrained standard architectures for image classification. The second problem is the high-class imbalance encountered in real-world multi-class datasets. <italic>Methods:</italic> To use high-resolution images, we propose a novel patch-based attention architecture that provides global context between small, high-resolution patches. We modify three pretrained architectures and study the performance of patch-based attention. To counter class imbalance problems, we compare oversampling, balanced batch sampling, and class-specific loss weighting. Additionally, we propose a novel diagnosis-guided loss weighting method that takes the method used for ground-truth annotation into account. <italic>Results:</italic> Our patch-based attention mechanism outperforms previous methods and improves the mean sensitivity by <inline-formula><tex-math notation="LaTeX">$\text{7}\%$</tex-math></inline-formula>. Class balancing significantly improves the mean sensitivity and we show that our diagnosis-guided loss weighting method improves the mean sensitivity by <inline-formula><tex-math notation="LaTeX">$\text{3}\%$</tex-math></inline-formula> over normal loss balancing. <italic>Conclusion:</italic> The novel patch-based attention mechanism can be integrated into pretrained architectures and provides global context between local patches while outperforming other patch-based methods. Hence, pretrained architectures can be readily used with high-resolution images without downsampling. The new diagnosis-guided loss weighting method outperforms other methods and allows for effective training when facing class imbalance. <italic>Significance:</italic> The proposed methods improve automatic skin lesion classification. They can be extended to other clinical applications where high-resolution image data and class imbalance are relevant.