How to train a csv Data with Tensorflow to make predictions?


Im trying to train my CSV Data to make prediction. Im using Tensorflow to train the data. Im using Tensorflow for the the first time and do not know how to do it properly. I hope to receive your support.

My CSV Data has an x-axis of 62 (number of rows) and a y-axis of 46377 (number of columns). In the column class the letters are displayed. In the columns x1,y1,z1... x21,y21,z21 are coordinates of the letteras which ive created by showing some sign with my hands.

class    x1        y1     ...     y21       z21 
A     0.187087  0.668525  ... -0.024700  0.220235 
B     0.202503  0.669253  ... -0.107100  0.240229 
C     0.248009  0.676325  ... -0.070317  0.278087  
C     0.245750  0.658381  ... -0.077429  0.282217 
D     0.235889  0.643202  ... -0.080697  0.262705

What i would like to do is to make words recognisable with the help of letter shapes. For example, if I show the letter A with my hands, the letter A should be displayed as text. For that i need a to predict which sign is shown. I have tried to implement this but i dont know if this is correct. Ive just used the Dense Layer. How can I test them in the real time? Ive tried something by loading the model but unfortunately, nothing is displayed.


Honestly, I do not see where the mistake can be… When you say "but unfortunately, nothing is displayed", you talk about the print(letter)and cv2.putText() ?
because looking at your code I don’t see any error that could lead to an empty letter variable especially if you don’t get any error messages like "difference n_col between your train and your test". Did you try to debug ?
Things i will do will be:

  • make sure LabelEncoder worked well (1 letter –> 1 class)
  • is the model working or not ? (not in term of performances but more in term of checking if input and output shape are the ones you expect). for this, personnaly, i prefer to separate train and test (sklearn.preprocessing) and train only on train and then make a model.predict(x_test) juste to be sure that the output shape is correct and a suitable accuracy (you won’t find the best accuracy without hyperparameter tunning i think)
  • I would also check if the and model.load works (check if you get the same results on x_test with the same x_test with and without saving/loading the model)
  • if all this is ok then it’s your prediction which cause a problem. I tried on my side just to see the shape of row and X and it seems similar to the shape of x_train so it’s very weird if the problem is here.
  • I don’t have enough experience to debug the cv2.putText(….) so if the problem is here I can’t help you sorry.

I am a beginner in Tf like you so i I might have missed a small detail but to me the algorithmic seems right

Answered By – Raklet57

This Answer collected from stackoverflow, is licensed under cc by-sa 2.5 , cc by-sa 3.0 and cc by-sa 4.0

Leave a Reply

(*) Required, Your email will not be published