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

AssertionError: labels.txt and *.cfg indicate inconsistent class numbers & ERROR - Invalid argument: --verbalise=True #295

Closed
anonym24 opened this issue Jun 21, 2017 · 5 comments

Comments

@anonym24
Copy link

anonym24 commented Jun 21, 2017

Cannot convert weights/cfg to pb model

./flow --model tiny-yolo-voc-original.cfg --load tiny-yolo-voc.weights --savepb
...
AssertionError: labels.txt and tiny-yolo-voc-original.cfg indicate inconsistent class numbers

this https://github.com/tensorflow/tensorflow/blob/master/tensorflow/examples/android/src/org/tensorflow/demo/DetectorActivity.java#L69
also doesn't work:

./flow --model tiny-yolo-voc-original.cfg --load tiny-yolo-voc.weights --savepb --verbalise=True

ERROR - Invalid argument: --verbalise=True
@abagshaw
Copy link
Collaborator

abagshaw commented Jun 21, 2017

In regard to your first problem, when darkflow sees one of the default .cfg names it will load the labels from it's own array (or external file in the case of the COCO dataset) - i.e. when it sees a recognized .cfg it will ignore what is set in labels.txt. You can see what the recognized .cfg names are here. In your case you are using an unrecognized .cfg name tiny-yolo-voc-original.cfg which is not in that array. Thus darkflow will try to load the labels from labels.txt and in your case it is finding the wrong number of labels. If you are trying to load the VOC labels, either rename your .cfg file to tiny-yolo-voc.cfg so that it's recognized and darkflow automatically loads from the VOC labels or manually copy the VOC labels into labels.txt.

In regard to your second problem, I wrote a custom CLI handler for darkflow and assigning values using = is currently not supported. To set --verbalise to true either simply use --verbalise on its own or use --verbalise true.

@anonym24
Copy link
Author

anonym24 commented Jun 21, 2017

Got it. I also tried to convert my own trained tiny yolo with 1 classes and I couldn't (even if I edited labels.txt and put only one name) because as you said if cfg is named as tiny-yolo-voc.cfg then darkflow searches from it's own array. I renamed it in something else and it worked.

Thanks!

@wingerboy
Copy link

Hello, I am currently training one class, but the load of the yolo-small.weights file does not load during the training.
this is my command:yolo-me-small.cfg --load bin/yolo-small.weights --train --annotation CAR/Annotations --dataset CAR/JPEGImages

error:
Parsing ./cfg/yolo-qr-small.cfg
Parsing cfg/yolo-qr-small.cfg
Loading bin/yolo-qr-small.weights ...
Traceback (most recent call last):
File "./flow", line 6, in
cliHandler(sys.argv)
File "/home/xwlab/darkflow/darkflow/cli.py", line 22, in cliHandler
tfnet = TFNet(FLAGS)
File "/home/xwlab/darkflow/darkflow/net/build.py", line 58, in init
darknet = Darknet(FLAGS)
File "/home/xwlab/darkflow/darkflow/dark/darknet.py", line 27, in init
self.load_weights()
File "/home/xwlab/darkflow/darkflow/dark/darknet.py", line 82, in load_weights
wgts_loader = loader.create_loader(*args)
File "/home/xwlab/darkflow/darkflow/utils/loader.py", line 105, in create_loader
return load_type(path, cfg)
File "/home/xwlab/darkflow/darkflow/utils/loader.py", line 19, in init
self.load(*args)
File "/home/xwlab/darkflow/darkflow/utils/loader.py", line 77, in load
walker.offset, walker.size)
AssertionError: expect 360624512 bytes, found 375881736

@desaroxx
Copy link

My problem was removing the trailing breakline in the labels.txt file. It counted the new empty line as an extra class

@Narayanprasai
Copy link

I used 7 classes cfg file with 60 filters. The labels
labels.txt
.txt file also contains 7 classes but even though there is error which is as follows:
AssertionError: labels.txt and cfg/tiny-yolo-voc-7c.cfg indicate inconsistent class numbers

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

No branches or pull requests

5 participants