Comments (5)
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
from meshcnn.
I have the same problem. Have you solved this problem?
from meshcnn.
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.
from meshcnn.
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.
from meshcnn.
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
from meshcnn.
Related Issues (20)
- How to input a mesh file to know the classification result? HOT 2
- IndexError: index out of range
- AssertionError
- What is the relationship between your meshes and original coseg meshes?
- Segmentation of objects with different characteristic
- assert no zero face area
- Does the class "Mesh" have an attribute about face?
- Undestanding .eseg file
- Proper TensorBoard Usage
- How to prepare data for a custom dataset?
- cannot install pytorch=1.2.0 HOT 1
- How to save a segmented (colored) mesh in .obj format?
- IndexError: index out of range
- Using my own obj files for training
- The problem when I run meshcnn classification HOT 1
- Problems with date preprocessing.
- help in figuring out how human_seg dataset was created
- Cannot load pre-trained weights
- Request for further documentation of code options on the meshcnn wiki for the Classification task
- Numpy error? HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from meshcnn.