5

I spent my time almost 2 hrs to use the pre-trained model (tensorflow) from weights.npz for detecting license plate but I can't fix it. I got this error message, I've never seen before. so, how to fix it?

Traceback (most recent call last): File "./detect.py", line 189, in pt1 = tuple(reversed(map(int, pt1))) TypeError: 'map' object is not reversible

Chris_Rands
  • 38,994
  • 14
  • 83
  • 119
Morleng
  • 51
  • 4
  • 3
    This is clearly a python 2 module, the code for python 3 should be `pt1 = tuple(reversed(list(map(int, pt1))))`; `list`s after-all are definitely reverseible – Chris_Rands Feb 20 '18 at 16:53

2 Answers2

3

In python3, map returns an iterator, not list. You need to wrap the call to map() with the list constructor:

pt1 = tuple(reversed(list(map(int, pt1))))

See more: Getting a map() to return a list in Python 3.x

pault
  • 41,343
  • 15
  • 107
  • 149
1

Use a list comprehension or a generator expression instead

pt1 = tuple(int(x) for x in reversed(pt1))
Boris Verkhovskiy
  • 14,854
  • 11
  • 100
  • 103