Hi jakaskerl
Here's the code that I implemented:
import time
# ...
while True:
# Begin timing
start_time = time.time()
for name, q in queues.items():
# Add all msgs (color frames, object detections and recognitions) to the Sync class.
if q.has():
sync.add_msg(q.get(), name)
msgs = sync.get_msgs()
if msgs is not None:
frame = msgs["color"].getCvFrame()
detections = msgs["detection"].detections
embeddings = msgs["embedding"]
# Write raw frame to the raw_output video
raw_out.write(frame)
# Update the tracker
object_tracks = tracker_iter(detections, embeddings, tracker, frame)
# For each tracking object
for track in object_tracks:
#... All existing code
# Write the frame with annotations to the output video
out.write(frame)
# End timing and print elapsed time
end_time = time.time()
elapsed_time = end_time - start_time
print(f"Elapsed time for iteration: {elapsed_time} seconds")
raw_out.release()
out.release()
These are the results I got:
Elapsed time for iteration: 0.13381719589233398 seconds
Elapsed time for iteration: 0.1333160400390625 seconds
Elapsed time for iteration: 0.13191676139831543 seconds
...
...
Elapsed time for iteration: 0.13199663162231445 seconds
Thanks, Jaka, for your input so far.I would appreciate any further suggestions you might have to fix this issue.