alpr-unconstrained
alpr-unconstrained copied to clipboard
ctypes.ArgumentError: argument 1: <class 'TypeError'>: wrong type
File "/home/zhaolzlz/Desktop/alpr-unconstrained/darknet/python/darknet.py", line 127, in detect im = load_image(image, 0, 0) ctypes.ArgumentError: argument 1: <class 'TypeError'>: wrong type Excuse me, why is there a type error here
Usually a Python 3 issue with Darknet. Please use Python 2.7.
@azhaoaigaga
Actually there's an easy fix for that, check this https://github.com/pjreddie/darknet/issues/241#issuecomment-354640772
TL; DR; you have to change the strings passed to the darknet part to "bytes", so just add a b in front of strings when you directly define them, or explicitly convert them using the bytes function.
So for instance somewhere in the vehicle-detection.py script:
model_path = b'/path/to/model'
R,_ = detect(vehicle_net, vehicle_meta, bytes(img_path, encoding='utf-8'),
thresh=vehicle_threshold)