IndexError: too many indices for tensor of dimension 2 on the model detectron2

Viewed 17

I am working on Detectron2 and applied the model Instance segmentation on a video by using demo.py

I am trying to add to print the specific class which is sports-ball (class label = 32 on meta data) but I am getting the error after deploying the model. I added this code on the line 177.

for predictions, vis_frame in tqdm.tqdm(demo.run_on_video(video), total=num_frames):
                tmp_ = [i for i in predictions['instances'].pred_classes if i.item() == 32]
                print('tmp_value is:', tmp_)
                if len(tmp_) > 0:
                    empty_label.append(tmp_[0])
                if args.output:
                    output_file.write(vis_frame)
0 Answers
Related