Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

low precision #13098

Closed
1 task done
mamdouhhz opened this issue Jun 17, 2024 · 1 comment
Closed
1 task done

low precision #13098

mamdouhhz opened this issue Jun 17, 2024 · 1 comment
Labels
question Further information is requested

Comments

@mamdouhhz
Copy link

mamdouhhz commented Jun 17, 2024

Search before asking

Question

i am using yolov5 on mydataset which is panoramic dental xrays. the goal is to detect the infected tooth and produce 3 labels for it: quadrant number, tooth number and the disease. a tooth my have more then 1 disease. so as a work around to achieve multi label object detection i split each label for a single tooth into separate line which looks like this:

000013 0.6431219110378913 0.45246010638297873 0.0671334431630972 0.2293882978723404
009 0.6431219110378913 0.45246010638297873 0.0671334431630972 0.2293882978723404
5 0.6431219110378913 0.45246010638297873 0.0671334431630972 0.2293882978723404

those are the quadrant number, tooth number and the disease for 1 tooth.

i have a total of 704 images for training and validation. 70% - 30%

all image sizes are not the same size and they are large. the highest precision i achieved when training yolov5m was 0.6. how can i achieve a 0.95 precision ? and what could be the issues that caused such low precision and how can i see the accuracy ? I aslo tried yolov5l and there was no difference. I trained for 300 epochs

Additional

No response

@mamdouhhz mamdouhhz added the question Further information is requested label Jun 17, 2024
@glenn-jocher
Copy link
Member

Hello,

Thank you for reaching out and providing detailed information about your dataset and training setup. Achieving high precision in object detection tasks can be challenging, especially with a specialized dataset like panoramic dental X-rays. Here are some steps and considerations to help improve your results:

Dataset and Labeling

  1. Dataset Size and Quality:

    • Images per class: Ensure you have at least 1500 images per class and 10,000 instances per class. With only 704 images, your dataset might be too small to achieve high precision.
    • Label Consistency and Accuracy: Verify that all instances are correctly labeled and that the bounding boxes closely enclose each object. Partial or inaccurate labeling can significantly impact performance.
  2. Image Variety: Ensure your dataset includes a variety of images representing different conditions (e.g., different lighting, angles, and sources).

  3. Background Images: Consider adding background images (images with no objects) to reduce false positives.

Model and Training

  1. Model Selection: While YOLOv5m and YOLOv5l are good choices, larger models like YOLOv5x might yield better results if your hardware can handle the increased computational load.

  2. Pretrained Weights: Start with pretrained weights, especially if your dataset is small. This can help the model converge faster and achieve better performance.

    python train.py --data custom.yaml --weights yolov5m.pt
  3. Training Settings:

    • Epochs: You trained for 300 epochs, which is a good start. If overfitting is not an issue, consider training for more epochs (e.g., 600 or 1200).
    • Image Size: Train at a higher resolution if your images contain small objects. For example, use --img 1280.
    • Batch Size: Use the largest batch size your hardware allows to improve batch normalization statistics.
  4. Hyperparameters: Start with default hyperparameters and consider using hyperparameter evolution to find the optimal settings for your dataset.

Monitoring and Evaluation

  1. Results Plots: Check the training and validation loss plots, precision-recall curves, and confusion matrix to understand where the model might be struggling.
  2. Accuracy Metrics: Precision is just one metric. Also, monitor recall and mAP (mean Average Precision) to get a comprehensive view of your model's performance.

Example Command

Here’s an example command to train with some of the suggested settings:

python train.py --data custom.yaml --weights yolov5m.pt --img 1280 --batch-size 16 --epochs 600

Further Reading

For more detailed tips and best practices, please refer to our Tips for Best Training Results guide.

If you continue to experience issues, please ensure you are using the latest versions of torch and YOLOv5. If the problem persists, providing a minimum reproducible example will help us investigate further. You can find more information on creating a reproducible example here.

Best of luck with your training! If you have any further questions, feel free to ask.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question Further information is requested
Projects
None yet
Development

No branches or pull requests

2 participants