saswat0 / License-Plate-Recognition

Detection of license plate and recognising the registration number
Other
23 stars 12 forks source link

Error when testing different image #9

Closed kstar1996 closed 2 years ago

kstar1996 commented 2 years ago

UnboundLocalError: local variable 'plate' referenced before assignment this error comes up when testing with a different image.

saswat0 commented 2 years ago

Hi @kstar1996 Could you please share with me the code that you're trying? It seems like a referencing issue which should be pretty straightforward to deal with

kstar1996 commented 2 years ago

Just demo.py! I haven't changed anything. I was just trying it out and it works for some images(including test.jpeg which you provided), but for some images it gives me that error above.

To be exact, it says this. Traceback (most recent call last): File "/Users/eujin/Downloads/License-Plate-Recognition-master/demo.py", line 12, in plate_img, plate = extract_plate(original_image) File "/Users/eujin/Downloads/License-Plate-Recognition-master/license_plate_extraction.py", line 19, in extract_plate return plate_img, plate # returning the processed image. UnboundLocalError: local variable 'plate' referenced before assignment

saswat0 commented 2 years ago

@kstar1996 Can you please share with me the image you're trying to test? I think the cascade classifier isn't able to detect any licence plates in the image

kstar1996 commented 2 years ago

Yeah sure.

car2

This is one of the images! I think the problem is what you said.

I have another question related to something else. 'bash download.sh' doesn't work.

So I went here http://sergiomsilva.com/pubs/alpr-unconstrained/ and downloaded the weights and descriptor for WPOD-NET and OCR-NET

but the license-plate-ocr.py requires also two other files called "ocr-net.data" and "ocr-net.names". also the vehicle-detector weights yolo-voc.weights and configurations yolo-voc.cfg files are needed.

Do you maybe have the files that are needed? I think it is not public anymore!

saswat0 commented 2 years ago

This meta file is generated purely for Indian license plates. It might not recognise the characters that are present in your image's plate

You can download yolo-voc files from the official darknet website instead. I'm not sure if I'd have ocr.data and ocr.names files but if I get them, I'll let you know

The author's site seems to be down intermittently. You can probably try some time later

kstar1996 commented 2 years ago

Thanks!