Answers.Body: <p>CNNs are translation invariant.</p>
  
  <p>You are over complicating the problem.  The easiest thing you can do is define a region of interest (ROI) of the hood.  In the first case where the car is moving and the reflections are dynamic.  In the second case they are static.  Just do frame-to-frame image subtraction of the hood.  If the vehicle is moving you will have lots of 'edge energy'.  If it is not moving it will be just noise.  </p>
  
  <p>You can apply the same method to the whole image too.  In the static case the image subtraction method may become messy as the clouds are moving along with vehicles and pedestrians.  For this case use the image subtractions as input to your method.</p>
  
  <p>Another approach is to run an image stabilization algorithm.  OpenCV has one.  Look at the transformation outputs (translation, rotation, scale, rigid, similarity, affine, etc.).  If you can't make a simple filter on them to determine the two cases, train a classifier.</p>
  
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2018-04-16T06:12:09.460Z
Answers.Text: Do you mean translation equivariant? pooling layers are responsible for the invariance, right? and I didn't use pooling in my methods.
Answers.UserDisplayName: Naveen
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2018-04-15T13:23:35.233Z
Answers.LastActivityDate: 2018-04-15T13:56:54.827Z
Answers.LastEditDate: 2018-04-15T13:56:54.827Z
Answers.UserDisplayName: Brian O'Donnell
Body: <p>How can I classify a given sequence of images (video) as either moving or staying still from the perspective of the person inside the car?</p>
  <p>Below is an example of the sequence of 12 images animated.</p>
  <ol>
  <li>Moving from the point of the person inside the car.</li>
  </ol>
  <p><a href="https://i.sstatic.net/n2kj7.gif" rel="nofollow noreferrer"><img src="https://i.sstatic.net/n2kj7.gif" alt="Class 0: Moving" /></a></p>
  <ol start="2">
  <li>Staying still from the point of the person inside the car.</li>
  </ol>
  <p><a href="https://i.sstatic.net/jUM4x.gif" rel="nofollow noreferrer"><img src="https://i.sstatic.net/jUM4x.gif" alt="Class 1: still" /></a></p>
  <p>Methods I tried to achieve this:</p>
  <ol>
  <li><p>A simple CNN (with 2d convolutions) with those 12 images (greyscaled) stacked in the channels dimension (like Deepmind's DQN). The input to the CNN is <code>(batch_size, 200, 200, 12)</code>.</p>
  </li>
  <li><p>A CNN with 3d convolutions. The input to the CNN is <code>(batch_size, 12, 200, 200, 1)</code>.</p>
  </li>
  <li><p>A CNN+LSTM (time-distributed with 2d convolutions). The input to the neural network is <code>(batch_size, 12, 200, 200, 1)</code>.</p>
  </li>
  <li><p>The late fusion method, which is taking 2 frames from the sequence that are some time steps apart and passing them into 2 CNNs (with same weights) separately and concatenating them in a dense layer <a href="https://static.googleusercontent.com/media/research.google.com/en//pubs/archive/42455.pdf" rel="nofollow noreferrer">As mentioned in this paper</a>. This is also like CNN+LSTM without the LSTM part. The input to this net is <code>(batch_size, 2, 200, 200, 1)</code> -&gt; the 2 images are first and last frames in the sequence</p>
  </li>
  </ol>
  <p>All the methods I tried failed to achieve my objective. I tried tuning various hyperparameters, like the learning rate, the number of filters in CNN layers, etc., but nothing worked.</p>
  <p>All the methods had a <code>batch_size</code> of 8 (due to memory constraint) and all images are greyscaled. I used ReLUs for activations and softmax in the last layer. No pooling layer was used.</p>
  <p>Any help on why my methods are failing or any pointers to a related work</p>
  
Tags: <machine-learning><convolutional-neural-networks><video-classification>
Title: How can I determine whether a car in a video is moving or not?
UserDisplayName: Naveen
ThreadText: # How can I determine whether a car in a video is moving or not?
  
  (Asked by: username_0 on 2018-04-15)
  
  How can I classify a given sequence of images (video) as either moving or staying still from the perspective of the person inside the car?
  
  Below is an example of the sequence of 12 images animated.
  
  1. Moving from the point of the person inside the car.
  
  [![Class 0: Moving](https://i.sstatic.net/n2kj7.gif)](https://i.sstatic.net/n2kj7.gif)
  
  2. Staying still from the point of the person inside the car.
  
  [![Class 1: still](https://i.sstatic.net/jUM4x.gif)](https://i.sstatic.net/jUM4x.gif)
  
  Methods I tried to achieve this:
  
  1. A simple CNN (with 2d convolutions) with those 12 images (greyscaled) stacked in the channels dimension (like Deepmind's DQN). The input to the CNN is `(batch_size, 200, 200, 12)`.
  2. A CNN with 3d convolutions. The input to the CNN is `(batch_size, 12, 200, 200, 1)`.
  3. A CNN+LSTM (time-distributed with 2d convolutions). The input to the neural network is `(batch_size, 12, 200, 200, 1)`.
  4. The late fusion method, which is taking 2 frames from the sequence that are some time steps apart and passing them into 2 CNNs (with same weights) separately and concatenating them in a dense layer [As mentioned in this paper](https://static.googleusercontent.com/media/research.google.com/en//pubs/archive/42455.pdf). This is also like CNN+LSTM without the LSTM part. The input to this net is `(batch_size, 2, 200, 200, 1)` -> the 2 images are first and last frames in the sequence
  
  All the methods I tried failed to achieve my objective. I tried tuning various hyperparameters, like the learning rate, the number of filters in CNN layers, etc., but nothing worked.
  
  All the methods had a `batch_size` of 8 (due to memory constraint) and all images are greyscaled. I used ReLUs for activations and softmax in the last layer. No pooling layer was used.
  
  Any help on why my methods are failing or any pointers to a related work
  
  **Tags:** machine-learning, convolutional-neural-networks, video-classification
  
  ---
  
  ## 1 answers
  
  ### Answer by username_1 on 2018-04-15. Score: 1
  
  CNNs are translation invariant.
  
  You are over complicating the problem. The easiest thing you can do is define a region of interest (ROI) of the hood. In the first case where the car is moving and the reflections are dynamic. In the second case they are static. Just do frame-to-frame image subtraction of the hood. If the vehicle is moving you will have lots of 'edge energy'. If it is not moving it will be just noise.
  
  You can apply the same method to the whole image too. In the static case the image subtraction method may become messy as the clouds are moving along with vehicles and pedestrians. For this case use the image subtractions as input to your method.
  
  Another approach is to run an image stabilization algorithm. OpenCV has one. Look at the transformation outputs (translation, rotation, scale, rigid, similarity, affine, etc.). If you can't make a simple filter on them to determine the two cases, train a classifier.
  
  > **Comments:**
  > **username_0**: Do you mean translation equivariant? pooling layers are responsible for the invariance, right? and I didn't use pooling in my methods.  
  
  ---
  
  