ultralytics / yolov5

YOLOv5 πŸš€ in PyTorch > ONNX > CoreML > TFLite
https://docs.ultralytics.com
GNU Affero General Public License v3.0
50.64k stars 16.32k forks source link

Large image small object. #4521

Closed Kickjaw closed 3 years ago

Kickjaw commented 3 years ago

❔Question

Hello,

I have fairly large images that have hundreds of small objects on them. The base image is 5792 x 8688 and the objects I want to detect are around 43 x 43. I have thought about tiling the whole thing and training that way but I don't know how to do an accurate count afterwards. I am looking for some direction on what I should do to proceed.

Additional context

github-actions[bot] commented 3 years ago

πŸ‘‹ Hello @Kickjaw, thank you for your interest in YOLOv5 πŸš€! Please visit our ⭐️ Tutorials to get started, where you can find quickstart guides for simple tasks like Custom Data Training all the way to advanced concepts like Hyperparameter Evolution.

If this is a πŸ› Bug Report, please provide screenshots and minimum viable code to reproduce your issue, otherwise we can not help you.

If this is a custom training ❓ Question, please provide as much information as possible, including dataset images, training logs, screenshots, and a public link to online W&B logging if available.

For business inquiries or professional support requests please visit https://ultralytics.com or email Glenn Jocher at glenn.jocher@ultralytics.com.

Requirements

Python>=3.6.0 with all requirements.txt installed including PyTorch>=1.7. To get started:

$ git clone https://github.com/ultralytics/yolov5
$ cd yolov5
$ pip install -r requirements.txt

Environments

YOLOv5 may be run in any of the following up-to-date verified environments (with all dependencies including CUDA/CUDNN, Python and PyTorch preinstalled):

Status

CI CPU testing

If this badge is green, all YOLOv5 GitHub Actions Continuous Integration (CI) tests are currently passing. CI tests verify correct operation of YOLOv5 training (train.py), validation (val.py), inference (detect.py) and export (export.py) on MacOS, Windows, and Ubuntu every 24 hours and on every commit.

glenn-jocher commented 3 years ago

@Kickjaw πŸ‘‹ Hello! Thanks for asking about improving YOLOv5 πŸš€ training results.

Most of the time good results can be obtained with no changes to the models or training settings, provided your dataset is sufficiently large and well labelled. If at first you don't get good results, there are steps you might be able to take to improve, but we always recommend users first train with all default settings before considering any changes. This helps establish a performance baseline and spot areas for improvement.

If you have questions about your training results we recommend you provide the maximum amount of information possible if you expect a helpful response, including results plots (train losses, val losses, P, R, mAP), PR curve, confusion matrix, training mosaics, test results and dataset statistics images such as labels.png. All of these are located in your project/name directory, typically yolov5/runs/train/exp.

We've put together a full guide for users looking to get the best results on their YOLOv5 trainings below.

Dataset

COCO Analysis

Model Selection

Larger models like YOLOv5x and YOLOv5x6 will produce better results in nearly all cases, but have more parameters, require more CUDA memory to train, and are slower to run. For mobile deployments we recommend YOLOv5s/m, for cloud deployments we recommend YOLOv5l/x. See our README table for a full comparison of all models.

YOLOv5 Models

Training Settings

Before modifying anything, first train with default settings to establish a performance baseline. A full list of train.py settings can be found in the train.py argparser.

Further Reading

If you'd like to know more a good place to start is Karpathy's 'Recipe for Training Neural Networks', which has great ideas for training that apply broadly across all ML domains: http://karpathy.github.io/2019/04/25/recipe/

hadign20 commented 2 years ago

@glenn-jocher I am training Yolov5 on xView dataset with default settings. It seems the precision is going up, but the recall value is very low because of the large number of false negatives (mostly from missed vehicles since they are very small). These are the results at about 80 epochs (out of 300):

precision

WeChat Screenshot_20220207112301

recall

WeChat Screenshot_20220207112341

Have you tried the default settings with xView? Do you think the mAP will improve after more iterations or should I change some of the parameters?

Thank you.

glenn-jocher commented 2 years ago

@hadi-ghnd P and R are irrelevant as they are a function of confidence threshold. You can send any to 1.0 whenever you want just by setting an appropriate confidence.

hadign20 commented 2 years ago

@glenn-jocher I tried with lower confidence in calling detect.py. It gives more detections but it also gives multiple bounding boxes for some objects. Is it possible to avoid this?

glenn-jocher commented 2 years ago

@hadi-ghnd πŸ‘‹ Hello! Thanks for asking about improving YOLOv5 πŸš€ training results.

Most of the time good results can be obtained with no changes to the models or training settings, provided your dataset is sufficiently large and well labelled. If at first you don't get good results, there are steps you might be able to take to improve, but we always recommend users first train with all default settings before considering any changes. This helps establish a performance baseline and spot areas for improvement.

If you have questions about your training results we recommend you provide the maximum amount of information possible if you expect a helpful response, including results plots (train losses, val losses, P, R, mAP), PR curve, confusion matrix, training mosaics, test results and dataset statistics images such as labels.png. All of these are located in your project/name directory, typically yolov5/runs/train/exp.

We've put together a full guide for users looking to get the best results on their YOLOv5 trainings below.

Dataset

COCO Analysis

Model Selection

Larger models like YOLOv5x and YOLOv5x6 will produce better results in nearly all cases, but have more parameters, require more CUDA memory to train, and are slower to run. For mobile deployments we recommend YOLOv5s/m, for cloud deployments we recommend YOLOv5l/x. See our README table for a full comparison of all models.

YOLOv5 Models

Training Settings

Before modifying anything, first train with default settings to establish a performance baseline. A full list of train.py settings can be found in the train.py argparser.

Further Reading

If you'd like to know more a good place to start is Karpathy's 'Recipe for Training Neural Networks', which has great ideas for training that apply broadly across all ML domains: http://karpathy.github.io/2019/04/25/recipe/

Good luck πŸ€ and let us know if you have any other questions!

glenn-jocher commented 2 years ago

@hadi-ghnd see https://github.com/ultralytics/yolov3/issues/898 for a better understanding of mAP vs P, R

image

muntakim1 commented 1 year ago

@glenn-jocher For cloud VMS with 4cores without GPU, which model you will suggest?

glenn-jocher commented 1 year ago

@muntakim1 if you are running inference on CPU you want the fastest models because your inference will be very slow, either YOLOv5n or YOLOv5s