smellslikeml / ActionAI

Real-Time Spatio-Temporally Localized Activity Detection by Tracking Body Keypoints
https://www.hackster.io/actionai/actionai-custom-tracking-multiperson-activity-recognition-fa5cb5
GNU General Public License v3.0
765 stars 191 forks source link

IndexError: index 0 is out of bounds for axis 0 with size 0 #43

Open l-xk opened 3 years ago

l-xk commented 3 years ago

I run iva.py on Jetson Nano using this command: python3 iva.py 0 But there is an error:

WARNING:tensorflow:Layer lstm will not use cuDNN kernel since it doesn't meet the cuDNN kernel criteria. It will use generic GPU kernel as fallback when running on GPU Traceback (most recent call last): File "iva.py", line 275, in matched, unmatched_trackers, unmatched_detections = tracker_match(track_boxes, [b[0] for b in bboxes]) File "iva.py", line 139, in tracker_match if(IOU_mat[m[0],m[1]] < iou_thrd): IndexError: index 0 is out of bounds for axis 0 with size 0

Any ideas? Thanks!

nexflatline commented 3 years ago

I found a fix. That error happens whenever there is nothing to be tracked on the video. I added: if bboxes != []: before calling the function tracker_match on line 278, so the function won't be called if there is nothing to be tracked.

But now I get this other error instead (when there is something to be tracked):

---------------------------------------------------------------------------
TypeError                                 Traceback (most recent call last)
<ipython-input-4-791b3d45521f> in <module>
     13         track_boxes = [tracker.bbox for tracker in trackers]
     14         if bboxes != []:
---> 15             matched, unmatched_trackers, unmatched_detections = tracker_match(track_boxes, [b[0] for b in bboxes])
     16 
     17 

<ipython-input-1-3f9cc776614e> in tracker_match(trackers, detections, iou_thrd)
    130 
    131     for d, det in enumerate(detections):
--> 132         if(d not in matched_idx[:,1]):
    133             unmatched_detections.append(d)
    134 

TypeError: tuple indices must be integers or slices, not tuple