Closed EKebriaei closed 2 years ago
👋 Hello @EKebriaei, 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 support@ultralytics.com.
Python>=3.7.0 with all requirements.txt installed including PyTorch>=1.7. To get started:
git clone https://github.com/ultralytics/yolov5 # clone
cd yolov5
pip install -r requirements.txt # install
YOLOv5 may be run in any of the following up-to-date verified environments (with all dependencies including CUDA/CUDNN, Python and PyTorch preinstalled):
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.
@EKebriaei the second stage classifier in detect.py must have the same exact classes as the detection model, it filters every detection through the classifier to reduce FPs.
@glenn-jocher Thanks for the quick response. Actually I trained a YOLOv5 model to detect license plate (one class) and another YOLO5 model to detect character from license (28 classes). I wanted to do plate detection and character detection in an end-to-end manner. Is that apply_classifier method works for here? Or should I train a model to detect both of them in a single training task. Plate detection dataset contains car images and location of plate in those images. Character detection dataset contains plate images and location of each character inside those images. Being real time as well as high accuracy is important to me. I would be thankful if anyone can help me.
👋 Hello, this issue has been automatically marked as stale because it has not had recent activity. Please note it will be closed if no further activity occurs.
Access additional YOLOv5 🚀 resources:
Access additional Ultralytics ⚡ resources:
Feel free to inform us of any other issues you discover or feature requests that come to mind in the future. Pull Requests (PRs) are also always welcomed!
Thank you for your contributions to YOLOv5 🚀 and Vision AI ⭐!
@EKebriaei Great to hear about your project! For an end-to-end solution with high accuracy and real-time performance, training a single YOLOv5 model to detect both the license plate and characters in a single task would be the most efficient approach. This way, the model can detect both the plate and characters simultaneously in a single inference step, providing faster and more streamlined results. You can combine the datasets and have the model learn to detect both objects and characters simultaneously. Let me know if you have any further questions or need assistance with the combined training process!
I would like to ask if the two-stage target recognition problem mentioned above has been resolved. I have encountered difficulties in coding.
error:
Fusing layers...
YOLOv5m summary: 212 layers, 20901426 parameters, 0 gradients, 48.0 GFLOPs
<class 'models.yolo.DetectionModel'>
Traceback (most recent call last):
File "/home/featurize/work/yolov5-7.0(s car)/detect.py", line 280, in
Hey there! It seems like you're getting an AttributeError
because output
is a list and doesn't have the argmax
method. This typically occurs if the model's output structure doesn't match what the apply_classifier
function expects. To resolve this, ensure that output
is a PyTorch tensor before you attempt to call .argmax(1)
on it. If output
is indeed intended to be a tensor but is somehow a list, look into how output
is generated within your classifier model's forward pass. A quick workaround, if output
is a list of tensors (one tensor per image), you might need to concatenate them along the correct axis before calling .argmax(1)
. Here's an example:
if isinstance(output, list):
output = torch.cat(output, dim=0)
pred_cls2 = output.argmax(1)
Please let me know if this helps or if you're facing any other issues! 😊
Search before asking
Question
Hi guys. I trained two different models. The first for plate detection (number of classes: 1) and the second for character detection (number of classes: 28). I use apply_classifier method for second stage classifier. I changed the detect.py line 129 to:
I get the following error:
Additional
This is the apply classifier method: