How can I track objects detected by YOLOv3?

I have a Yolov3 model that detects specific objects. Now I want to track those objects using an OpenCV tracker, e.g, KCF tracker. When I initialize the tracker using “tracker_ok = tracker.init(frame, boundingBox)”, “tracker_ok” retuurns “none” .
I have this code:

for i in range(len(boxes)):
    if i in indexes:
        x1, y1, x2, y2 = boxes[i]
        w = x2 - x1
        h = y2 - y1
        tracker_ok = tracker.init(frame, (x1, y1, w, h))

        if tracker_ok:
            ok, bbox = tracker.update(frame)

            cv2.rectangle(frame, (x1, y1), (x1 + w, y1 + h), (0, 0, 255), 3)

cv2.putText(frame, f"FPS: {str(round(fps, 3))}", (10, 50), cv2.FONT_HERSHEY_DUPLEX, 1, (0, 0, 255), 3)
cv2.imshow("Detecting markers...", frame)

“Boxes” is a variable that contains the top left and bottom right corners coordinates of each object bounding box.
I can’t understand what I am doing wrong. When I initialize the tracker I define the frame where the tracker will track the objects and I define the bounding box that should be tracked.
Any suggestion to solve this problem?

related: