SkalskiP / yolov8-native-tracking

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

I recive the next error inside the for loop ValueError: too many values to unpack (expected 4)

Laranga22 opened this issue · comments

I'm using my own trained model with custom data set and I dont know why I get this error. Also I'm tracking over a video not from the webcam.

I also wonder if there is any chance to put the results inside a csv file or something when the video stops. Like the total amount counted is 10 for example, and also to count separate things like 2 apples and 3 oranges for example.

I'm using my own trained model with custom data set and I dont know why I get this error.

I experienced the same error, but found that the Detection class in the supervision package has been updated with a new 'mask' feature link. Hence, the detection class returns 5 instead of 4 values (xyxy, mask, confidence, class_id and tracker_id).

I simply changed the code to:
`if result.boxes.id is not None:
detections.tracker_id = result.boxes.id.cpu().numpy().astype(int)

    labels = [
        f'#{tracker_id} {model.model.names[class_id]}{confidence:0.2f}'
        for _, _, confidence, class_id, tracker_id in detections
    ]`

Alternatively, you can use the older versions of supervision and ultralytics as seen in the requirements.txt file

ultralytics==8.0.51 supervision==0.3.0