Closed LSnyd closed 4 years ago
I have the same problem. Have you solved this problem?
I just wrote my own function:
`def create_sseg_file(gemms, labels, export_name_sseg): gemmlabels = {} classes = len(np.unique(labels)) totaledges = len(gemms) sseg = np.zeros([ totaledges, classes]) for i, edges in enumerate(gemms): alllabels = [] for edge in range(len(edges)): lookupEdge = edges[edge] label = labels[lookupEdge] alllabels.append(label) gemmlabels[i] = alllabels
for i, edges in enumerate(gemms):
gemmlab = gemmlabels[i]
uniqueValues, counts = np.unique(gemmlab, return_counts=True)
for j, label in enumerate(uniqueValues):
weight = 0.125*counts[j]
sseg[i][int(label) - 1] = weight
np.savetxt(export_name_seseg, sseg, fmt='%1.6f')`
You can get the "gemms" from
def get_gemm_edges(faces, export_name_edges):
# gemm_edges: array (#E x 4) of the 4 one-ring neighbors for each edge
# sides: array (#E x 4) indices (values of: 0,1,2,3) indicating where an edge is in the gemm_edge # entry of the 4 neighboring edges
# for example edge i -> gemm_edges[gemm_edges[i], sides[i]] == [i, i, i, i]
edge_nb = []
edge2key = dict()
edges = []
edges_count = 0
nb_count = []
for face_id, face in enumerate(faces):
faces_edges = []
for i in range(3):
cur_edge = (face[i], face[(i + 1) % 3])
faces_edges.append(cur_edge)
for idx, edge in enumerate(faces_edges):
edge = tuple(sorted(list(edge)))
faces_edges[idx] = edge
if edge not in edge2key:
edge2key[edge] = edges_count
edges.append(list(edge))
edge_nb.append([-1, -1, -1, -1])
nb_count.append(0)
edges_count += 1
for idx, edge in enumerate(faces_edges):
edge_key = edge2key[edge]
edge_nb[edge_key][nb_count[edge_key]] = edge2key[faces_edges[(idx + 1) % 3]]
edge_nb[edge_key][nb_count[edge_key] + 1] = edge2key[faces_edges[(idx + 2) % 3]]
nb_count[edge_key] += 2
np.savetxt(export_name_edges, edges, fmt='%i')
return edge_nb, edges
hi @LSnyd , i like to know about how successful was your experiment with newly generated seseg file . i also like to know how to generate a new .seg file and what its content represent . i assume in .seg file, each row represent a vertex and number represent the class id. so far i am planning to generate .seg file by using paraview tool to save group of points into .csv file and then assign class id and append them in .seg file . is my workflow correct or do you have any better way to do the labeling.
Hi there, I received the same results as provided in the example data, so it seems like that it is working.
I just worked with Blender to create the segmentations. Then I exported the .eseg file from there and create the seseg file with the script above.
Hi @LSnyd can you share the steps to create .seg file using blender . i have not used blender yet. is there a way to directly export .seg file from blender?. thanks
Hi @ranahanocka! I want to create new ground truth data for the human data set with slightly varying vertices to check whether your trained model will be able to segment those. I managed to create the ground truth eseg file with the matlab code that you provided. Unfortunately, the seseg-files are not created and I can't find a different function that I have to run. Is there a different way to create the seseg files?