NVlabs / PoseCNN-PyTorch

PyTorch implementation of the PoseCNN framework
Other
195 stars 49 forks source link

KeyError: 'box' #11

Open alanxuefei opened 3 years ago

alanxuefei commented 3 years ago

After run

 ./experiments/scripts/ycb_video_test.sh 0 16

The following error shows

Traceback (most recent call last):
  File "/home/alan/Desktop/PoseCNN-PyTorch/./tools/test_net.py", line 162, in <module>
    dataset.evaluation(output_dir)
  File "/home/alan/Desktop/PoseCNN-PyTorch/tools/../lib/datasets/ycb_video.py", line 702, in evaluation
    gt_box_blob[0, 1:] = gt['box'][j, :]
KeyError: 'box'

The reason is that the ground truth boxes are not stored in YCB_Video/data/0048/000001-meta.mat. The keys of 000001-meta.mat is listed as below.

dict_keys(['__header__', '__version__', '__globals__', 'labels', 'rois', 'poses', 'poses_refined']) 

Are boxes stored in 000001-box.txt?

emigmo commented 3 years ago

+1 do you solve it?

taeyeopl commented 3 years ago

I met the same problems. @emigmo @alanxuefei @yuxng Have you used the 000001-box.txt files??

Original format doesn't have the box information https://github.com/yuxng/YCB_Video_toolbox

The *-meta.mat file in the YCB-Video dataset contains the following fields:

taeyeopl commented 3 years ago

I solved it temporarily, you can refer to the code.

  input_file = 'data/YCB_Video/data'
  input_file = osp.join(input_file, '%04d/%06d-box.txt' % (seq_id, frame_id))
  names = []
  boxes = []
  with open(input_file) as f:
      while 1:
          input_line = f.readline()
          if not input_line:
              break
          if input_line[-1:] == '\n':
              input_line = input_line[:-1]
              name, b1, b2, b3, b4 = input_line.split(' ')
              boxes.append([b1, b2, b3, b4])
              names.append(name)
  names = np.array(names)
  boxes = np.array(boxes).astype(np.float)

# gt_box_blob[0, 1:] = gt['box'][j, :]
gt_box_blob[0, 1:] = boxes[names == self._classes_all[cls_index]][0]