def process_node(pts, nodeIter): if len(pts) > 500000: ptMax = np.amax(pts, axis=0) ptMin = np.amin(pts, axis=0) aabbSize = ptMax - ptMin midPt = (ptMax + ptMin) * 0.5 axis = np.where(aabbSize == np.amax(aabbSize)) axis = axis[0][0] ptsLeft = np.array([pt for pt in pts if pt[axis] < midPt[axis]]) ptsRight = np.array([pt for pt in pts if pt[axis] >= midPt[axis]]) print("Processing intermediate node") print(len(pts)) print(len(ptsLeft)) print(len(ptsRight)) print() maxPtLeft = ptMax maxPtLeft[axis] = midPt[axis] minPtRight = ptMin minPtRight[axis] = midPt[axis] nodeIter = process_node(ptsLeft, nodeIter) return process_node(ptsRight, nodeIter) else: save_model(args.srcFolder + "/RueMadame_" + str(nodeIter), pts) print("Saving leaf node") print(nodeIter) print() nodeIter += 1 return nodeIter
inPts: points, inBatchIds: batchIds, inFeatures: features, inCatLabels: catLabels, inLabels: labels, isTraining: False, keepProbConv: 1.0, keepProbFull: 1.0 }) endTimeMeasure = current_milli_time() accumTime = accumTime + (endTimeMeasure - startTimeMeasure) #Save models if args.saveModels: save_model( "savedModels/" + modelsPath[0].replace("/", "-") + "_sampling_" + str(samp) + "_gt", points, labels, colors, 6) save_model( "savedModels/" + modelsPath[0].replace("/", "-") + "_sampling_" + str(samp) + "_pred", points, predictedLabelsRes.reshape((-1, 1)), colors, 6) #Compute IoU numParts = len(segClasses[cat[catLabels[0][0]][0]]) accumIoU = 0.0 for j in range(numParts): intersection = 0.0 union = 0.0 currLabel = segClasses[cat[catLabels[0][0]][0]][j] for k in range(len(labels)): if labels[k] == predictedLabelsRes[k] and labels[
testDataSet.start_iteration() for it in range(numTestModels): points, batchIds, features, gi = testDataSet.get_next_batch() lossRes, predValsRes = sess.run( [loss, predVals], { inPts: points, inBatchIds: batchIds, inFeatures: features, inPts2: points, inBatchIds2: batchIds, inFeatures2: features, inGI: gi, isTraining: False }) accumTestLoss += lossRes save_model(args.outFolder + "/" + str(it) + "_pred", points, np.clip(predValsRes, 0.0, 1.0)) save_model(args.outFolder + "/" + str(it) + "_gt", points, np.clip(gi, 0.0, 1.0)) if it % 100 == 0: visualize_progress(it, numTestModels * args.nExec) accumTestLoss = accumTestLoss / float(numTestModels * args.nExec) print("Loss: %.6f" % (accumTestLoss))
distancesRes = \ sess.run(initDistancesGraph, {inPts:initPoints, inBatchIds:batchIds, inFeatures:features, inVertexs: voxelization[0], inFaces: voxelization[1], inFaceIndexs: voxelization[2], inVoxelIndexs: voxelization[3], inAABBMin: aabbMinVal, inCellSizes: [voxelization[5]], isTraining: False}) distColors = float_to_color_scale(distancesRes, 0.02) save_model( args.modelsFolder + "/" + modelName + "_" + modelInstance + "_c", initPoints, distColors) elif args.noCompError: distColors = [[255, 255, 255] for pt in initPoints] save_model( args.modelsFolder + "/" + modelName + "_" + modelInstance + "_c", initPoints, distColors) accumErrors = [] accumErrorsDist = [] accumErrorsCluster = [] lastDistances = None for execIter in range(args.numExecs): minError = 10.0 minErrorDist = 0.0 minErrorCluster = 0.0
mTestDataSet.start_iteration() while mTestDataSet.has_more_batches(): _, points, batchIds, features, labels, _, sceneName = mTestDataSet.get_next_batch() currAccWeights = mTestDataSet.get_accuracy_masks(labels) for iterExec in range(args.nExec): lossRes, predictedLabelsRes = sess.run([loss, predictedLabels], {inPts: points, inBatchIds: batchIds, inFeatures: features, inWeights: currAccWeights, inAccWeights: currAccWeights, inLabels: labels, isTraining: False, keepProbConv: 1.0, keepProbFull: 1.0}) #Save models if args.saveModels: save_model("savedModels/"+sceneName[0]+"_gt", points, labels, objColors) save_model("savedModels/"+sceneName[0]+"_pred", points, predictedLabelsRes.reshape((-1, 1)), objColors) labels = labels.reshape((-1)) #Compute IoU for k in range(len(predictedLabelsRes)): if labels[k] != 0: if labels[k] == predictedLabelsRes[k]: accumIntersection[predictedLabelsRes[k]] = accumIntersection[predictedLabelsRes[k]] + 1.0 accumUnion[predictedLabelsRes[k]] = accumUnion[predictedLabelsRes[k]] + 1.0 else: accumUnion[labels[k]] = accumUnion[labels[k]] + 1.0 accumUnion[predictedLabelsRes[k]] = accumUnion[predictedLabelsRes[k]] + 1.0 accumGt[labels[k]] = accumGt[labels[k]] + 1.0