A Dynamically Weighted Loss Function for Unsupervised Image Segmentation