Answers.Body: <p>Since you are using YOLO, the YOLO models have functionality to handle different sizes of images. YOLO models accept image sizes that are multiples of the stride, such as 640, 480, 320, etc. To handle such image sizes, YOLO models (and most current object detection models) use a method called letterboxing, which adds extra padding to images.</p>
  <p>Adding extra padding to the image is not recommended if you are going to use YOLO. If you resize your image to 320 by scaling, it may sometimes blur or distort the object, causing false detections. I recommend you train the YOLO model with an image size of 320 and provide the original images. YOLOv8 and later versions can automatically handle small image sizes.</p>
  <p>If the base Nano model fails to achieve better accuracy, try the Small or Medium models if you don't have resource or time constraints. Additionally, there are variants of YOLOv8, such as YOLOv8-P2 or YOLOv8-P6. For reference, you can follow this conversation on GitHub for small object detection.</p>
  <p>Conversion link :- <a href="https://github.com/ultralytics/ultralytics/issues/6829" rel="nofollow noreferrer">https://github.com/ultralytics/ultralytics/issues/6829</a></p>
  
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2024-12-15T17:22:34.200Z
Answers.LastActivityDate: 2024-12-15T17:22:34.200Z
Answers.UserDisplayName: Keval Pandya
Body: <p>I'm trying to train an object detection algorithm with a training and inference size of 360px X 360px while my dataset of images is 120px X 120px. The algorithm has only one class.</p>
  <p>The inference is done on similar images than the dataset without any scaling. The object to detect is usually around 10px by 10px and it's true both in the dataset and in the inference image.</p>
  <p><a href="https://i.sstatic.net/0bMuBOHC.png" rel="nofollow noreferrer"><img src="https://i.sstatic.net/0bMuBOHC.png" alt="Dataset smaller than training and inference" /></a></p>
  <p>The dataset has a very large variety. Yolo gives excellent result if dataset, training and inference are the same size.</p>
  <p>What's the best strategy to train if possible without scaling the dataset? Because if the dataset is scaled, the learning happens on 3 times the size of the object - this is not optimal.</p>
  <p>An idea is to randomize the position of each dataset 120px X 120px image in a black/white/noise 360px X 360px training frame?</p>
  <p>I'm not bound to Yolo but it has an interesting resize factor property which is applied randomly. Nevertheless, this property factors the fact that the object can slightly vary in size in the inference image.</p>
  <p>Alternatively, is there a better algorithm or strategy to fix such situation? If we compare to our brain, the detection of an object doesn't really depend of what is present far from the object.</p>
  
Tags: <training><object-detection><yolo><inference>
Title: AI Detection: how to deal with training dataset smaller than inference preferably without scaling?
UserDisplayName: gregoiregentil
ThreadText: # AI Detection: how to deal with training dataset smaller than inference preferably without scaling?
  
  (Asked by: username_0 on 2024-12-14)
  
  I'm trying to train an object detection algorithm with a training and inference size of 360px X 360px while my dataset of images is 120px X 120px. The algorithm has only one class.
  
  The inference is done on similar images than the dataset without any scaling. The object to detect is usually around 10px by 10px and it's true both in the dataset and in the inference image.
  
  [![Dataset smaller than training and inference](https://i.sstatic.net/0bMuBOHC.png)](https://i.sstatic.net/0bMuBOHC.png)
  
  The dataset has a very large variety. Yolo gives excellent result if dataset, training and inference are the same size.
  
  What's the best strategy to train if possible without scaling the dataset? Because if the dataset is scaled, the learning happens on 3 times the size of the object - this is not optimal.
  
  An idea is to randomize the position of each dataset 120px X 120px image in a black/white/noise 360px X 360px training frame?
  
  I'm not bound to Yolo but it has an interesting resize factor property which is applied randomly. Nevertheless, this property factors the fact that the object can slightly vary in size in the inference image.
  
  Alternatively, is there a better algorithm or strategy to fix such situation? If we compare to our brain, the detection of an object doesn't really depend of what is present far from the object.
  
  **Tags:** training, object-detection, yolo, inference
  
  ---
  
  ## 1 answers
  
  ### Answer by username_1 on 2024-12-15. Score: 0
  
  Since you are using YOLO, the YOLO models have functionality to handle different sizes of images. YOLO models accept image sizes that are multiples of the stride, such as 640, 480, 320, etc. To handle such image sizes, YOLO models (and most current object detection models) use a method called letterboxing, which adds extra padding to images.
  
  Adding extra padding to the image is not recommended if you are going to use YOLO. If you resize your image to 320 by scaling, it may sometimes blur or distort the object, causing false detections. I recommend you train the YOLO model with an image size of 320 and provide the original images. YOLOv8 and later versions can automatically handle small image sizes.
  
  If the base Nano model fails to achieve better accuracy, try the Small or Medium models if you don't have resource or time constraints. Additionally, there are variants of YOLOv8, such as YOLOv8-P2 or YOLOv8-P6. For reference, you can follow this conversation on GitHub for small object detection.
  
  Conversion link :- <https://github.com/ultralytics/ultralytics/issues/6829>
  
  
  ---
  
  