• DepthAI-v2
  • Using MobileNetSSD to get the top point of an object

Hey!

I'm a huge novice to DepthAI (and python as a whole, to be honest..); I'm currently trying to get the top part of an object detected by the spatial-mobilenet-mono.py file- from 'detection.spatialCoordinates.y', I get the middle of the object, but I'm trying to get the top of the object.

This is probably super basic but I can't seem to find a simple way to do this. Thank you in advance for your help!

Hi @bobgreate
You get the centroid coordinates, there is no way to get the top y coordinate unless you know which pixel is the upper most part of the object. This is however not accurate with an object detection model since the BBOX does not align with the top most of the time.

If the BBOX aligns with the top part, then you can retrieve the top left corner and calculate y from there.

Thoughts?

Thanks! A couple questions - with the MobilenetSSD model, is the top left that you're talking about, the roi.topLeft() value? Also, is there a better model I should run for getting the top of the object? I'm using the OAK-D SR.

    Hi @bobgreate

    bobgreate s the top left that you're talking about, the roi.topLeft() value?

    Yes.

    bobgreate Also, is there a better model I should run for getting the top of the object? I'm using the OAK-D SR.

    If you manage to find a better model, sure. The issue is that when drawing a bbox, models will usually give you a rough rectangle which might not fully fit the object's height and width. Really depends on how the model was trained.

    I'd suggest checking the depth map, where the Z value increases rapidly when checking depth pixels from bottom to the top (like going from object - 1m to background 4+ meters. You know the edge is there and you also know the pixel index of that edge so you can calculate the top most point.

    Thanks,
    Jaka

    Thanks! I'll test with the topLeft value and report what I find on this thread 🙂