NVlabs / PoseCNN-PyTorch

PyTorch implementation of the PoseCNN framework

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

KeyError: 'box'

alanxuefei opened this issue · comments

commented

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?

+1
do you solve it?

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:

  • center: 2D location of the projection of the 3D model origin in the image
  • cls_indexes: class labels of the objects
  • factor_depth: divde the depth image by this factor to get the actual depth vaule
  • intrinsic_matrix: camera intrinsics
  • poses: 6D poses of objects in the image
  • rotation_translation_matrix: RT of the camera motion in 3D
  • vertmap: coordinates in the 3D model space of each pixel in the image

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]