Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error when -labelmap labels.txt is added #28

Open
geeuk opened this issue Dec 8, 2021 · 1 comment
Open

Error when -labelmap labels.txt is added #28

geeuk opened this issue Dec 8, 2021 · 1 comment

Comments

@geeuk
Copy link

geeuk commented Dec 8, 2021

(venv) root@raspberrypi:/home/pi/ped-net/model# umt -video highway_01.mp4 -modelpath pednet_20200517.tflite -labelmap labels.txt

INITIALIZING UMT...
THRESHOLD: 0.5
CUSTOM LABEL MAP = TRUE (labels.txt)
TPU = FALSE
CUSTOM DETECTOR = TRUE
> DETECTOR PATH = pednet_20200517.tflite

TRACKING...
FRAME: 0
Traceback (most recent call last):
File "/home/pi/venv/bin/umt", line 8, in
sys.exit(main())
File "/home/pi/venv/lib/python3.7/site-packages/umt/umt_main.py", line 106, in main
class_name = labels[track.class_name]
KeyError: 3

without it:

(venv) root@raspberrypi:/home/pi/ped-net/model# umt -video highway_01.mp4 -modelpath pednet_20200517.tflite -labelmap labels.txt

INITIALIZING UMT...
THRESHOLD: 0.5
CUSTOM LABEL MAP = TRUE (labels.txt)
TPU = FALSE
CUSTOM DETECTOR = TRUE
> DETECTOR PATH = pednet_20200517.tflite

TRACKING...
FRAME: 0
Traceback (most recent call last):
File "/home/pi/venv/bin/umt", line 8, in
sys.exit(main())
File "/home/pi/venv/lib/python3.7/site-packages/umt/umt_main.py", line 106, in main
class_name = labels[track.class_name]
KeyError: 3
(venv) root@raspberrypi:/home/pi/ped-net/model# umt -video highway_01.mp4 -modelpath pednet_20200517.tflite
INITIALIZING UMT...
THRESHOLD: 0.5
CUSTOM LABEL MAP = FALSE
TPU = FALSE
CUSTOM DETECTOR = TRUE
> DETECTOR PATH = pednet_20200517.tflite

TRACKING...
FRAME: 0
FRAME: 1
FRAME: 2
FRAME: 3
FRAME: 4
FRAME: 5
FRAME: 6
FRAME: 7
FRAME: 8
FRAME: 9
(venv) root@raspberrypi:/home/pi/ped-net/model#

@jcothran
Copy link

I believe the model file has 4 classes (0-3) but the label text file only has 3 classes. I got around this error by adding 'scooter' as the 4th class in the label file. This labeled all the cars as scooters so labels list maybe should be as below with vehicle as 4th class:

1 bike
2 pedestrian
3 scooter
4 vehicle

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
2 participants