-
Notifications
You must be signed in to change notification settings - Fork 5
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Transfer PartNet latent code(size=part_num, 128) to SDM hidden code(size=1, 32) #12
Comments
Here is my test code and model sdm latent codes: https://1drv.ms/u/s!AkQAmtyxosCJwF24G_fT2ifvqR9R?e=ISxfOt
|
Some update: def encoder_and_decode(self, sess, datainfo, latent, path):
# model's sdm code(1, 32) -> partnet codes(8, 128)
latent = np.expand_dims(latent, axis=0)
recover = sess.run([self.embedding_decode[self.part_num]], feed_dict = {self.embedding_inputs[self.part_num]: latent})[0]
recoversym = np.reshape(recover, (len(recover), self.part_num, self.part_dim+self.hiddendim[0]))
symmetryf = np.concatenate([np.expand_dims(recover_datasymv2(recoversym[:,k,-self.part_dim:], datainfo.boxmin[k], datainfo.boxmax[k]), axis = 1) for k in range(self.part_num)], axis = 1)
# generate edited obj
recovers = None
for k in range(self.part_num):
recover = sess.run([self.embedding_decode[k]], feed_dict = {self.embedding_inputs[k]: recoversym[:,k,:self.hiddendim[0]]})[0]
deforma_v1, deforma_v_align = sess.run([self.deform_vertex[k], self.deform_vertex_align[k]], feed_dict={self.feature2point: recover, self.controlpoint: np.tile([0,0,0], (np.shape(recover)[0], 1, 1))})
deforma_v1 = self.alignallmodels(deforma_v1, id = k)
self.v2objfile(deforma_v1, path + '/gt_struc_' + self.part_name[k], ['0'], '0', self.part_name[k])
if k == 0:
recovers = recover.copy()
else:
recovers = np.concatenate([recovers, recover.copy()])
# encode shape features(8, 3752, 9) -> sdm latent code(1, 32)
if advance_api:
app_handle = sess.run(self.app_iterator.string_handle())
for i in range(self.part_num+1):
sess.run(self.app_iterator.initializer, feed_dict={self.inputs_feature: np.expand_dims(recovers, axis=0), self.inputs_symmetry: symmetryf})
while True:
try:
embedding = sess.run([self.encode[i]], feed_dict = {self.handle: app_handle})[0]
except tf.errors.OutOfRangeError:
break
print(embedding.shape) # (1, 32)
# decode sdm latent code to obj file, this should be like "gt_struc" obj
recover_from32 = sess.run([self.embedding_decode[self.part_num]], feed_dict = {self.embedding_inputs[self.part_num]: embedding})[0]
recoversym_from32 = np.reshape(recover_from32, (len(recover_from32), self.part_num, self.part_dim+self.hiddendim[0]))
for k in range(self.part_num):
recover = sess.run([self.embedding_decode[k]], feed_dict = {self.embedding_inputs[k]: recoversym_from32[:,k,:self.hiddendim[0]]})[0]
deforma_v1, deforma_v_align = sess.run([self.deform_vertex[k], self.deform_vertex_align[k]], feed_dict={self.feature2point: recover, self.controlpoint: np.tile([0,0,0], (np.shape(recover)[0], 1, 1))})
deforma_v1 = self.alignallmodels(deforma_v1, id = k)
self.v2objfile(deforma_v1, path + '/pred_struc_' + self.part_name[k], ['0'], '0', self.part_name[k])
# save inter_sym.mat
sio.savemat(path+'/inter_sym_pred.mat', {'symmetry_feature':symmetryf, 'emb':embedding})
np.savez(f'{path}/embedding.npz', z=embedding)
return Still, no matter what latent I input, I always got the same chair model(the last image in my first comment). Thanks & Regards, |
Hello, @shinxg, sorry to bother you. |
Hi, @susan31213, I think you could check whether the latent code of the wrong model is the same as the previous model. If the latent code is the same, the results are also the same, right? Thanks for your interest on our work! Best, |
Hello @jie, But now I encounter another problem in the copy-paste scenario. I only edit the chair's back, and I re-encode the edited model to a sdm latent code and decode it, but got the result like this: Best, |
Hi, Thanks for your help in resolving the reproduce issue last time. Now I'm trying to replace some parts of model with another model.
I have two model's sdm latent codes whose size are both (1, 32) and they look like this:
My goal is replacing Model.1's chair back with Model.2's back.
First, I got their PartNet code by:
Next, I replaced the back part of Model.1's PartNet code with the back part of Model.2's PartNet code, and generate the obj file.
The obj file looks like this:
Looks great! 👍
But when I encode its shape feature whose size is [8, 3752, 9] into sdm latent code:
and decode the sdm code to obj file:
The obj file looks like this, and it doesn't looks like the result in above image: 😢
I'm wondering the problem is the order in the shape feature of preprocessing data and inferenced data are different, so I got a wrong sdm latent code 🤔 ?
Thanks for reading this issues and I will be grateful for any help you can provide.
Regards,
Susan
The text was updated successfully, but these errors were encountered: