chensong1995 / HybridPose

HybridPose: 6D Object Pose Estimation under Hybrid Representation (CVPR 2020)
MIT License
415 stars 64 forks source link

lib/datasets/blender_linemod.py Some question #64

Open Sdy344 opened 3 years ago

Sdy344 commented 3 years ago

class BlenderLinemodDataset(Dataset): def init(self, base_dir='data/blender_linemod', linemod_base_dir='data/linemod', object_name='ape', size=10000, augment=True, occlude=True, split='train'): self.base_dir = base_dir self.object_name = object_name linemod_objects = ['ape', 'benchviseblue', 'cam', 'can', 'cat', 'driller', 'duck', 'eggbox', 'glue', 'holepuncher', 'iron', 'lamp', 'phone'] self.other_object_names = [] for object_name in linemod_objects: if object_name == self.object_name: continue self.other_object_names.append(object_name)

compute length

    data_dir = os.path.join(base_dir, self.object_name)
    self.length = len(list(filter(lambda x: x.endswith('jpg'), os.listdir(data_dir))))
    self.size = size
    # pre-load data into memory
    label_dir = os.path.join(base_dir, '{}_labels'.format(self.object_name))
    self.pts2d = np.float32(np.load(os.path.join(label_dir, 'keypoints_2d.npy')))
    self.img_transform = transforms.Normalize(mean=[0.485, 0.456, 0.406],
                                              std=[0.229, 0.224, 0.225])
    self.augment = augment
    if augment:
        self.rot_ang_min = -30
        self.rot_ang_max = 30
    self.occlude = occlude
    self.split = split
    pts3d_name = os.path.join(linemod_base_dir, 'keypoints',
                              **object_name,** 'keypoints_3d.npy')
    self.pts3d = np.float32(np.load(pts3d_name))
    normal_name = os.path.join(linemod_base_dir, 'symmetries',
                               **object_name,** 'symmetries.txt')
    self.normal = self.read_normal(normal_name)

Hello, I want to confirm that this bold variable is right?

chensong1995 commented 3 years ago

Hello Sdy344,

Thanks for your question! The variable names as they are shown here appear correct to me. If you can kindly describe the issue you have encountered, I may be in a better position to provide assistance.

I hope this helps!