preprocess the template with the same way as train dataset results in wrong data structure and cause keyError in _get_template_info
I follow the Dataset and Pre-Processing part to prerocess train dataset and the template but I found that the "surface_pts_n_normal" result of template couldn't satisfied the need in _get_template_info.
There are some codes in _get_template_info
def _get_template_info(self):
...
templ_surf_pth = './data/template/surface_pts_n_normal/%s.mat'%self.template_name
templ_surf_mat = loadmat(templ_surf_pth)
templ_surf_pc = templ_surf_mat['p'][:, :3]
templ_trig_id = np.squeeze(templ_surf_mat['trig_id'])
templ_baryc = templ_surf_mat['bary_coord']
...
It seems that my templ_surf_mat has no key names "trig_id" or "bary_coord"
File "<ipython-input-2-5376759be172>", line 1, in <module> templ_surf_mat['trig_id'] KeyError: 'trig_id'
File "<ipython-input-3-27547a3a9825>", line 1, in <module> templ_surf_mat['bary_coord'] KeyError: 'bary_coord'
The data structure of my templ_surf_mat is:
{'__header__': b'MATLAB 5.0 MAT-file Platform: posix, Created on: Mon Oct 10 11:19:59 2022', '__version__': '1.0', '__globals__': [], 'p': array([[]])}
I wonder how to preprocess the template data correctly?
Hello, sorry for the late reply. We use barycenter based correspondence and as a result you'd need for your template surface points, the information on triangle they're a part of and its local coordinate. We provide this in the templates which we made available here.
I have the same question. Can you please tell how we could get "trig_id" or "bary_coord" for our own dataset?
and btw the file you provided doesn't contain "trig_id" or "bary_coord" either.
Hello, sorry for the late reply. We use barycenter based correspondence and as a result you'd need for your template surface points, the information on triangle they're a part of and its local coordinate. We provide this in the templates which we made available here.
Hi,
Can you please tell how we could get "trig_id" or "bary_coord" for our own dataset?
If you sample your template mesh evenly, you can get the points (coordinate in R^3) and the triangle from which they're from. Then you can get barycentric coordinate from here: , then you can convert those barycentric coordinates to other meshes in your training dataset as long as you've correspondence between triangles using this method. Which is what happens here:
btw the file you provided doesn't contain "trig_id" or "bary_coord" either
I can see those two keys in surface_pts_n_normal/template.mat file. Which file are you looking at?
Hi,
Can you please tell how we could get "trig_id" or "bary_coord" for our own dataset?
If you sample your template mesh evenly, you can get the points (coordinate in R^3) and the triangle from which they're from. Then you can get barycentric coordinate from here: , then you can convert those barycentric coordinates to other meshes in your training dataset as long as you've correspondence between triangles using this method. Which is what happens here:
btw the file you provided doesn't contain "trig_id" or "bary_coord" either
I can see those two keys in
surface_pts_n_normal/template.matfile. Which file are you looking at?
there is no surface_pts_n_normal/template.mat