The Adaptive Focal Loss (A-FL) function enhances medical image segmentation by addressing class imbalance and improving accuracy for small or irregularly shaped objects. Incorporating smoothness and volume information, A-FL dynamically adjusts parameters based on object characteristics. Tested on the Picai 2022 and BraTS 2018 datasets with a ResNet50-encoded U-Net architecture, A-FL achieved significant improvements in Intersection over Union (IoU) and Dice Similarity Coefficient (DSC), outperforming standard Focal Loss and other methods. This approach offers a promising enhancement for deep learning models in medical diagnostics.