Answers.Body: <p>When using convolutional neural networks for forgery detection, resizing images can indeed be problematic because crucial details, such as noise patterns, may get altered, which can impact the model’s performance. At the same time, cropping images into patches can result in losing important spatial information.</p>
  <p>One solution to this problem is to use letterboxing, a technique commonly used in object detection models like YOLO and SSD. With letterboxing, the image is resized while maintaining its aspect ratio by adding padding. This way, the image’s original details, including the noise, are preserved, and you avoid distortions or loss of spatial data. like some classification models like yolov8 also use letterboxing in their training and inferece of the yolov8 classification model</p>
  <p>However, you’ll need to ensure that the model doesn't falsely learn from the padded areas, possibly by using techniques like masking to ignore the padded regions during training.</p>
  <p>This approach should help maintain both the detailed features and spatial consistency of the images while feeding them into the neural network at a fixed input size.</p>
  
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2024-09-06T12:47:50.907Z
Answers.LastActivityDate: 2024-09-06T12:47:50.907Z
Answers.UserDisplayName: Keval Pandya
Answers.Body: <p>I don't think that the input size inconsistency won't leave out spatial information in the Convolutional Neural Network. The image resizing would loose the characteristics of the object on the image.</p>
  <p>It looks like that you don't want to crop your input image, which looks like being fabricated. I like to suggest these preprocessing before the Convolutional Neural Network:</p>
  <p>  (1) Find an original image or a picture of the real object<br />
    (2) Perform image registration between a suspicious image and the original image (the registration result should be fine)<br />
    (3) Calculate color difference in each pixel position<br />
    (4) Generate new image with these differences<br />
    (5) Feed to your Convolutional Neural Network for the anomaly detection</p>
  
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2021-07-02T22:06:07.400Z
Answers.LastActivityDate: 2021-07-02T22:06:07.400Z
Answers.UserDisplayName: Cloud Cho
Body: <p>I have the following problem while using convolutional neural networks to detect forgeries:</p>
  <p>Resizing the image to fit the required input size may not be a good way because the forgery detection largely relies on the details of images, for example, the noise. Thus the resizing process may change/hurt the details.</p>
  <p>Existing methods mainly use image patches (obtained from cropping) that have the same size. This way, however, will drop the spatial information.</p>
  <p>I'm looking for some suggestions on how to deal with this problem (input size inconsistency) without leaving out the spatial information.</p>
  
Comments.ContentLicense: CC BY-SA 4.0
Comments.CreationDate: 2019-11-20T11:04:05.320Z
Comments.Text: What exactly is the spatial information that you fear to lose? How would it be an input to the forgery detection? If I understood correctly, the detection depends mostly on local features, so cropping seems to be a valid step.
Comments.UserDisplayName: Hans-Martin Mosner
Comments.ContentLicense: CC BY-SA 4.0
Comments.CreationDate: 2021-06-30T19:21:01.503Z
Comments.Text: Would you share the average size of your image? Have you tried with large input tensor?
Comments.UserDisplayName: Cloud Cho
Tags: <convolutional-neural-networks><computer-vision><image-recognition><data-preprocessing>
Title: How to deal with images of different sizes, which need to be passed to a model of fixed input size, without losing details and spatial information?
UserDisplayName: Ivan Zhu
ThreadText: # How to deal with images of different sizes, which need to be passed to a model of fixed input size, without losing details and spatial information?
  
  (Asked by: username_0 on 2019-11-19)
  
  I have the following problem while using convolutional neural networks to detect forgeries:
  
  Resizing the image to fit the required input size may not be a good way because the forgery detection largely relies on the details of images, for example, the noise. Thus the resizing process may change/hurt the details.
  
  Existing methods mainly use image patches (obtained from cropping) that have the same size. This way, however, will drop the spatial information.
  
  I'm looking for some suggestions on how to deal with this problem (input size inconsistency) without leaving out the spatial information.
  
  **Tags:** convolutional-neural-networks, computer-vision, image-recognition, data-preprocessing
  
  > **Comments:**
  > **username_1**: What exactly is the spatial information that you fear to lose? How would it be an input to the forgery detection? If I understood correctly, the detection depends mostly on local features, so cropping seems to be a valid step.  
  > **username_2**: Would you share the average size of your image? Have you tried with large input tensor?  
  
  ---
  
  ## 2 answers
  
  ### Answer by username_3 on 2024-09-06. Score: 0
  
  When using convolutional neural networks for forgery detection, resizing images can indeed be problematic because crucial details, such as noise patterns, may get altered, which can impact the model’s performance. At the same time, cropping images into patches can result in losing important spatial information.
  
  One solution to this problem is to use letterboxing, a technique commonly used in object detection models like YOLO and SSD. With letterboxing, the image is resized while maintaining its aspect ratio by adding padding. This way, the image’s original details, including the noise, are preserved, and you avoid distortions or loss of spatial data. like some classification models like yolov8 also use letterboxing in their training and inferece of the yolov8 classification model
  
  However, you’ll need to ensure that the model doesn't falsely learn from the padded areas, possibly by using techniques like masking to ignore the padded regions during training.
  
  This approach should help maintain both the detailed features and spatial consistency of the images while feeding them into the neural network at a fixed input size.
  
  
  ---
  
  ### Answer by username_2 on 2021-07-02. Score: 0
  
  I don't think that the input size inconsistency won't leave out spatial information in the Convolutional Neural Network. The image resizing would loose the characteristics of the object on the image.
  
  It looks like that you don't want to crop your input image, which looks like being fabricated. I like to suggest these preprocessing before the Convolutional Neural Network:
  
    (1) Find an original image or a picture of the real object  
    (2) Perform image registration between a suspicious image and the original image (the registration result should be fine)  
    (3) Calculate color difference in each pixel position  
    (4) Generate new image with these differences  
    (5) Feed to your Convolutional Neural Network for the anomaly detection
  
  
  ---
  
  