How can I add an extra label on my vehicle tracking code

I am working on vehicle tracking and counting code available on roboflow github and they are showing the labels of car_id, confidence and object class but I want to add speed of the vehicle as well in the label. Can you please guide me how can I do that?

Hi @Momina_Liaqat_Ali, you can use this guide here as a jumpstart to putting together speed calculations:

And here is how to draw a bounding box and write text:

Actually the problem is that I am doing like this in label:

format custom labels

    labels = [
        f"#{tracker_id} {CLASS_NAMES_DICT[class_id]} {confidence:0.2f} {speed}"
        for _, confidence, class_id, tracker_id
        in detections

here the speed is being printed in the label but all cars in a frame get the same speed on there labels. How can I solve it.

Like here, the silver car’s speed is being assigned to the black car(far away) as well.

Hi @Momina_Liaqat_Ali :wave: ! Looks like you have multiple cars and that’s why you must loop over detections to format all the labels. And it looks like you pass the same value to every label.