ultralytics / yolov5

YOLOv5 🚀 in PyTorch > ONNX > CoreML > TFLite
https://docs.ultralytics.com
GNU Affero General Public License v3.0
50.58k stars 16.31k forks source link

Did yolov5 do pre processing before doing validation? #12034

Closed VYRION-Ai closed 1 year ago

VYRION-Ai commented 1 year ago

Search before asking

Question

Did yolov5 do pre processing before doing validation, i want to do validation out side yolov5 repo but it gives me always less accuracy than using val.py

i do detection and get boxes and accuracy , i use the (iou and conf and resize) , what i miss , is there any pre processing that i should do that gives me better accuracy

Additional

No response

glenn-jocher commented 1 year ago

@VYRION-Ai yOLOv5 does perform pre-processing before doing validation. It applies several transformations to the input images, including resizing, normalization, and data augmentation techniques such as random crops and flips. These pre-processing steps help improve accuracy during validation.

If you want to perform validation outside the YOLOv5 repo and achieve similar accuracy results, it is important to ensure that you apply the same pre-processing steps as the ones used in val.py. This includes using the same resizing, normalization, and data augmentation techniques. By maintaining consistency in the pre-processing steps, you should be able to achieve comparable accuracy results.

If you have any further questions or need additional assistance, feel free to ask.

VYRION-Ai commented 1 year ago

@glenn-jocher are this all pre-processing

resizing normalization data augmentation (random crops and flips.) only that?

glenn-jocher commented 1 year ago

@VYRION-Ai yes, those are the main pre-processing steps performed by YOLOv5 during training and validation. Resizing ensures that all input images have the same dimensions, which is necessary for efficient model inference. Normalization is applied to bring the pixel values within a standardized range, typically between 0 and 1 or -1 and 1. Data augmentation, including random crops and flips, is used to increase the diversity of the training data and improve the model's ability to generalize to unseen examples.

It's worth noting that YOLOv5 also includes other optional pre-processing steps, such as mosaic augmentation, which combines multiple images into a single training example. However, the steps you mentioned - resizing, normalization, and data augmentation - are the core pre-processing techniques commonly used in YOLOv5.

Please let me know if you have any further questions!

VYRION-Ai commented 1 year ago

@glenn-jocher sorry , but these pre-processing is doing while training . i already finished training , i just do validation on testing folder , are pre-processing still happened?

glenn-jocher commented 1 year ago

@VYRION-Ai yes, the pre-processing steps (resizing, normalization, data augmentation) are also applied during validation in YOLOv5. These steps are crucial for ensuring consistent and accurate results during inference, regardless of whether it is training or validation.

By applying the same pre-processing techniques during validation as during training, you can ensure that the input data is transformed in the same way, leading to comparable accuracy results.

If you have any more questions or need further assistance, feel free to ask.

VYRION-Ai commented 1 year ago

@glenn-jocher thank you

glenn-jocher commented 1 year ago

@VYRION-Ai Thank you for your question. In YOLOv5, pre-processing steps such as resizing, normalization, and data augmentation (random crops and flips) are indeed performed during both training and validation. These steps are important for consistency and accuracy in the inference phase.

To achieve similar accuracy when performing validation outside the YOLOv5 repo, it is essential to apply the same pre-processing steps as used in the val.py script. Ensure you use the same resizing, normalization, and data augmentation techniques for comparable results.

Let me know if there is anything else I can assist you with.