Neural Network in R - Input Data

Asked

Viewed 189 times

1

I’m having a problem with input data from a neural network, I’m working with inputs of 5000 pairs of numbers, these numbers are displacements in X and Y, that is, based on the previous frame and the current frame I can see what was the displacement and so have a signal that represents the movement. The image below shows a small sample of one of the inputs I should use for network training.

 x,y
-0.00351363, 0.000967466
0.139664, 0.0312345
0.175774, -0.00378994
0.458393, 0.116977
0.241508, -0.000456899
0.144307, 0.0148827
0.251653, 0.000391103
0.00184657, 0.0477789
0.026319, 0.0212102
0.179847, 0.0699048
0.245969, 0.0124811
0.0526478, -0.0191692
0.067206, 0.0421046
0.0491242, -0.0203557
0.348096, -0.0346274
0.134959, -0.132013
0.162158, 0.017853
0.121126, 0.0325144
0.215919, 0.0808862
0.152572, 0.0224511
0.743098, -0.0271121
0.442534, -0.00596414
0.323115, 0.0267839

When plotting the 5096 values of X and Y, the following graph is generated:Plot

My point is, this data is pixel displacement values, summarizing I’m analyzing a specific movement in a video, in this movement I store the displacement that all pixels have made, I intend to train a neural network to detect that same movement in other videos. The question is how can I pass this information to the neural network, because I need to inform that these values (which are exact 5096 pairs) correspond to the movement I wish to detect, just as I have similar movements but are not what I wish to detect (would be a supervised training). How can I pass this data to the network, because until today I only trained network in time series and in this case it would be several inputs with 5096 values and whether these values represent or not the movement.

Ex:

Entry 1: (5096 X values),(5096 Y values),(True)

Entry 2: (5096 X values),(5096 Y values),(False)

Input N: ...

Update 1

To simplify the problem of having two signals, I made the resultant of the vectors and thus obtaining only one graph.Resultante

However, it is noticeable that it would be very "exhausting" for any neural network to adjust to this, so I applied a signal filter to smooth. Using the library Signal, I applied the following filter:

resultante <- fftfilt(rep(1, 50)/50,resultante)

And with that I obtained the following result: Resultante após aplicação do filtro

Now I’m having trouble training the MLP network, 'Cause it turns out I can’t give her a list. My data is organized as follows:

Primeira linha do data frame

MLP code:

redeCA<-mlp(df$dados, df$saida, size=nNeuronios, maxit=maxEpocas, initFunc="Randomize_Weights",
            initFuncParams=c(-0.3, 0.3), learnFunc="Std_Backpropagation",
            learnFuncParams=c(0.1), updateFunc="Topological_Order",
            updateFuncParams=c(0), hiddenActFunc="Act_Logistic",
            shufflePatterns=F, linOut=TRUE) 

Error:

Error in checkInput(x, y) : 
  'x' has to be numeric, after a conversion to matrix

  • 3

    Please do not post data (or code) as images. Edit the question with the departure of dput(head(dados, 20)). Furthermore, what is the criterion for transforming continuous bivariate data into binary univariate data? Thus, it is only impossible to answer.

  • 1

    Your question is not very clear. A few questions may help you get an answer: What is your data? What is your sampling unit? What are you trying to predict? That said, in general in neural networks we use arrays multidimensional to represent the data.

  • These data are pixel shift values, it would be the drive that pixels are making frame by frame of a video. In this case I need to train the network with several inputs that represent a movement so that later the network can detect whether or not there was that specific movement. The problem is how to gather all this information, where each element is composed of 5096 values of X and Y and represent to which group these values belong.

  • 1

    yes, but what is your sample unit? do you only fear video or have several? what is your response variable?

  • Detachment in pixel unit, delta x and delta y. I have several videos with the movement I want to detect and others with similar movements, this movement lasts on average 3 to 5 seconds, would be a supervised training. My output variable would be 1 or 0, so when the trained network checks a new video, it can return whether or not there was movement.

  • I confess that I still do not understand what these displacements are... You own every frame of this video?

  • Using Farneback’s dense Optical Flow technique, I get the displacement that each pixel made relative to the previous frame, the technique analyzes the frame-by-frame video calculating where each pixel moved. I updated the post with some changes.

Show 2 more comments
No answers

Browser other questions tagged

You are not signed in. Login or sign up in order to post.