ckjellson / MTO_SW_LSTM

Many-to-one sliding window LSTM implementation in Pytorch
17 stars 2 forks source link

Input and output of the LSTM #1

Closed YangXiaojie1998 closed 12 months ago

YangXiaojie1998 commented 3 years ago

Hey, I've noticed your wonderful work in the kaggle competition and I am learning your code. I am wondering what are the input and output of the LSTM, you said you used rotation vector and accelerometer imformation but I am not quite clear how you organized them and put them into deep learning networks? It will be appreciated if you can help me with that.

ckjellson commented 3 years ago

Thank you! I recomputed the rotation vector to azimuth, pitch and roll, and used windows of [sin(azimuth), cos(azimuth), pitch, roll, acc_x, acc_y, acc_z] as input (normalized). Sin and cos are used to deal with the discontinuity of [0,2pi] for azimuth which is the important factor for estimating heading. Hope that helps :)

YangXiaojie1998 commented 3 years ago

Thank you for your reply! So there are 7 attributes for every timestamp and you input records between two waypoints, and the corresponding output is displacement, am I right? It looks better than kalman filter! By the way, does the parameter _windowsize n mean that n records are aggregate to one tensor/vector?

ckjellson commented 3 years ago

Sounds right. Input sequence: 7xnbr_timestamps, Output: [Delta_x, Delta_y]. Each input to the LSTM is 7xwindow_size, jumping with length "stride" in the sequence.

YangXiaojie1998 commented 3 years ago

Sounds right. Input sequence: 7xnbr_timestamps, Output: [Delta_x, Delta_y]. Each input to the LSTM is 7xwindow_size, jumping with length "stride" in the sequence.

I see. Thank you again for your reply and congratulations on your second place in the competition! I learnt a lot!

ckjellson commented 3 years ago

Thanks, no problem!

YangXiaojie1998 commented 3 years ago

Hey @ckjellson , I tried you model this week but I might have some problems which contrbuted to 31.08 training loss! I used sigmoid to nomalize my input data, for data between two waypoint is [sin(azimuth), cos(azimuth), pitch, roll, acc_x, acc_y, acc_z] * ntimestamp, and the output is displacement between two waypoint. I also correct ahrs information and eliminate the influence of gravity, but the result looks terrible and there is no optimization for loss. Did I make some mistakes in some details?

ckjellson commented 3 years ago

Sounds like what I did. Difficult for me to say, but I guess I haven't stated anywhere that the output coordinates were normalized assuming a maximal displacement of 30m in any direction and using the Tanh as output activation so the output can be negative as well (I noticed it is sigmoid on this page which is just the general model)