-
Notifications
You must be signed in to change notification settings - Fork 261
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Converting to RNN #91
Comments
It seems like the issue is related to the input dimensions of the RNN model during training and testing. In your train method, you are reshaping the input features to have the shape (batch_size, 1, num_features) before training the RNN model. However, during the prediction phase in the predict method of the ClassifierOnlineTest class, you are reshaping the features to have the shape (1, 1, -1). To resolve this issue, make sure that the input dimensions during training and testing are consistent. In the train method, you are reshaping the input features using PCA, and in the _init_rnn_model method, you set input_shape=(None, NUM_FEATURES_FROM_PCA) for the first LSTM layer. Therefore, the correct input shape for the RNN model during training is (batch_size, timesteps, features). Here's a suggested modification to your code: Update the train method in the ClassifierOfflineTrain class to reshape the input features to have the shape (batch_size, window_size, num_features):
Update the predict method in the ClassifierOnlineTest class to reshape the input features consistently:
By ensuring consistent reshaping of input features, you should be able to resolve the dimension mismatch issue during prediction. Does that help? |
Hello,
I tried converting it to RNN:
class ClassifierOfflineTrain(object):
''' The classifer for offline training.
The input features to this classifier are already
processed by
class FeatureGenerator
.'''
class FeatureGenerator(object):
def init(self,
window_size,
is_adding_noise=False):
'''
Arguments:
window_size {int}: Number of adjacent frames for extracting features.
is_adding_noise {bool}: Is adding noise to the joint positions and scale.
noise_intensity {float}: The noise relative to the body height.
'''
self._window_size = window_size
self._is_adding_noise = is_adding_noise
self._noise_intensity = NOISE_INTENSITY
self.reset()
class ClassifierOnlineTest(object):
''' Classifier for online inference.
The input data to this classifier is the raw skeleton data, so they
are processed by
class FeatureGenerator
before sending to theself.model trained by
class ClassifierOfflineTrain
.'''
The text was updated successfully, but these errors were encountered: