Answers.Body: <p>What you need to search for is a <a href="https://arxiv.org/pdf/1605.06211v1.pdf" rel="nofollow noreferrer">Fully Convolutional Network</a>, i.e. a network that use global pooling to overcome the issue of a fixed input size. Unfortunately the model you found is not fully convolutional, and every workaround to make those pre-trained weights usable implies retraining.
  At this point it is more convenient to find something else, or train something yourself. You can take a look at this <a href="https://github.com/meetps/pytorch-semseg" rel="nofollow noreferrer">repo</a> which contains also a fully convolutional network for segmentation among other models (they don't seem to link to any pre-trained weights though).</p>
  
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2021-08-18T12:39:32.253Z
Answers.LastActivityDate: 2021-08-18T12:39:32.253Z
Answers.UserDisplayName: Edoardo Guerriero
Body: <p>I need a PyTorch Model which can do road segmentation on OAK-D camera.</p>
  <p>The <a href="https://github.com/openvinotoolkit/open_model_zoo/tree/master/models/intel/road-segmentation-adas-0001" rel="nofollow noreferrer">model provided</a> requires Input Image Size: 896x512, which is too big for running on OAK-D camera. Thus I need to re-train it with a smaller input size(224x224) and just need the BG(background) and road classes, or if any other options available which can easily make it running on the OAK-D camera.</p>
  <p>Does anyone know how to do this?</p>
  
Comments.ContentLicense: CC BY-SA 4.0
Comments.CreationDate: 2021-08-18T05:35:20.577Z
Comments.Text: The model you're using has a couple of 2 strided convolutions. You can manipulate those in your liking, omitting some for example and finetuning the other layers..
Comments.UserDisplayName: Farhood ET
Comments.ContentLicense: CC BY-SA 4.0
Comments.CreationDate: 2021-08-18T08:17:40.697Z
Comments.Text: hi @FarhoodET I am still very new to this area, could you please share a piece of code to explain what you mean?? thanks
Comments.UserDisplayName: Franva
Comments.ContentLicense: CC BY-SA 4.0
Comments.CreationDate: 2021-08-18T10:41:56.493Z
Comments.Text: @Franva unfortunately I think there is a lot of experimentation involved in AI. It is not simply a matter of taking some code and running it.
Comments.UserDisplayName: Criticize SE actions means ban
Comments.ContentLicense: CC BY-SA 4.0
Comments.CreationDate: 2021-08-18T10:55:19.680Z
Comments.Text: @user253751 definitely understood it. there are huge amount of things to twist. I'm not asking for listing all of them which is impossible. But just one viable code. One can write hundreds of words to explain things, but a piece of working code is more straightforward and appreciated.
Comments.UserDisplayName: Franva
Comments.ContentLicense: CC BY-SA 4.0
Comments.CreationDate: 2021-08-18T11:28:57.993Z
Comments.Text: @Franva What you're trying to do is somewhat similar to Transfer Learning. You can see an example here: https://www.pyimagesearch.com/2019/06/24/change-input-shape-dimensions-for-fine-tuning-with-keras/. This only changes the input shape tho, you must change the other model's dimensions to your liking and load the weights of remaining identical layers. See this for loading some but not all weights: https://stackoverflow.com/questions/43702323/how-to-load-only-specific-weights-on-keras.
Comments.UserDisplayName: Farhood ET
Tags: <training><pytorch><image-segmentation><semantic-segmentation>
Title: How to re-train an AI model to have smaller input image size
UserDisplayName: Franva
ThreadText: # How to re-train an AI model to have smaller input image size
  
  (Asked by: username_0 on 2021-08-16)
  
  I need a PyTorch Model which can do road segmentation on OAK-D camera.
  
  The [model provided](https://github.com/openvinotoolkit/open_model_zoo/tree/master/models/intel/road-segmentation-adas-0001) requires Input Image Size: 896x512, which is too big for running on OAK-D camera. Thus I need to re-train it with a smaller input size(224x224) and just need the BG(background) and road classes, or if any other options available which can easily make it running on the OAK-D camera.
  
  Does anyone know how to do this?
  
  **Tags:** training, pytorch, image-segmentation, semantic-segmentation
  
  > **Comments:**
  > **username_1**: The model you're using has a couple of 2 strided convolutions. You can manipulate those in your liking, omitting some for example and finetuning the other layers..  
  > **username_0**: hi @username_1 I am still very new to this area, could you please share a piece of code to explain what you mean?? thanks  
  > **username_2**: @username_0 unfortunately I think there is a lot of experimentation involved in AI. It is not simply a matter of taking some code and running it.  
  > **username_0**: @user253751 definitely understood it. there are huge amount of things to twist. I'm not asking for listing all of them which is impossible. But just one viable code. One can write hundreds of words to explain things, but a piece of working code is more straightforward and appreciated.  
  > **username_1**: @username_0 What you're trying to do is somewhat similar to Transfer Learning. You can see an example here: https://www.pyimagesearch.com/2019/06/24/change-input-shape-dimensions-for-fine-tuning-with-keras/. This only changes the input shape tho, you must change the other model's dimensions to your liking and load the weights of remaining identical layers. See this for loading some but not all weights: https://stackoverflow.com/questions/43702323/how-to-load-only-specific-weights-on-keras.  
  
  ---
  
  ## 1 answers
  
  ### Answer by username_3 on 2021-08-18. Score: 0
  
  What you need to search for is a [Fully Convolutional Network](https://arxiv.org/pdf/1605.06211v1.pdf), i.e. a network that use global pooling to overcome the issue of a fixed input size. Unfortunately the model you found is not fully convolutional, and every workaround to make those pre-trained weights usable implies retraining.
  At this point it is more convenient to find something else, or train something yourself. You can take a look at this [repo](https://github.com/meetps/pytorch-semseg) which contains also a fully convolutional network for segmentation among other models (they don't seem to link to any pre-trained weights though).
  
  
  ---
  
  