A Recurrent Variational Autoencoder for Human Motion Synthesis

class algorithm.vae_lstm.models.MotionLSTM(*args: Any, **kwargs: Any)[source]

A Motion LSTM model for recurrent generation of motion sequence

Parameters
  • input_size (int) – size of input vector

  • hidden_size (int) – size of hidden state vector

forward(x, init_states: Optional[Tuple[torch.tensor, torch.tensor]] = None, isSampling: bool = False, num_adding_frame: int = 0)[source]

Forward method for the model

Parameters
  • init_states (Tuple[torch.tensor, torch.tensor]) – initial states for hidden and cell state vector

  • isSampling (bool) – whether we are doing sampling or training

  • num_adding_frame (int) – number of frames to be additonally sampled (only useful in sampling mode, for training mode it should be set to 0)

sampling(x: torch.tensor, num_adding_frame: int, init_states: Optional[Tuple[torch.tensor, torch.tensor]] = None)[source]

Sampling output given input sequence

Parameters
  • x (torch.tensor) – input sequence

  • num_adding_frame (int) – whether we are doing sampling or training

  • init_states (Tuple[torch.tensor, torch.tensor]) – initial states for hidden and cell state vector

class algorithm.vae_lstm.models.VAE_LSTM(*args: Any, **kwargs: Any)[source]

VAE-LSTM model for motion sequence generation

Parameters
  • num_joints (int) – number of joints in model

  • input_frame (int) – number of frames to be additonally sampled

forward(x)[source]

Forward method for the model

Parameters

x (torch.tensor) – input motion sequence

sampling(x, num_adding_frame)[source]

Sampling output given input sequence

Parameters
  • num_adding_frame (int) – number of frames to be additionally sampled

  • num_adding_frame – whether we are doing sampling or training

  • init_states (Tuple[torch.tensor, torch.tensor]]) – initial states for hidden and cell state vector

Note that due to pooling/unpooling, the actually frame additionally generated will be 4 * num_adding_frame

train(lr: float, num_epochs: int, train_loader: torch.utils.data.dataloader)[source]

train the data and output the loss

Parameters
  • lr (float) – learning rate

  • num_epochs (int) – number of training epochs

  • train_loader (torch.utils.data.dataloader) – PyTorch data loader