thtrieu / darkflow

Translate darknet to tensorflow. Load trained weights, retrain/fine-tune using tensorflow, export constant graph def to mobile devices
GNU General Public License v3.0
6.13k stars 2.08k forks source link

Assertion Error #662

Open alfamousts opened 6 years ago

alfamousts commented 6 years ago

Hello everyone, I've got problem when using weights that i've been trained. When training, i am using code from darknet made by alexey . I used the darkflow code to load this weights but there was some errors like this.

Traceback (most recent call last): File "D:\TA\YOLO\darkflow-master\part4_video_2.py", line 13, in tfnet = TFNet(options) File "D:\TA\YOLO\darkflow-master\darkflow\net\build.py", line 64, in init self.framework = create_framework(*args) File "D:\TA\YOLO\darkflow-master\darkflow\net\framework.py", line 59, in create_framework return this(meta, FLAGS) File "D:\TA\YOLO\darkflow-master\darkflow\net\framework.py", line 15, in init self.constructor(meta, FLAGS) File "D:\TA\YOLO\darkflow-master\darkflow\net\yolo__init__.py", line 24, in constructor ).format(meta['model']) AssertionError: labels.txt and cfg/yolo-loreal.cfg indicate inconsistent class numbers

Anyone can help me ?

melonetern commented 6 years ago

have the same problem. I change the classes=2, and the last filters=35 which is (2+5)*5, and in the labels.txt I only have raccoon kangaroo I use --labels ../mylabels_path to train my own pictures. But I got this error: AssertionError: lables.txt and ../datasets/train/yolo.cfg indicate inconsistent class numbers. I don't understand, did I miss something?

eljirg commented 6 years ago

Found the same error, using the https://github.com/thtrieu/darkflow code

Traceback (most recent call last): File "flow", line 6, in cliHandler(sys.argv) File "C:\Users\eljir\DS\darkflow-master\darkflow\cli.py", line 26, in cliHandler tfnet = TFNet(FLAGS) File "C:\Users\eljir\DS\darkflow-master\darkflow\net\build.py", line 64, in init self.framework = create_framework(*args) File "C:\Users\eljir\DS\darkflow-master\darkflow\net\framework.py", line 59, in create_framework return this(meta, FLAGS) File "C:\Users\eljir\DS\darkflow-master\darkflow\net\framework.py", line 15, in init self.constructor(meta, FLAGS) File "C:\Users\eljir\DS\darkflow-master\darkflow\net\yolo__init__.py", line 24, in constructor ).format(meta['model']) AssertionError: labels.txt and cfg/yolov2-tiny.cfg indicate inconsistent class numbers

Changing the classes in cfg file to match the number of classes in the label.txt fixed the issues

ocaduacelab commented 6 years ago

Why does that solve it though? What does the number of classes in the cfg need to match the labels.txt file?

fogonthedowns commented 6 years ago

Check this out.

GGDRriedel commented 5 years ago

The problem still persists with weights and models downloaded from https://pjreddie.com/darknet/yolo/

KumarHalder commented 4 years ago

please copy the cfg file, give it a new name, edit the classes, and then use the new cfg file. Sometimes when you define the same name as the .cfg file, I guess the model does not check on the edited file, it checks the original one, causing the mismatch.