Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

what's the meaning of the numbers and can we change the parameters in this function? #13

Open
ZeweiXu opened this issue Jul 30, 2018 · 1 comment

Comments

@ZeweiXu
Copy link

ZeweiXu commented Jul 30, 2018

This function is in scannet_dataset.py, I guess it is used to do coordinates normalization. What are the meaning of those numbers (e.g. 1.5,3.0,31.0,62.0)? And the 10 in the for loop?
Any help would be greatly appreciated!

def __getitem__(self, index):
    import numpy as np
    point_set = self.scene_points_list[index]
    semantic_seg = self.semantic_labels_list[index].astype(np.int32)
    coordmax = np.max(point_set,axis=0)
    coordmin = np.min(point_set,axis=0)
    smpmin = np.maximum(coordmax-[1.5,1.5,3.0], coordmin)
    smpmin[2] = coordmin[2]
    smpsz = np.minimum(coordmax-smpmin, [1.5, 1.5, 3.0)
    smpsz[2] = coordmax[2]-coordmin[2]
    cur_semantic_seg = None
    cur_point_set = None
    mask = None
    for i in range(10):
        curcenter = point_set[np.random.choice(len(semantic_seg),1)[0],:]
        curmin = curcenter-[0.75, 0.75, 1.5]
        curmax = curcenter+[0.75, 0.75, 1.5]
        curmin[2] = coordmin[2]
        curmax[2] = coordmax[2]
        curchoice = np.sum((point_set >= (curmin-0.2))*(point_set <= (curmax+0.2)),axis=1) == 3
        cur_point_set = point_set[curchoice, :]
        cur_semantic_seg = semantic_seg[curchoice]
        if len(cur_semantic_seg) == 0:
            continue
        mask = np.sum((cur_point_set >= (curmin-0.01))*(cur_point_set <= (curmax+0.01)), axis=1) == 3
        vidx = np.ceil((cur_point_set[mask, :]-curmin)/(curmax-curmin)*[31.0, 31.0, 62.0])
        vidx = np.unique(vidx[:, 0] * 31.0 * 62.0 + vidx[:, 1] * 62.0 + vidx[:, 2])
        isvalid = np.sum(cur_semantic_seg > 0)/len(cur_semantic_seg) >= 0.7 and len(vidx)/31.0/31.0/62.0 >= 0.02
        if isvalid:
            break
    choice = np.random.choice(len(cur_semantic_seg), self.npoints, replace=True)
    point_set = cur_point_set[choice,:]

    semantic_seg = cur_semantic_seg[choice]
    mask = mask[choice]
    sample_weight = self.labelweights[semantic_seg]
    return point_set, semantic_seg, sample_weight
@ouceduxzk
Copy link

its not for coord normalization, its about point clouds selection, the idea is to through away as much more unnecessary point clouds as possible without know about what is the content of the point clouds

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants