I would like to ask a question about the proper way to calculate the Dice coefficient for an image dataset. We know that the Dice coefficient is calculated via the following equation:

$$Dice = \frac{TP +TP}{TP +TP +FP +FN}$$

However, how do we calculate the mean Dice coefficient for the entire dataset ? For example, suppose we have $N$ images, each having size $(H, W)$. There might be two ways:

  • We calculate the Dice coefficient for each image, and then take the average for all images

  • We flatten all of them into an array of size $N \times H \times W$, then calculate the Dice coefficient for this array.

I do not know which way is usually used in medical image segmentation. I have tried to search for some papers, but they do not go into details about this. It would be great if someone could reference some paper about this.

  • $\begingroup$ A more standard approach is first to average in each of the formula's terms. $\endgroup$
    – ttnphns
    Nov 2, 2021 at 13:01
  • $\begingroup$ @Alexis Yes that's right, I just grabbed a formula on the web. $\endgroup$ Nov 2, 2021 at 23:24
  • $\begingroup$ Closely related: stats.stackexchange.com/questions/519508/… $\endgroup$ Nov 11, 2021 at 12:41

1 Answer 1


In my research group, we calculate the Dice coefficient for the separate image sets. Here are some papers in which this method is used: [1,2,3]. We are currently writing another paper in which we use the same method.

The reason for this is that you can not only report the average Dice, but also the range (worst Dice - best Dice) and standard deviation. In my opinion, this is a far more intuitive way of calculating the Dice than concatenating all image sets into one. Good luck!

[1] Linderup BW, Küseler A, Jensen J, Cattaneo PM (2015). A Novel Semiautomatic Technique for Volumetric Assessment of the Alveolar Bone Defect Using Cone Beam Computed Tomography.

[2] Vinayahalingam S, Xi T, Bergé S, Maal T, de Jong G (2019). Automated detection of third molars and mandibular nerve by deep learning.

[3] Xi T, Schreurs R, Heerink WJ, Bergé SJ, Maal TJJ (2014). A Novel Region-Growing Based Semi-Automatic Segmentation Protocol for Three-Dimensional Condylar Reconstruction Using Cone Beam Computed Tomography (CBCT).


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.