diff --git a/official/cv/unet/src/utils.py b/official/cv/unet/src/utils.py
index d8222fe3e381c241552b273dc986d3c6d0346a66..d50af6050030b04635398f93c1197e81bfd79abb 100644
--- a/official/cv/unet/src/utils.py
+++ b/official/cv/unet/src/utils.py
@@ -82,10 +82,10 @@ class dice_coeff(nn.Metric):
 
     def __init__(self, print_res=True, show_eval=False):
         super(dice_coeff, self).__init__()
-        self.clear()
         self.show_eval = show_eval
         self.print_res = print_res
         self.img_num = 0
+        self.clear()
 
     def clear(self):
         self._dice_coeff_sum = 0