0
votes

I've created keras model to recognize human activity, based on data from mobile accelerometer:

model = Sequential()
model.add(Reshape((const.PERIOD, const.N_FEATURES), input_shape=(240,)))
model.add(Conv1D(100, 10, activation='relu', input_shape=(const.PERIOD, const.N_FEATURES)))
model.add(Conv1D(100, 10, activation='relu'))
model.add(MaxPooling1D(const.N_FEATURES))
model.add(Conv1D(160, 10, activation='relu'))
model.add(Conv1D(160, 10, activation='relu'))
model.add(Flatten())
model.add(Dropout(0.5))
model.add(Dense(7, activation='softmax'))
model.summary()
model.compile(loss='categorical_crossentropy', optimizer='adam', metrics=['accuracy'])

I've tested model, and the accuracy after ten epochs is like 85-90%. I don't know, but when I converse my model to TF Lite and I run interpreter in my android app, there's horrible predictions. What can be reason of that bad results? No compatibility on keras -> tensorflow -> tensorflow lite line? Should I run it with another way, using something like servlet + keras model?

1
You quickly jumped into your model, have you considered that it might be the training data? - Joe
But if it's the same phone, same acitivities, what can be wrong with the data? - yaw
The way I collect is the same for each of activity, i.e. holding in preffered position or in my pocket. - yaw

1 Answers

0
votes

A few suggestions:

  1. Try to visualize your tflite graph with https://lutzroeder.github.io/netron/. See if there's anything unexpected.
  2. Try to debug with tensorflow lite's python API first. Feed the same input to the keras model and tflite model and compare the output tensor.