Incompatible tensor shape when trying to train custom model for mediapipe gesture recognition

16 views Asked by At

I am trying to train a custom model on Google Colab for mediapipe's hand gesture recognition found here.

I am able to upload, unzip, and load the dataset, but when the cell to train the model runs, it immediately throws an error:

ValueError: Received incompatible tensor with shape (5,) when attempting to restore variable with shape (21,) and name custom_gesture_recognizer_out/bias:0.

All the code in the Google Colab is unchanged, except for the the name of the folder with my data.

I have tried to find out how to edit the existing cells, but there is essentially nothing online about changing the tensor parameters for this colab. I can't find any reference to shape/input_shape/tensor-shape regarding mediapipe gesture recognition either.

Im worried it has to do with me expanding the number of potential states; originally it was 4 (none, roc, paper, scissors) but I've given it 20 + none making 21 (the number referenced in the shape mismatch), but in that case I don't know where the 5 came from.

Any help would be hugely appreciated.

Answer: The Google Colab had cached info from the previous training cycles. Make sure you clear your cache and hard reset the colab (disconnect from the kernal and create a new connection) before retraining with new data

0

There are 0 answers