paul-pias / Object-Detection-and-Distance-Measurement

Using yolov3 & yolov4 weights objects are being detected from live video frame along with the measurement of the object from the camera without the support of any extra hardware device.
348 stars 118 forks source link

Distance calculation #16

Open Bobcode508 opened 4 years ago

Bobcode508 commented 4 years ago

Thanks for the code, Paul! Your calculation of the distance is impressing and the description is very clear. However, I think it applies to the objects those are facing the camera directly or near direct facing the camera. If an object is distorted a lot in the image, for example, the objects from a CCTV camera, where the image covers a wide range of areas, the calculation may not be applied. In that case, maybe we should use perspective transform and wrapping before applying your method? Any suggestion?

paul-pias commented 4 years ago

Thank you for your interest in the code. You are right in some sense. The performance of the distance calculation entirely depends on the object detector. Because, if a model perfectly finds the saliency of the object(localization of the object) appearing in each frame then there won't be an issue. For modern object detectors such as Yolact++ it doesn't matter if an object is directly facing the camera or not ( Obviously there will be some trade-off between accuracy and precision). However, as we are missing the depth information from the 2D image, you might not always get the actual distance on a large scale scenario. And yes, you can try wrapaffine the image for some sort of alignment to see if there is any advantage or not.

paul-pias commented 4 years ago

And you can see the performance in the CCTV view from the following link. This was using yolov3 as object detector. The performance should be way better if you can use efficientDet, Yolov4, or Yolact.

https://bit.ly/3f5puYq

HassanBinHaroon commented 2 years ago

Check out the following relevant and easiest implementation.

https://github.com/HassanBinHaroon/object_detection-PLUS-distance_estimation-v1