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

Failing at small detection !! #13401

Open
1 task done
Manueljohnson063 opened this issue Nov 6, 2024 · 5 comments
Open
1 task done

Failing at small detection !! #13401

Manueljohnson063 opened this issue Nov 6, 2024 · 5 comments
Labels
detect Object Detection issues, PR's question Further information is requested

Comments

@Manueljohnson063
Copy link

Manueljohnson063 commented Nov 6, 2024

Search before asking

Question

Thank you for the great repository!

I’m currently working on a driver smoking detection project. I have trained my model with nearly 5,000 images; however, it mistakenly identifies light glare as a cigarette, due to the similarity in appearance. My model has only one class, labeled "cigarette." Could you suggest some modifications to improve its accuracy?@Glenn

Additional

No response

@Manueljohnson063 Manueljohnson063 added the question Further information is requested label Nov 6, 2024
@UltralyticsAssistant UltralyticsAssistant added the detect Object Detection issues, PR's label Nov 6, 2024
@UltralyticsAssistant
Copy link
Member

👋 Hello @Manueljohnson063, thank you for your interest in YOLOv5 🚀!

For improving the accuracy of your model, especially in distinguishing similar-looking objects, you might consider the following approaches:

  1. Dataset Enhancement: Increase your dataset, particularly with more examples of correctly and incorrectly identified objects. Ensuring a variety of lighting conditions and angles can help.

  2. Data Augmentation: Use techniques such as adding noise, adjusting brightness/contrast, and flipping images to enhance your training data.

  3. Hyperparameter Tuning: Experiment with different hyperparameters to see if they bring improvements in accuracy.

  4. Model Architecture: Try different model sizes or architectures within YOLOv5 to find the best fit for your task.

  5. Loss Functions: Modify loss functions to better penalize the misclassification errors specific to your problem.

If this is a 🐛 Bug Report, please provide a minimum reproducible example to help us debug it.

This is an automated response, and an Ultralytics engineer will also assist you soon. If you have further questions or need more detailed assistance, please feel free to reply with additional information, such as your dataset examples and training logs.

And don't miss out on the possibilities with the latest YOLOv8 🆕 for potentially enhanced performance in your project! Check out our docs for more info.

Happy experimenting 🔍!

@pderrenger
Copy link
Member

@Manueljohnson063 to improve accuracy, consider increasing your dataset size with more diverse images, using data augmentation to enhance variability, and adjusting the confidence threshold to reduce false positives. You might also try training with a higher resolution or using a larger model like YOLOv5x for better feature extraction.

@Manueljohnson063
Copy link
Author

Manueljohnson063 commented Nov 25, 2024

Hai ,I have a yolov5s model downloaded from opensource.when i try to export it i am facing error
``
python export.py --weights /home/vkchlt0616/Downloads/face_detection_yolov5s.pt --include onnx --opset=11 --imgsz 640 --batch-size 1
__export: data=data/coco128.yaml, weights=['/home/vkchlt0616/Downloads/face_detection_yolov5s.pt'], imgsz=[320], batch_size=1, device=cpu, half=False, inplace=False, keras=False, optimize=False, int8=False, per_tensor=False, dynamic=False, cache=, simplify=False, mlmodel=False, opset=11, verbose=False, workspace=4, nms=False, agnostic_nms=False, topk_per_class=100, topk_all=100, iou_thres=0.45, conf_thres=0.25, include=['onnx']
YOLOv5 🚀 v7.0-385-gb968b2d7 Python-3.8.19 torch-1.8.0 CPU

Fusing layers...
newYOLOv5s summary: 224 layers, 7053910 parameters, 0 gradients
Traceback (most recent call last):
File "export.py", line 1546, in
main(opt)
File "export.py", line 1541, in main
run(**vars(opt))
File "/home/vkchlt0616/.local/lib/python3.8/site-packages/torch/autograd/grad_mode.py", line 27, in decorate_context
return func(*args, **kwargs)
File "export.py", line 1407, in run
y = model(im) # dry runs
File "/home/vkchlt0616/.local/lib/python3.8/site-packages/torch/nn/modules/module.py", line 889, in _call_impl
result = self.forward(*input, **kwargs)
File "/home/vkchlt0616/DOMS/smokingDet/yolov5/models/yolo.py", line 270, in forward
return self._forward_once(x, profile, visualize) # single-scale inference, train
File "/home/vkchlt0616/DOMS/smokingDet/yolov5/models/yolo.py", line 169, in _forward_once
x = m(x) # run
File "/home/vkchlt0616/.local/lib/python3.8/site-packages/torch/nn/modules/module.py", line 889, in _call_impl
result = self.forward(*input, **kwargs)
File "/home/vkchlt0616/DOMS/smokingDet/yolov5/models/common.py", line 356, in forward
return self.conv(torch.cat((x[..., ::2, ::2], x[..., 1::2, ::2], x[..., ::2, 1::2], x[..., 1::2, 1::2]), 1))
File "/home/vkchlt0616/.local/lib/python3.8/site-packages/torch/nn/modules/module.py", line 889, in _call_impl
result = self.forward(*input, **kwargs)
File "/home/vkchlt0616/DOMS/smokingDet/yolov5/models/common.py", line 91, in forward_fuse
return self.act(self.conv(x))
File "/home/vkchlt0616/.local/lib/python3.8/site-packages/torch/nn/modules/module.py", line 889, in _call_impl
result = self.forward(*input, **kwargs)
File "/home/vkchlt0616/.local/lib/python3.8/site-packages/torch/nn/modules/conv.py", line 399, in forward
return self.conv_forward(input, self.weight, self.bias)
File "/home/vkchlt0616/.local/lib/python3.8/site-packages/torch/nn/modules/conv.py", line 395, in conv_forward
return F.conv2d(input, weight, bias, self.stride,
RuntimeError: Given groups=1, weight of size [32, 12, 3, 3], expected input[1, 48, 160, 160] to have 12 channels, but got 48 channels instead

@glenn-jocher

But the model is detecting face properly from web cam .The issue only come during exporting to onnx.Please give me the suggestion....

@Manueljohnson063
Copy link
Author

Hi ,
Any hyperparameter i want to really focus to improve the detection using Yolov5s .
TIA
@pderrenger

@pderrenger
Copy link
Member

Hi @Manueljohnson063, to improve detection with YOLOv5s, focus on tuning image size (--img-size) for better resolution if objects are small, using the largest batch size (--batch-size) your hardware allows, and experimenting with hyperparameters in data/hyps/hyp.scratch-low.yaml. Additionally, ensure your dataset is diverse and well-labeled. For more details, refer to the training tips guide.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
detect Object Detection issues, PR's question Further information is requested
Projects
None yet
Development

No branches or pull requests

3 participants