-
大小: 110KB文件類型: .zip金幣: 2下載: 1 次發(fā)布日期: 2021-06-17
- 語(yǔ)言: Python
- 標(biāo)簽:
資源簡(jiǎn)介
a module for 3D semantic segmentation in point clouds

代碼片段和文件信息
import?pickle
import?os
import?numpy?as?np
class?ScannetDataset():
????def?__init__(self?root?npoints=8192?split=‘train‘):
????????self.npoints?=?npoints
????????self.root?=?root
????????self.split?=?split
????????self.data_filename?=?os.path.join(self.root?‘scannet_%s.pickle‘?%?split)
????????with?open(self.data_filename?‘rb‘)?as?fp:
????????????self.scene_points_list?=?pickle.load(fp?encoding=‘bytes‘)
????????????self.semantic_labels_list?=?pickle.load(fp?encoding=‘bytes‘)
????????if?split?==?‘train‘:
????????????labelweights?=?np.zeros(21)
????????????for?seg?in?self.semantic_labels_list:
????????????????tmp?_?=?np.histogram(seg?range(22))
????????????????labelweights?+=?tmp
????????????labelweights?=?labelweights.astype(np.float32)
????????????labelweights?=?labelweights/np.sum(labelweights)
????????????self.labelweights?=?1/np.log(1.2+labelweights)
????????elif?split?==?‘test‘:
????????????self.labelweights?=?np.ones(21)
????def?__getitem__(self?index):
????????point_set?=?self.scene_points_list[index]
????????semantic_seg?=?self.semantic_labels_list[index].astype(np.int32)
????????coordmax?=?np.max(point_setaxis=0)
????????coordmin?=?np.min(point_setaxis=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]
????????sample_weight?*=?mask
????????return?point_set?semantic_seg?sample_weight
????def?__len__(self):
????????return?len(self.scene_points_list)
class?ScannetDatasetWholeScene(object):
????def?__init__(self?root?npoints=8192?split=‘train‘):
?????
?屬性????????????大小?????日期????時(shí)間???名稱
-----------?---------??----------?-----??----
?????目錄???????????0??2018-11-24?03:49??pointSIFT-master\
?????文件????????3113??2018-11-24?03:49??pointSIFT-master\README.md
?????目錄???????????0??2018-11-24?03:49??pointSIFT-master\img\
?????文件???????47663??2018-11-24?03:49??pointSIFT-master\img\fig1.png
?????目錄???????????0??2018-11-24?03:49??pointSIFT-master\models\
?????文件????????4886??2018-11-24?03:49??pointSIFT-master\models\pointSIFT_pointnet.py
?????文件????????6104??2018-11-24?03:49??pointSIFT-master\scannet_dataset.py
?????文件???????????1??2018-11-24?03:49??pointSIFT-master\test.py
?????目錄???????????0??2018-11-24?03:49??pointSIFT-master\tf_utils\
?????文件???????18149??2018-11-24?03:49??pointSIFT-master\tf_utils\pointSIFT_util.py
?????文件???????11756??2018-11-24?03:49??pointSIFT-master\tf_utils\provider.py
?????目錄???????????0??2018-11-24?03:49??pointSIFT-master\tf_utils\tf_ops\
?????目錄???????????0??2018-11-24?03:49??pointSIFT-master\tf_utils\tf_ops\grouping\
?????文件?????????188??2018-11-24?03:49??pointSIFT-master\tf_utils\tf_ops\grouping\.gitignore
?????目錄???????????0??2018-11-24?03:49??pointSIFT-master\tf_utils\tf_ops\grouping\test\
?????文件?????????300??2018-11-24?03:49??pointSIFT-master\tf_utils\tf_ops\grouping\test\compile.sh
?????文件????????3824??2018-11-24?03:49??pointSIFT-master\tf_utils\tf_ops\grouping\test\query_ball_point.cpp
?????文件????????4309??2018-11-24?03:49??pointSIFT-master\tf_utils\tf_ops\grouping\test\query_ball_point.cu
?????文件????????4230??2018-11-24?03:49??pointSIFT-master\tf_utils\tf_ops\grouping\test\query_ball_point_block.cu
?????文件????????4589??2018-11-24?03:49??pointSIFT-master\tf_utils\tf_ops\grouping\test\query_ball_point_grid.cu
?????文件????????2481??2018-11-24?03:49??pointSIFT-master\tf_utils\tf_ops\grouping\test\selection_sort.cpp
?????文件????????1920??2018-11-24?03:49??pointSIFT-master\tf_utils\tf_ops\grouping\test\selection_sort.cu
?????文件????????2454??2018-11-24?03:49??pointSIFT-master\tf_utils\tf_ops\grouping\test\selection_sort_const.cu
?????文件???????10471??2018-11-24?03:49??pointSIFT-master\tf_utils\tf_ops\grouping\tf_grouping.cpp
?????文件????????2777??2018-11-24?03:49??pointSIFT-master\tf_utils\tf_ops\grouping\tf_grouping.py
?????文件?????????886??2018-11-24?03:49??pointSIFT-master\tf_utils\tf_ops\grouping\tf_grouping_compile.sh
?????文件????????5045??2018-11-24?03:49??pointSIFT-master\tf_utils\tf_ops\grouping\tf_grouping_g.cu
?????文件?????????904??2018-11-24?03:49??pointSIFT-master\tf_utils\tf_ops\grouping\tf_grouping_op_test.py
?????目錄???????????0??2018-11-24?03:49??pointSIFT-master\tf_utils\tf_ops\interpolation\
?????文件????????5003??2018-11-24?03:49??pointSIFT-master\tf_utils\tf_ops\interpolation\interpolate.cpp
?????文件???????10969??2018-11-24?03:49??pointSIFT-master\tf_utils\tf_ops\interpolation\tf_interpolate.cpp
............此處省略18個(gè)文件信息
評(píng)論
共有 條評(píng)論