Skip to content

Commit 6eec7ab

Browse files
author
Meida Chen
committed
Added test data preparation
1 parent 557e397 commit 6eec7ab

File tree

1 file changed

+17
-3
lines changed

1 file changed

+17
-3
lines changed

HAIS/data/prepare_data_inst_instance_stpls3d.py

Lines changed: 17 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -125,6 +125,9 @@ def preparePthFiles(files, split, outPutFolder, AugTimes=0):
125125
counter += 1
126126
else:
127127
torch.save((coords, colors, sem_labels, instance_labels), outFilePath)
128+
# outFilePthPath = outFilePath[:-4]+'.npy'
129+
# data = np.concatenate((coords, colors, np.expand_dims(sem_labels, axis=1), np.expand_dims(instance_labels, axis=1)), axis=1)
130+
# np.save(outFilePthPath,data)
128131
### save text file for each pth file
129132
# outFilePath = os.path.join(outPutFolder,name+str(blockNum)+'.txt')
130133
# outFile = open(outFilePath,'w')
@@ -134,9 +137,12 @@ def preparePthFiles(files, split, outPutFolder, AugTimes=0):
134137
# sem_labels[i],instance_labels[i]))
135138
else:
136139
torch.save((coords, colors), outFilePath)
137-
# # save text file for each pth file
138-
# outFilePath = os.path.join(outPutFolder,name+str(blockNum)+'.txt')
139-
# outFile = open(outFilePath,'w')
140+
# outFilePthPath = outFilePath[:-4]+'.npy'
141+
# data = np.concatenate((coords, colors), axis=1)
142+
# np.save(outFilePthPath,data)
143+
# save text file for each pth file
144+
# outFileTxtPath = outFilePath[:-4]+'.txt'
145+
# outFile = open(outFileTxtPath,'w')
140146
# for i in range(len(coords)):
141147
# outFile.write("%f,%f,%f,%f,%f,%f\n" %(coords[i][0],coords[i][1],coords[i][2],
142148
# colors[i][0],colors[i][1],colors[i][2]))
@@ -191,3 +197,11 @@ def prepareInstGt(valOutDir, val_gtFolder,semantic_label_idxs):
191197
val_gtFolder = os.path.join(data_folder,'val_gt')
192198
os.makedirs(val_gtFolder,exist_ok=True)
193199
prepareInstGt(valOutDir, val_gtFolder, semantic_label_idxs)
200+
201+
testSplit = [26,27,28]
202+
split = 'test'
203+
testFiles = getFiles(filesOri, testSplit)
204+
testOutDir = os.path.join(data_folder,split)
205+
os.makedirs(testOutDir,exist_ok=True)
206+
if len(testFiles)>0:
207+
preparePthFiles(testFiles, split, testOutDir)

0 commit comments

Comments
 (0)