Reputation: 113
everybody.I'd like to use caffe to train a 5 classes detection task with "SSD: Single Shot MultiBox Detector", so I changed the num_classes from 21 to 6.However,I get an following error:
"Check failed: num_priors_ * num_classes_ == bottom[1]->channels() (52392 vs. 183372) Number of priors must match number of confidence predictions."
I can understand this error,and I found 52392/6=183372/21,namely why I changed num_classes to 6,but the number of confidence predictions is still 183372. So how to solve this problem. Thank you very much!
Upvotes: 2
Views: 1456
Reputation: 114786
Since SSD depends on the number of labels not only for the classification output, but also for the BB prediction, you would need to change num_output
in several other places in the model.
I would strongly suggest you wouldn't do that manually, but rather use the python scripts provided in the 'examples/ssd'
folder. For instance, you can change line 277 in 'examples/ssd/ssd_pascal_speed.py'
to:
num_classes = 5 # instead of 21
And then use the model files this script provides.
Upvotes: 2