matthewearl / deep-anpr

Using neural networks to build an automatic number plate recognition system
MIT License
1.84k stars 698 forks source link

Error in training #52

Closed ab-si closed 7 years ago

ab-si commented 7 years ago

Hello,

I am following the README and try to train the model on different plate format other than described. I had changed the number of total characters from 7 to 10 as required by me. But when I do start the training, following error is shown:

Traceback (most recent call last): File "./train.py", line 238, in <module> initial_weights=initial_weights) File "./train.py", line 211, in train do_batch() File "./train.py", line 196, in do_batch do_report() File "./train.py", line 169, in do_report feed_dict={x: test_xs, y_: test_ys}) File "/usr/local/lib/python2.7/dist-packages/tensorflow/python/client/session.py", line 789, in run run_metadata_ptr) File "/usr/local/lib/python2.7/dist-packages/tensorflow/python/client/session.py", line 975, in _run % (np_val.shape, subfeed_t.name, str(subfeed_t.get_shape()))) ValueError: Cannot feed value of shape (50, 325) for Tensor u'Placeholder_1:0', which has shape '(?, 361)'

Also, I am trying to train the model with CPU only, is it possible to do so?

ab-si commented 7 years ago

Found the error, it was due to the incorrect length of characters from file name:

`def read_data(img_glob):

for fname in sorted(glob.glob(img_glob)):

    im = cv2.imread(fname)[:, :, 0].astype(numpy.float32) / 255.

    code = fname.split("/")[1][5:15]

    p = fname.split("/")[1][16] == '1'

    yield im, code_to_vec(p, code)`
chinmayips commented 7 years ago

Why is it 5:15 , and not starting from 0 , what is the format of the file name?? I am also trying this and getting this error. Traceback (most recent call last): File "C:\train.py", line 240, in initial_weights=initial_weights) File "C:\train.py", line 204, in train test_xs, test_ys = unzip(list(read_data("test\.png"))[:4]) File "C:\train.py", line 51, in unzip xs, ys = zip(b) ValueError: not enough values to unpack (expected 2, got 0)

Can u please help us with this?