-
Notifications
You must be signed in to change notification settings - Fork 319
修正了上次的命名问题——可视化PHC在训练中模拟高质量动作捕捉(MoCap)数据——AMASS火车肚皮舞 #4684
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
Closed
Closed
Changes from all commits
Commits
Show all changes
24 commits
Select commit
Hold shift + click to select a range
2ee15ee
运行新子项目,人体模型的搭建,成功搭建了关于neck的部分,并生成动图
sda-57 fce9aaf
Merge branch 'OpenHUTB:main' into main
sda-57 887a50f
Merge branch 'OpenHUTB:main' into main
sda-57 8333c74
人体模型的搭建,成功搭建了关于arm的部分,并生成动图
sda-57 150b695
Merge branch 'OpenHUTB:main' into main
sda-57 b7e99c1
人体模型的搭建,成功搭建,并生成动图
sda-57 806a943
Merge branch 'OpenHUTB:main' into main
sda-57 e557bf7
人体模型的初步渲染成功
sda-57 9bf13d1
Merge branch 'OpenHUTB:main' into main
sda-57 6a16257
Merge branch 'OpenHUTB:main' into main
sda-57 0523999
Merge branch 'OpenHUTB:main' into main
sda-57 bf6f5c8
优化了关于人体模型的大腿肌肉的渲染,使模型更加真实化
sda-57 24c6cee
Merge branch 'OpenHUTB:main' into main
sda-57 87fd74f
成功渲染了3D完整的人体模型
sda-57 6b9c61d
Merge branch 'OpenHUTB:main' into main
sda-57 59461f9
Merge branch 'OpenHUTB:main' into main
sda-57 8e7b701
Merge branch 'OpenHUTB:main' into main
sda-57 f1c842b
人体模型的渲染:新增 Isaac Sim/Isaac Lab 启动与 Humanoid 运行示例脚本
sda-57 2faf3fc
Merge branch 'OpenHUTB:main' into main
sda-57 d59fef2
Merge branch 'OpenHUTB:main' into main
sda-57 ca1427f
Merge branch 'OpenHUTB:main' into main
sda-57 5cc8b5f
可视化PHC在训练中模拟高质量动作捕捉(MoCap)数据的能力
sda-57 00d42f9
Merge branch 'OpenHUTB:main' into main
sda-57 4c8678a
修正了之前的命名错误
sda-57 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
101 changes: 101 additions & 0 deletions
101
src/biomechanical_hcl_smart_simulation_platform/train_belly_ dancing.py
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,101 @@ | ||
| import torch | ||
| from rl_games.common import datasets | ||
|
|
||
| class AMPDataset(datasets.PPODataset): | ||
| def __init__(self, batch_size, minibatch_size, is_discrete, is_rnn, device, seq_len): | ||
| super().__init__(batch_size, minibatch_size, is_discrete, is_rnn, device, seq_len) | ||
| self._idx_buf = torch.randperm(self.batch_size) | ||
|
|
||
|
|
||
|
|
||
| return | ||
|
|
||
| def update_mu_sigma(self, mu, sigma): | ||
| raise NotImplementedError() | ||
| return | ||
|
|
||
| # def _get_item_rnn(self, idx): | ||
| # gstart = idx * self.num_games_batch | ||
| # gend = (idx + 1) * self.num_games_batch | ||
| # start = gstart * self.seq_len | ||
| # end = gend * self.seq_len | ||
| # self.last_range = (start, end) | ||
| # input_dict = {} | ||
| # for k,v in self.values_dict.items(): | ||
| # if k not in self.special_names: | ||
| # if v is dict: | ||
| # v_dict = { kd:vd[start:end] for kd, vd in v.items() } | ||
| # input_dict[k] = v_dict | ||
| # else: | ||
| # input_dict[k] = v[start:end] | ||
|
|
||
| # rnn_states = self.values_dict['rnn_states'] | ||
| # input_dict['rnn_states'] = [s[:,gstart:gend,:] for s in rnn_states] | ||
| # return input_dict | ||
|
|
||
| def update_values_dict(self, values_dict, rnn_format = False, horizon_length = 1, num_envs = 1): | ||
| self.values_dict = values_dict | ||
| self.horizon_length = horizon_length | ||
| self.num_envs = num_envs | ||
|
|
||
| if rnn_format and self.is_rnn: | ||
| for k,v in self.values_dict.items(): | ||
| if k not in self.special_names and v is not None: | ||
| self.values_dict[k] = self.values_dict[k].view(self.num_envs, self.horizon_length, -1).squeeze() # Actions are already swapped to the correct format. | ||
| if not self.values_dict['rnn_states'] is None: | ||
| self.values_dict['rnn_states'] = [s.reshape(self.num_envs, self.horizon_length, -1) for s in self.values_dict['rnn_states']] # rnn_states are not swapped in AMP, so do not swap it here. | ||
| self._idx_buf = torch.randperm(self.num_envs) # Update to only shuffle the envs. | ||
|
|
||
| # def _get_item_rnn(self, idx): | ||
| # data = super()._get_item_rnn(idx) | ||
| # import ipdb; ipdb.set_trace() | ||
| # return data | ||
|
|
||
| def _get_item_rnn(self, idx): | ||
| # ZL: I am doubling the get_item_rnn function to in a way also get the sequential data. Pretty hacky. | ||
| # BPTT, input dict is [batch, seqlen, features]. This function return the sequences that are from the same episide and enviornment in sequentila mannar. Not used at the moment since seq_len is set to 1 for RNN right now. | ||
| step_size = int(self.minibatch_size/self.horizon_length) | ||
|
|
||
| start = idx * step_size | ||
| end = (idx + 1) * step_size | ||
| sample_idx = self._idx_buf[start:end] | ||
|
|
||
| input_dict = {} | ||
|
|
||
| for k,v in self.values_dict.items(): | ||
| if k not in self.special_names and v is not None: | ||
| input_dict[k] = v[sample_idx, :].view(step_size * self.horizon_length, -1).squeeze() # flatten to batch size | ||
|
|
||
| input_dict['old_values'] = input_dict['old_values'][:, None] # ZL Hack: following compute assumes that the old_values is [batch, 1], so has to change this back. Otherwise, the loss will be wrong. | ||
| input_dict['returns'] = input_dict['returns'][:, None] # ZL Hack: following compute assumes that the old_values is [batch, 1], so has to change this back. Otherwise, the loss will be wrong. | ||
|
|
||
| if not self.values_dict['rnn_states'] is None: | ||
| input_dict['rnn_states'] = [s[sample_idx, :].view(step_size * self.horizon_length, -1) for s in self.values_dict["rnn_states"]] | ||
|
|
||
| if (end >= self.batch_size): | ||
| self._shuffle_idx_buf() | ||
|
|
||
|
|
||
| return input_dict | ||
|
|
||
| def _get_item(self, idx): | ||
| start = idx * self.minibatch_size | ||
| end = (idx + 1) * self.minibatch_size | ||
| sample_idx = self._idx_buf[start:end] | ||
|
|
||
| input_dict = {} | ||
| for k,v in self.values_dict.items(): | ||
| if k not in self.special_names and v is not None: | ||
| input_dict[k] = v[sample_idx] | ||
|
|
||
| if (end >= self.batch_size): | ||
| self._shuffle_idx_buf() | ||
|
|
||
| return input_dict | ||
|
|
||
| def _shuffle_idx_buf(self): | ||
| if self.is_rnn: | ||
| self._idx_buf = torch.randperm(self.num_envs) | ||
| else: | ||
| self._idx_buf[:] = torch.randperm(self.batch_size) | ||
| return |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
文件名不能包含空格