ria-com / nomeroff-net

Nomeroff Net. Automatic numberplate recognition system.
GNU General Public License v3.0
459 stars 159 forks source link

Not enough values to unpack #226

Closed Dmytro-Shvetsov closed 2 years ago

Dmytro-Shvetsov commented 2 years ago

Running the number_plate_detection_and_reading pipeline on images without license plates throws an exception.

Could you help how this can be fixed?

import cv2
import numpy as np

import os
from nomeroff_net import pipeline
from nomeroff_net.tools import unzip

number_plate_detection_and_reading = pipeline("number_plate_detection_and_reading", image_loader=None)

img = cv2.imread('./nomeroff_net/data/examples/oneline_images/example1.jpeg')
img = cv2.cvtColor(img, cv2.COLOR_BGR2RGB)
img[400:800] = 0 # zero out license plate

print(img.dtype) # uint8
print(img.shape) # (920, 1227, 3)
result = number_plate_detection_and_reading([img]) # throws error

Error itself

/workspace/nomeroff_net/nomeroff_net/pipelines/number_plate_detection_and_reading.py in forward_detection_np(self, inputs, **forward_parameters)
     83             predicted = [-1 for _ in zones]
     84         else:
---> 85             (region_ids, region_names, count_lines,
     86              confidences, predicted) = unzip(self.number_plate_classification(zones, **forward_parameters))
     87         return (region_ids, region_names, count_lines, confidences,

ValueError: not enough values to unpack (expected 5, got 0)