Normalization before or after resizing












0












$begingroup$


I'm training deep learning network using images (to be exact - I'm solving semantic segmentation problem).



What's the proper order of resizing (I need to resize images to fixed width X height) and normalization (dividing by 255 value) of images in preprocessing?



Does it make more sense to do first resizing and then normalization? Or first normalization and then resizing?










share|improve this question









$endgroup$

















    0












    $begingroup$


    I'm training deep learning network using images (to be exact - I'm solving semantic segmentation problem).



    What's the proper order of resizing (I need to resize images to fixed width X height) and normalization (dividing by 255 value) of images in preprocessing?



    Does it make more sense to do first resizing and then normalization? Or first normalization and then resizing?










    share|improve this question









    $endgroup$















      0












      0








      0





      $begingroup$


      I'm training deep learning network using images (to be exact - I'm solving semantic segmentation problem).



      What's the proper order of resizing (I need to resize images to fixed width X height) and normalization (dividing by 255 value) of images in preprocessing?



      Does it make more sense to do first resizing and then normalization? Or first normalization and then resizing?










      share|improve this question









      $endgroup$




      I'm training deep learning network using images (to be exact - I'm solving semantic segmentation problem).



      What's the proper order of resizing (I need to resize images to fixed width X height) and normalization (dividing by 255 value) of images in preprocessing?



      Does it make more sense to do first resizing and then normalization? Or first normalization and then resizing?







      machine-learning deep-learning training image-preprocessing






      share|improve this question













      share|improve this question











      share|improve this question




      share|improve this question










      asked 5 hours ago









      Antonio JurićAntonio Jurić

      3008




      3008






















          2 Answers
          2






          active

          oldest

          votes


















          1












          $begingroup$

          Resize and then normalize, that's the only pipeline that makes sense.



          If you resize after normalization, depending on the resize algorithm, you may end up with values that are outside of the normalized range.






          share|improve this answer









          $endgroup$





















            0












            $begingroup$

            I don't think there will be a huge difference... although it will depend on how small you resize. The resizing is doing some kind of reduction and/or necessary interpolation (depending on the implementation you use).



            If you plan to use OpenCV, you can check out the description here.



            The benefit of normalisation after resizing would be that fewer operations would be performed (dividing fewer numbers by 255.0) - meaning slightly faster, but that difference is totally negligible. We both already spent more time talking about this topic than you will probably ever get back from that saving ;)



            Finally, you might want to just experiment: pick 5 images, try out both methods on all of them and plot them next to each other to see if there are any differing artefacts. You can also compute things like the mean and variance of the final pixel values of the images transformed one way versus images transformed the other way.






            share|improve this answer









            $endgroup$













              Your Answer





              StackExchange.ifUsing("editor", function () {
              return StackExchange.using("mathjaxEditing", function () {
              StackExchange.MarkdownEditor.creationCallbacks.add(function (editor, postfix) {
              StackExchange.mathjaxEditing.prepareWmdForMathJax(editor, postfix, [["$", "$"], ["\\(","\\)"]]);
              });
              });
              }, "mathjax-editing");

              StackExchange.ready(function() {
              var channelOptions = {
              tags: "".split(" "),
              id: "557"
              };
              initTagRenderer("".split(" "), "".split(" "), channelOptions);

              StackExchange.using("externalEditor", function() {
              // Have to fire editor after snippets, if snippets enabled
              if (StackExchange.settings.snippets.snippetsEnabled) {
              StackExchange.using("snippets", function() {
              createEditor();
              });
              }
              else {
              createEditor();
              }
              });

              function createEditor() {
              StackExchange.prepareEditor({
              heartbeatType: 'answer',
              autoActivateHeartbeat: false,
              convertImagesToLinks: false,
              noModals: true,
              showLowRepImageUploadWarning: true,
              reputationToPostImages: null,
              bindNavPrevention: true,
              postfix: "",
              imageUploader: {
              brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
              contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
              allowUrls: true
              },
              onDemand: true,
              discardSelector: ".discard-answer"
              ,immediatelyShowMarkdownHelp:true
              });


              }
              });














              draft saved

              draft discarded


















              StackExchange.ready(
              function () {
              StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fdatascience.stackexchange.com%2fquestions%2f44330%2fnormalization-before-or-after-resizing%23new-answer', 'question_page');
              }
              );

              Post as a guest















              Required, but never shown

























              2 Answers
              2






              active

              oldest

              votes








              2 Answers
              2






              active

              oldest

              votes









              active

              oldest

              votes






              active

              oldest

              votes









              1












              $begingroup$

              Resize and then normalize, that's the only pipeline that makes sense.



              If you resize after normalization, depending on the resize algorithm, you may end up with values that are outside of the normalized range.






              share|improve this answer









              $endgroup$


















                1












                $begingroup$

                Resize and then normalize, that's the only pipeline that makes sense.



                If you resize after normalization, depending on the resize algorithm, you may end up with values that are outside of the normalized range.






                share|improve this answer









                $endgroup$
















                  1












                  1








                  1





                  $begingroup$

                  Resize and then normalize, that's the only pipeline that makes sense.



                  If you resize after normalization, depending on the resize algorithm, you may end up with values that are outside of the normalized range.






                  share|improve this answer









                  $endgroup$



                  Resize and then normalize, that's the only pipeline that makes sense.



                  If you resize after normalization, depending on the resize algorithm, you may end up with values that are outside of the normalized range.







                  share|improve this answer












                  share|improve this answer



                  share|improve this answer










                  answered 1 hour ago









                  Matthieu BrucherMatthieu Brucher

                  61113




                  61113























                      0












                      $begingroup$

                      I don't think there will be a huge difference... although it will depend on how small you resize. The resizing is doing some kind of reduction and/or necessary interpolation (depending on the implementation you use).



                      If you plan to use OpenCV, you can check out the description here.



                      The benefit of normalisation after resizing would be that fewer operations would be performed (dividing fewer numbers by 255.0) - meaning slightly faster, but that difference is totally negligible. We both already spent more time talking about this topic than you will probably ever get back from that saving ;)



                      Finally, you might want to just experiment: pick 5 images, try out both methods on all of them and plot them next to each other to see if there are any differing artefacts. You can also compute things like the mean and variance of the final pixel values of the images transformed one way versus images transformed the other way.






                      share|improve this answer









                      $endgroup$


















                        0












                        $begingroup$

                        I don't think there will be a huge difference... although it will depend on how small you resize. The resizing is doing some kind of reduction and/or necessary interpolation (depending on the implementation you use).



                        If you plan to use OpenCV, you can check out the description here.



                        The benefit of normalisation after resizing would be that fewer operations would be performed (dividing fewer numbers by 255.0) - meaning slightly faster, but that difference is totally negligible. We both already spent more time talking about this topic than you will probably ever get back from that saving ;)



                        Finally, you might want to just experiment: pick 5 images, try out both methods on all of them and plot them next to each other to see if there are any differing artefacts. You can also compute things like the mean and variance of the final pixel values of the images transformed one way versus images transformed the other way.






                        share|improve this answer









                        $endgroup$
















                          0












                          0








                          0





                          $begingroup$

                          I don't think there will be a huge difference... although it will depend on how small you resize. The resizing is doing some kind of reduction and/or necessary interpolation (depending on the implementation you use).



                          If you plan to use OpenCV, you can check out the description here.



                          The benefit of normalisation after resizing would be that fewer operations would be performed (dividing fewer numbers by 255.0) - meaning slightly faster, but that difference is totally negligible. We both already spent more time talking about this topic than you will probably ever get back from that saving ;)



                          Finally, you might want to just experiment: pick 5 images, try out both methods on all of them and plot them next to each other to see if there are any differing artefacts. You can also compute things like the mean and variance of the final pixel values of the images transformed one way versus images transformed the other way.






                          share|improve this answer









                          $endgroup$



                          I don't think there will be a huge difference... although it will depend on how small you resize. The resizing is doing some kind of reduction and/or necessary interpolation (depending on the implementation you use).



                          If you plan to use OpenCV, you can check out the description here.



                          The benefit of normalisation after resizing would be that fewer operations would be performed (dividing fewer numbers by 255.0) - meaning slightly faster, but that difference is totally negligible. We both already spent more time talking about this topic than you will probably ever get back from that saving ;)



                          Finally, you might want to just experiment: pick 5 images, try out both methods on all of them and plot them next to each other to see if there are any differing artefacts. You can also compute things like the mean and variance of the final pixel values of the images transformed one way versus images transformed the other way.







                          share|improve this answer












                          share|improve this answer



                          share|improve this answer










                          answered 4 hours ago









                          n1k31t4n1k31t4

                          5,5422218




                          5,5422218






























                              draft saved

                              draft discarded




















































                              Thanks for contributing an answer to Data Science Stack Exchange!


                              • Please be sure to answer the question. Provide details and share your research!

                              But avoid



                              • Asking for help, clarification, or responding to other answers.

                              • Making statements based on opinion; back them up with references or personal experience.


                              Use MathJax to format equations. MathJax reference.


                              To learn more, see our tips on writing great answers.




                              draft saved


                              draft discarded














                              StackExchange.ready(
                              function () {
                              StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fdatascience.stackexchange.com%2fquestions%2f44330%2fnormalization-before-or-after-resizing%23new-answer', 'question_page');
                              }
                              );

                              Post as a guest















                              Required, but never shown





















































                              Required, but never shown














                              Required, but never shown












                              Required, but never shown







                              Required, but never shown

































                              Required, but never shown














                              Required, but never shown












                              Required, but never shown







                              Required, but never shown







                              Popular posts from this blog

                              How to label and detect the document text images

                              Vallis Paradisi

                              Tabula Rosettana