matthewearl / deep-anpr

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

IndexError: list index out of range in train.py #81

Open sauman07 opened 6 years ago

sauman07 commented 6 years ago

I'm getting this error while running train.py file.

File "C:/Users/SaumanBalkhi/Desktop/FYP/Deep ANPR/train.py", line 261, in initial_weights=initial_weights)

File "C:/Users/SaumanBalkhi/Desktop/FYP/Deep ANPR/train.py", line 234, in train do_batch()

File "C:/Users/SaumanBalkhi/Desktop/FYP/Deep ANPR/train.py", line 219, in do_batch do_report()

File "C:/Users/SaumanBalkhi/Desktop/FYP/Deep ANPR/train.py", line 204, in do_report print ("B{:3d} {:2.02f}% {:02.02f}% loss: {} "

AttributeError: 'NoneType' object has no attribute 'format'

Aquamars commented 6 years ago

You need change line 204. like this:

    print("B{:3d} {:2.02f}% {:02.02f}% loss: {} (digits: {}, presence: {}) |{}|".format(batch_idx, 100. * num_correct / (len(r[0])), 100. * num_p_correct / len(r[2]), r[6], r[4], r[5],  "".join("X "[numpy.array_equal(b, c) or (not pb and not pc)] for b, c, pb, pc in zip(*r_short))))