Displaying velocity in workflow

In my workflow I have a tracker that track objects and I want to dipslay the velocity of the the object.

After the Byte_tracker I placed a Velocity block but I dont find any way to display the calculated velocity on the video.
When I connect a Label_Visualization block I get only the standard text like class and so on (I connected the predictions to be the ones from the previous Velocity block

Hi @lightov , try the Text Display Block: Text Display - Roboflow Inference

@lightov you can also replace class name with velocity/speed using custom python block

def run(self, detections) -> BlockResult:
    detections.data["class_name"] = np.array([f"{s:.2f}" for s in detections.data["speed"]])
    return {"detections": detections}

You can then use label visualization and show class_name

Thanks
Where do I need to add the given phyton code ?

If you search for “custom python” you will find the block where you can drop the code, you will need to add input called “detections” of type “object detections” to match the code from example

Great
What should I put in the ouput definition of the phyton block?

Thanks a lot
and what about the output of the Custon Phyton Block , what shoudl I define there ?
This what I did and it seems to cause some errors:

You got it right by using detections as output, there seems to be a typo in input name - you typed detection but it should be detections

This topic was automatically closed 21 days after the last reply. New replies are no longer allowed.