Time series prediction using 1D Conv

非 Y 不嫁゛ 提交于 2020-04-18 05:42:36

问题


I am trying to implement a time series for video prediction using 1D Convolution in Kera. I have extracted feature vectors from the Pre-trained CNN model. Each Feature vector is of size 2048. Thus if a video contains 100 frames then the input size will be (100, 2048). But the problem is each video has different no of frames and I am unable to cater to the variable size of input data in Keras. My code looks like this:

#video 1 has 100 frames (100,2048)
#video 2 has 52 frames (52,2048)
#video 3 has 81 frames (81,2048)

frame = ? #I am confused how to use it for different size of data or how to change it
model_m = Sequential()
model_m.add(Conv1D(100, 10, activation='relu', input_shape=(frames, 2048)))
model_m.add(Conv1D(100, 10, activation='relu'))
model_m.add(MaxPooling1D(3))
model_m.add(Conv1D(160, 10, activation='relu'))
model_m.add(Conv1D(160, 10, activation='relu'))
model_m.add(GlobalAveragePooling1D())
model_m.add(Dropout(0.5))
model_m.add(Dense(num_classes, activation='softmax'))
print(model_m.summary())

Please help me with this I will be very Thankful.

来源:https://stackoverflow.com/questions/60911818/time-series-prediction-using-1d-conv

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!