I am working on a seq2seq model that will work on the sensor data attached to the athlete's leg, which can mark the start and end indexes on the sensor data such as "step start" "step end" for each step taken. I'll also do same procedure for kicks and turns.
However, the LSTM model I built does not work as I expected / I can't output a (100, 3) matrix with a size of (100.6). I've searched a lot but I think I couldn't do the right research. Can you enlighten me? Would an approach similar to the following be appropriate for this problem?
class StepModel(nn.Module):
def __init__(self, input_size, hidden_size, num_layers, output_size):
super(StepModel, self).__init__()
self.hidden_size = hidden_size
self.num_layers = num_layers
self.lstm = nn.LSTM(input_size, hidden_size, num_layers, bidirectional=True, batch_first=True)
self.fc = nn.Linear(hidden_size, output_size)
self.softmax = nn.Softmax(dim=-1)
def forward(self, x):
h0 = torch.zeros(self.num_layers, x.size(0), self.hidden_size).to(x.device)
c0 = torch.zeros(self.num_layers, x.size(0), self.hidden_size).to(x.device)
out, _ = self.lstm(x, (h0, c0))
out = self.fc(out[:, -1, :])
out = self.softmax(out)
return out