Anika1683
Anika1683

Reputation: 1

StrongSORT, calling `class_id.int()` throws AttributeError: 'numpy.int64' object has no attribute 'int'

I am getting this error:

Traceback (most recent call last):
  File "/Users/anika/PycharmProjects/ml_projects/flask_ui.py", line 101, in <module>
    tracks = tracker.update(bboxes_xywh,pred.confidence,classes,og_frame)
  File "/Users/anika/PycharmProjects/ml_projects/strong_sort/strong_sort.py", line 67, in update
    self.tracker.update(detections, classes, confidences)
  File "/Users/anika/PycharmProjects/ml_projects/strong_sort/sort/tracker.py", line 83, in update
    self.tracks[track_idx].update(
  File "/Users/anika/PycharmProjects/ml_projects/strong_sort/sort/track.py", line 269, in update
    self.class_id = class_id.int()
AttributeError: 'numpy.int64' object has no attribute 'int'

here's a code snippet that I have tried

while True:
        ret, frame = cap.read()
        if ret:
            detections = np.empty((0, 5))
            og_frame = cv2.cvtColor(frame,cv2.COLOR_BGR2RGB)
            frame = og_frame.copy()

            pred = get_prediction(frame,pipeline)
            labels = pred.labels
            # class_i = pred.class_names

            class_id_mapping = {class_label:class_id for class_id,class_label in enumerate(pipeline.class_names)}
            default_class_id = 0

            classes = np.array([class_id_mapping.get(class_label,default_class_id) for class_label in labels])
.......
...
          tracks = tracker.update(bboxes_xywh,pred.confidence,classes,og_frame)

Upvotes: 0

Views: 64

Answers (0)

Related Questions