facebookresearch/votenet

Question about loading labels of sunrgbd

Marigod98 opened this issue · 3 comments

in sunrgbdsunrgbd/sunrgbd_utils.py :

class SUNObject3d(object):
def init(self, line):
data = line.split(' ')
data[1:] = [float(x) for x in data[1:]]
self.classname = data[0]
self.xmin = data[1]
self.ymin = data[2]
self.xmax = data[1]+data[3]
self.ymax = data[2]+data[4]
self.box2d = np.array([self.xmin,self.ymin,self.xmax,self.ymax])
self.centroid = np.array([data[5],data[6],data[7]])
self.unused_dimension = np.array([data[8],data[9],data[10]])
self.w = data[8]
self.l = data[9]
self.h = data[10]
self.orientation = np.zeros((3,))
self.orientation[0] = data[11]
self.orientation[1] = data[12]
self.heading_angle = -1 * np.arctan2(self.orientation[1], self.orientation[0])

why w=data[8]? according to matlab file, I think data[8] is the value along x-axis, so why not be l = data[8]
where can I find some instructions about the dataset or coordinate system?

I also find it a bit confusing. Here it reads the lables from lable_dir (saved as classname, box2d(1), box2d(2), box2d(3), box2d(4), centroid(1), centroid(2), centroid(3), coeffs(1), coeffs(2), coeffs(3), orientation(1), orientation(2) ) and assign the corresponding attributes to the returned object of the class SUNObject3d() as in the code above. (self.w = data[8] self.l = data[9]).

Then when the object returned immediately after is used in sunrgbd_data.py:

200    for data_idx in data_idx_list:
            print('------------- ', data_idx)
 *         objects = dataset.get_label_objects(data_idx)
    
            # Skip scenes with 0 object
            if skip_empty_scene and (len(objects)==0 or \
                len([obj for obj in objects if obj.classname in type_whitelist])==0):
                    continue
    
            object_list = []
            for obj in objects:
                if obj.classname not in type_whitelist: continue
                obb = np.zeros((8))
                obb[0:3] = obj.centroid
                # Note that compared with that in data_viz, we do not time 2 to l,w.h
                # neither do we flip the heading angle
*               obb[3:6] = np.array([obj.l,obj.w,obj.h])
                obb[6] = obj.heading_angle
                obb[7] = sunrgbd_utils.type2class[obj.classname]
                object_list.append(obb)         

but l, w, h should corresoind to dx, dy,dz. (as said in sunrgbd_data.py line 129 or sunrgbd_detection_dataset line 9)

I also find it a bit confusing. Here it reads the lables from lable_dir (saved as classname, box2d(1), box2d(2), box2d(3), box2d(4), centroid(1), centroid(2), centroid(3), coeffs(1), coeffs(2), coeffs(3), orientation(1), orientation(2) ) and assign the corresponding attributes to the returned object of the class SUNObject3d() as in the code above. (self.w = data[8] self.l = data[9]).

Then when the object returned immediately after is used in sunrgbd_data.py:

200    for data_idx in data_idx_list:
            print('------------- ', data_idx)
 *         objects = dataset.get_label_objects(data_idx)
    
            # Skip scenes with 0 object
            if skip_empty_scene and (len(objects)==0 or \
                len([obj for obj in objects if obj.classname in type_whitelist])==0):
                    continue
    
            object_list = []
            for obj in objects:
                if obj.classname not in type_whitelist: continue
                obb = np.zeros((8))
                obb[0:3] = obj.centroid
                # Note that compared with that in data_viz, we do not time 2 to l,w.h
                # neither do we flip the heading angle
*               obb[3:6] = np.array([obj.l,obj.w,obj.h])
                obb[6] = obj.heading_angle
                obb[7] = sunrgbd_utils.type2class[obj.classname]
                object_list.append(obb)         

but l, w, h should corresoind to dx, dy,dz. (as said in sunrgbd_data.py line 129 or sunrgbd_detection_dataset line 9)

I think this is because as raw data in .mat format, they are stored in the order of dy dx dz.

I also find it a bit confusing. Here it reads the lables from lable_dir (saved as classname, box2d(1), box2d(2), box2d(3), box2d(4), centroid(1), centroid(2), centroid(3), coeffs(1), coeffs(2), coeffs(3), orientation(1), orientation(2) ) and assign the corresponding attributes to the returned object of the class SUNObject3d() as in the code above. (self.w = data[8] self.l = data[9]).
Then when the object returned immediately after is used in sunrgbd_data.py:

200    for data_idx in data_idx_list:
            print('------------- ', data_idx)
 *         objects = dataset.get_label_objects(data_idx)
    
            # Skip scenes with 0 object
            if skip_empty_scene and (len(objects)==0 or \
                len([obj for obj in objects if obj.classname in type_whitelist])==0):
                    continue
    
            object_list = []
            for obj in objects:
                if obj.classname not in type_whitelist: continue
                obb = np.zeros((8))
                obb[0:3] = obj.centroid
                # Note that compared with that in data_viz, we do not time 2 to l,w.h
                # neither do we flip the heading angle
*               obb[3:6] = np.array([obj.l,obj.w,obj.h])
                obb[6] = obj.heading_angle
                obb[7] = sunrgbd_utils.type2class[obj.classname]
                object_list.append(obb)         

but l, w, h should corresoind to dx, dy,dz. (as said in sunrgbd_data.py line 129 or sunrgbd_detection_dataset line 9)

I think this is because as raw data in .mat format, they are stored in the order of dy dx dz.

it helps, thank you for the reply!