Answers.Body: <p>Well, the easiest way in order to make different frame sizes work with a convolutional neural network, is to process them using a different operations such as scaling, and or cropping in order to make them the same size. I do not know of any way currently where different frame sizes can be inputted directly into the neural network, as in order to do that you would need to almost completely change the neural network architecture. If the frames have a small difference in size, you may be able to get away with scaling the frame to the dimensions of the largest frame. This also depends upon what kind of problem you are trying to solve. While this method would work if you are trying to classify an image into a couple categories, it would not work if your are trying to do tasks such as object location. If you are doing one of the latter tasks, you should be able to pad the image with blank pixels in order to make the frame you are trying to process the dimensions of the largest one. This would work quite well, especially for object location detection. Finally, another solution is to crop the larger images to the size of the smallest one. While this will work just as well as padding, if you need any image data from the very edges of the frame, this will not work very well. So in conclusion, there are three different methods you could apply. Me personally, I would go with padding because it does not remove any important image data, and it will work very well for tasks such as object location detection. If you are doing a classification task though, scaling would work also. Finally, you could crop the images, but this would have to be evaluated for your specific task.</p>
  
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2018-11-09T02:00:45.593Z
Answers.Text: If you pad many of the training images, will the network learn to look for padding?
Answers.UserDisplayName: user3731622
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2018-11-09T03:35:33.610Z
Answers.Text: @user3731622 it depends upon how your training data is structured. If you have enough training data, and one class does not have a specific padding size to it, then you should not have any issues.
Answers.UserDisplayName: Aiden Grossman
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2018-11-09T08:20:31.680Z
Answers.Text: Thanks.  I've just come across Global Average Pooling (GAP). Instead of dense layers after CNN, I seem to recall someone suggesting GAP could be used to handle variable input image sizes for CNN.  I'm not sure how this works yet, but thought I would share.  [Here is one useful link](https://alexisbcook.github.io/2017/global-average-pooling-layers-for-object-localization/)
Answers.UserDisplayName: user3731622
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2017-04-29T18:51:45.553Z
Answers.LastActivityDate: 2017-04-29T18:51:45.553Z
Answers.UserDisplayName: Aiden Grossman
Body: <p>How to deal with videos where the frame sizes are not the same frame to frame?</p>
  
  <p>For example <a href="https://www.youtube.com/watch?v=5cKpzp358F4" rel="nofollow noreferrer">this video</a> moves up and down and when it does, the video part of the screen has a different amount of pixels vertically.  </p>
  
  <p>How to deal with different frame sizes in a CNN?</p>
  
Comments.ContentLicense: CC BY-SA 3.0
Comments.CreationDate: 2017-04-28T10:41:09.160Z
Comments.Text: ,Don't you think your question lacks something there? or it's me who isn't analyzing critically
Comments.UserDisplayName: quintumnia
Tags: <neural-networks><convolutional-neural-networks>
Title: How to deal with changing video frame sizes in a CNN?
UserDisplayName: Greg
ThreadText: # How to deal with changing video frame sizes in a CNN?
  
  (Asked by: username_0 on 2017-04-26)
  
  How to deal with videos where the frame sizes are not the same frame to frame?
  
  For example [this video](https://www.youtube.com/watch?v=5cKpzp358F4) moves up and down and when it does, the video part of the screen has a different amount of pixels vertically.
  
  How to deal with different frame sizes in a CNN?
  
  **Tags:** neural-networks, convolutional-neural-networks
  
  > **Comments:**
  > **username_1**: ,Don't you think your question lacks something there? or it's me who isn't analyzing critically  
  
  ---
  
  ## 1 answers
  
  ### Answer by username_2 on 2017-04-29. Score: 1
  
  Well, the easiest way in order to make different frame sizes work with a convolutional neural network, is to process them using a different operations such as scaling, and or cropping in order to make them the same size. I do not know of any way currently where different frame sizes can be inputted directly into the neural network, as in order to do that you would need to almost completely change the neural network architecture. If the frames have a small difference in size, you may be able to get away with scaling the frame to the dimensions of the largest frame. This also depends upon what kind of problem you are trying to solve. While this method would work if you are trying to classify an image into a couple categories, it would not work if your are trying to do tasks such as object location. If you are doing one of the latter tasks, you should be able to pad the image with blank pixels in order to make the frame you are trying to process the dimensions of the largest one. This would work quite well, especially for object location detection. Finally, another solution is to crop the larger images to the size of the smallest one. While this will work just as well as padding, if you need any image data from the very edges of the frame, this will not work very well. So in conclusion, there are three different methods you could apply. Me personally, I would go with padding because it does not remove any important image data, and it will work very well for tasks such as object location detection. If you are doing a classification task though, scaling would work also. Finally, you could crop the images, but this would have to be evaluated for your specific task.
  
  > **Comments:**
  > **username_3**: If you pad many of the training images, will the network learn to look for padding?  
  > **username_2**: @username_3 it depends upon how your training data is structured. If you have enough training data, and one class does not have a specific padding size to it, then you should not have any issues.  
  > **username_3**: Thanks.  I've just come across Global Average Pooling (GAP). Instead of dense layers after CNN, I seem to recall someone suggesting GAP could be used to handle variable input image sizes for CNN.  I'm not sure how this works yet, but thought I would share.  [Here is one useful link](https://alexisbcook.github.io/2017/global-average-pooling-layers-for-object-localization/)  
  
  ---
  
  