MarkusThill / bioma-tcn-ae

Minimal Working Example of a (baseline) Temporal Convolutional Autoencoder (TCN-AE) for Anomaly Detection in Time Series
42 stars 13 forks source link

About migrating code to my own dataset #1

Open Yuruzu opened 2 years ago

Yuruzu commented 2 years ago

Hi, I want to test TCN-AE on my own dataset, and there is a problem, could you help me see how to solve it?

My dataset shape is (1000,300,300), I changed the model input parameter ts_dimension to 300, and run model.fit but it got an error ValueError: Dimensions must be equal, but are 294 and 300 for 'loss/dense_13_loss/sub' (op: 'Sub') with input shapes: [?,294,300], [?,300,300].

I checked your dataset shape and it was (19791, 1050, 1), so when I changed the data shape to (1000,1050,300) it can run well. I guess there's something wrong with the convolution layer, maybe the latent_sample_rate? But I haven't found a solution so far. Could you help me, thank you very much!

rhaghi commented 2 years ago

Hi, Have you found a solution for this? I am facing the same issue.

MarkusThill commented 2 years ago

Hi, thanks for your remark. My guess is that the sequence length of the training data is not a multiple of the latent_sample_rate. In this case the decoder of the network does not upsample the compressed time series to the original length. Probably the best solution is to add some padding/cropping layers infront/at the end whenever the the sequence length is not a multiple of the sample rate. I will try to add this the next days... For now a workaround would, for example, be to choose latent_sample_rate=30 if the sequence length of the training data is 300.