Open kumartuhin opened 1 year ago
The error may be related to no license plates were found in the frame. The code should be edited in order to handle those cases.
The error may be related to no license plates were found in the frame. The code should be edited in order to handle those cases.
Thank you but can you please help me out reagrding this issue as i was following your youtube tutorial and it worked with the sample video provided but not applying on the video i provided.
Any one knows where is license_plate_detector.pt If anyone have pls send it.
Yes I am facing the same problem, I even made many changes in the util.py for the Indian license plate format, still the same error. I have even used a model trained with all Indian datasets of license plates.
Hello, @kumartuhin. I face the same problem when applying the idea to Egyptian vehicle license plates. I did some little changes on sort.py file, And it works fine. Here is the adjustment. `def iou_batch(bb_test, bb_gt): """ Calculate the Intersection over Union (IoU) for batches of bounding boxes.
Args:
bb_test (numpy.ndarray): Bounding boxes from predictions.
bb_gt (numpy.ndarray): Bounding boxes from ground truth.
Returns:
numpy.ndarray: IoU scores for each pair of bounding boxes.
"""
# Ensure both arrays have some elements
if bb_test.size == 0 or bb_gt.size == 0:
return np.array([])
# Add singleton dimensions
bb_gt = np.expand_dims(bb_gt, 0)
bb_test = np.expand_dims(bb_test, 1)
# Calculate IoU for batches
xx1 = np.maximum(bb_test[..., 0], bb_gt[..., 0])
yy1 = np.maximum(bb_test[..., 1], bb_gt[..., 1])
xx2 = np.minimum(bb_test[..., 2], bb_gt[..., 2])
yy2 = np.minimum(bb_test[..., 3], bb_gt[..., 3])
w = np.maximum(0., xx2 - xx1)
h = np.maximum(0., yy2 - yy1)
wh = w * h
o = wh / ((bb_test[..., 2] - bb_test[..., 0]) * (bb_test[..., 3] - bb_test[..., 1]) +
(bb_gt[..., 2] - bb_gt[..., 0]) * (bb_gt[..., 3] - bb_gt[..., 1]) - wh)
return o`
I was facing the same error but instead of (1,2) i got (1,3) I hope this could help.
I am facing an infinite loop. Did you experience it. I am using vscode
Any one knows where is license_plate_detector.pt If anyone have pls send it.
@Ashutosh7655 It is on patreon, so you will
Traceback (most recent call last): File "c:\automatic-number-plate-recognition-python-yolov8-main\main.py", line 39, in
track_ids = mottracker.update(np.asarray(detections))
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "c:\automatic-number-plate-recognition-python-yolov8-main\sort\sort.py", line 232, in update
matched, unmatched_dets, unmatched_trks = associate_detections_to_trackers(dets,trks, self.iou_threshold)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "c:\automatic-number-plate-recognition-python-yolov8-main\sort\sort.py", line 163, in associate_detections_to_trackers
iou_matrix = iou_batch(detections, trackers)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "c:\automatic-number-plate-recognition-python-yolov8-main\sort\sort.py", line 54, in iou_batch
xx1 = np.maximum(bb_test[..., 0], bb_gt[..., 0])
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
ValueError: operands could not be broadcast together with shapes (0,) (1,2)