How to calculate distance between 2 points on real time footage in mm


Hi fellow enthusiasts,

I have recently started working on a hobby project where I wanted to calculate distance between the pupils in real time footage, and converting distance into mm. I have approached this with reference ration by taking a credit card/ debit card and then calculating the value.

For this I have a custom object detector model that I created using YOLO v8, on top of it found the centre of the pupil and now I am trying to calculate the final value. However, the model is very inconsistent and also the accuracy I am getting with this model is varying between 0.5mm to 4mm. I am looking for precision of less than or at max equal to 1mm.

I also tried with capturing 15 images and then averaging it out to get the final calculation. However, none of this is helping me here. Any help here is greatly appreciated.