Added error message

This commit is contained in:
AlexeyAB 2020-02-02 14:27:39 +03:00
parent 2223a4b51a
commit d51d89053a
1 changed files with 10 additions and 0 deletions

View File

@ -66,6 +66,11 @@ void train_classifier(char *datacfg, char *cfgfile, char *weightfile, int *gpus,
int topk_data = option_find_int(options, "top", 5);
char topk_buff[10];
sprintf(topk_buff, "top%d", topk_data);
if (classes != net.layers[net.n - 1].inputs) {
printf(" Error: num of filters = %d in the last conv-layer in cfg-file doesn't match to classes = %d in data-file \n",
net.layers[net.n - 1].inputs, classes);
getchar();
}
char **labels = get_labels(label_list);
list *plist = get_paths(train_list);
@ -800,6 +805,11 @@ void predict_classifier(char *datacfg, char *cfgfile, char *weightfile, char *fi
if(!name_list) name_list = option_find_str(options, "labels", "data/labels.list");
int classes = option_find_int(options, "classes", 2);
printf(" classes = %d, output in cfg = %d \n", classes, net.layers[net.n - 1].c);
if (classes != net.layers[net.n - 1].inputs) {
printf(" Error: num of filters = %d in the last conv-layer in cfg-file doesn't match to classes = %d in data-file \n",
net.layers[net.n - 1].inputs, classes);
getchar();
}
if (top == 0) top = option_find_int(options, "top", 1);
if (top > classes) top = classes;