Minor fix

This commit is contained in:
AlexeyAB 2020-02-20 19:03:54 +03:00
parent 653eceb1a7
commit 8d87df2388
9 changed files with 28 additions and 19 deletions

View File

@ -67,7 +67,7 @@ void train_classifier(char *datacfg, char *cfgfile, char *weightfile, int *gpus,
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",
printf("\n 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();
}
@ -806,7 +806,7 @@ void predict_classifier(char *datacfg, char *cfgfile, char *weightfile, char *fi
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",
printf("\n 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();
}

View File

@ -59,7 +59,7 @@ void check_error(cudaError_t status)
{
const char *s = cudaGetErrorString(status);
char buffer[256];
printf("CUDA Error: %s\n", s);
printf("\n CUDA Error: %s\n", s);
snprintf(buffer, 256, "CUDA Error: %s", s);
#ifdef WIN32
getchar();
@ -70,7 +70,7 @@ void check_error(cudaError_t status)
{
const char *s = cudaGetErrorString(status2);
char buffer[256];
printf("CUDA Error Prev: %s\n", s);
printf("\n CUDA Error Prev: %s\n", s);
snprintf(buffer, 256, "CUDA Error Prev: %s", s);
#ifdef WIN32
getchar();
@ -181,7 +181,7 @@ void cudnn_check_error(cudnnStatus_t status)
{
const char *s = cudnnGetErrorString(status);
char buffer[256];
printf("cuDNN Error: %s\n", s);
printf("\n cuDNN Error: %s\n", s);
snprintf(buffer, 256, "cuDNN Error: %s", s);
#ifdef WIN32
getchar();
@ -192,7 +192,7 @@ void cudnn_check_error(cudnnStatus_t status)
{
const char *s = cudnnGetErrorString(status2);
char buffer[256];
printf("cuDNN Error Prev: %s\n", s);
printf("\n cuDNN Error Prev: %s\n", s);
snprintf(buffer, 256, "cuDNN Error Prev: %s", s);
#ifdef WIN32
getchar();

View File

@ -192,7 +192,10 @@ box_label *read_boxes(char *filename, int *n)
char *new_line = "\n";
fwrite(new_line, sizeof(char), strlen(new_line), fw);
fclose(fw);
if (check_mistakes) getchar();
if (check_mistakes) {
printf("\n Error in read_boxes() \n");
getchar();
}
*n = 0;
return boxes;
@ -994,7 +997,10 @@ data load_data_detection(int n, char **paths, int m, int w, int h, int c, int bo
mat_cv *src;
src = load_image_mat_cv(filename, flag);
if (src == NULL) {
if (check_mistakes) getchar();
if (check_mistakes) {
printf("\n Error in load_data_detection() - OpenCV \n");
getchar();
}
continue;
}

View File

@ -148,7 +148,7 @@ void demo(char *cfgfile, char *weightfile, float thresh, float hier_thresh, int
for(j = 0; j < NFRAMES; ++j) predictions[j] = (float *) calloc(l.outputs, sizeof(float));
if (l.classes != demo_classes) {
printf("Parameters don't match: in cfg-file classes=%d, in data-file classes=%d \n", l.classes, demo_classes);
printf("\n Parameters don't match: in cfg-file classes=%d, in data-file classes=%d \n", l.classes, demo_classes);
getchar();
exit(0);
}

View File

@ -51,7 +51,7 @@ void train_detector(char *datacfg, char *cfgfile, char *weightfile, int *gpus, i
int names_size = 0;
char **names = get_labels_custom(name_list, &names_size);
if (net_classes != names_size) {
printf(" Error: in the file %s number of names %d that isn't equal to classes=%d in the file %s \n",
printf("\n Error: in the file %s number of names %d that isn't equal to classes=%d in the file %s \n",
name_list, names_size, net_classes, cfgfile);
if (net_classes > names_size) getchar();
}
@ -855,7 +855,7 @@ float validate_detector_map(char *datacfg, char *cfgfile, char *weightfile, floa
calculate_binary_weights(net);
}
if (net.layers[net.n - 1].classes != names_size) {
printf(" Error: in the file %s number of names %d that isn't equal to classes=%d in the file %s \n",
printf("\n Error: in the file %s number of names %d that isn't equal to classes=%d in the file %s \n",
name_list, names_size, net.layers[net.n - 1].classes, cfgfile);
getchar();
}
@ -1466,7 +1466,7 @@ void test_detector(char *datacfg, char *cfgfile, char *weightfile, char *filenam
fuse_conv_batchnorm(net);
calculate_binary_weights(net);
if (net.layers[net.n - 1].classes != names_size) {
printf(" Error: in the file %s number of names %d that isn't equal to classes=%d in the file %s \n",
printf("\n Error: in the file %s number of names %d that isn't equal to classes=%d in the file %s \n",
name_list, names_size, net.layers[net.n - 1].classes, cfgfile);
if (net.layers[net.n - 1].classes > names_size) getchar();
}

View File

@ -455,7 +455,7 @@ void forward_gaussian_yolo_layer(const layer l, network_state state)
box truth = float_to_box_stride(state.truth + t*(4 + 1) + b*l.truths, 1);
int class_id = state.truth[t*(4 + 1) + b*l.truths + 4];
if (class_id >= l.classes) {
printf(" Warning: in txt-labels class_id=%d >= classes=%d in cfg-file. In txt-labels class_id should be [from 0 to %d] \n", class_id, l.classes, l.classes - 1);
printf("\n Warning: in txt-labels class_id=%d >= classes=%d in cfg-file. In txt-labels class_id should be [from 0 to %d] \n", class_id, l.classes, l.classes - 1);
printf(" truth.x = %f, truth.y = %f, truth.w = %f, truth.h = %f, class_id = %d \n", truth.x, truth.y, truth.w, truth.h, class_id);
getchar();
continue; // if label contains class_id more than number of classes in the cfg-file
@ -661,7 +661,7 @@ void forward_gaussian_yolo_layer(const layer l, network_state state)
uc_loss /= l.batch;
iou_loss /= l.batch;
printf("Region %d Avg IOU: %f, Class: %f, Obj: %f, No Obj: %f, .5R: %f, .75R: %f, count: %d, class_loss = %.2f, iou_loss = %.2f, uc_loss = %.2f, total_loss = %.2f \n",
fprintf(stderr, "Region %d Avg IOU: %f, Class: %f, Obj: %f, No Obj: %f, .5R: %f, .75R: %f, count: %d, class_loss = %.2f, iou_loss = %.2f, uc_loss = %.2f, total_loss = %.2f \n",
state.index, avg_iou/count, avg_cat/class_count, avg_obj/count, avg_anyobj/(l.w*l.h*l.n*l.batch), recall/count, recall75/count, count,
class_loss, iou_loss, uc_loss, loss);
}

View File

@ -1410,7 +1410,10 @@ image load_image_stb(char *filename, int channels)
char *new_line = "\n";
fwrite(new_line, sizeof(char), strlen(new_line), fw);
fclose(fw);
if (check_mistakes) getchar();
if (check_mistakes) {
printf("\n Error in load_image_stb() \n");
getchar();
}
return make_image(10, 10, 3);
//exit(EXIT_FAILURE);
}

View File

@ -299,7 +299,7 @@ void forward_region_layer(const region_layer l, network_state state)
box truth = float_to_box(state.truth + t*5 + b*l.truths);
int class_id = state.truth[t * 5 + b*l.truths + 4];
if (class_id >= l.classes) {
printf(" Warning: in txt-labels class_id=%d >= classes=%d in cfg-file. In txt-labels class_id should be [from 0 to %d] \n", class_id, l.classes, l.classes-1);
printf("\n Warning: in txt-labels class_id=%d >= classes=%d in cfg-file. In txt-labels class_id should be [from 0 to %d] \n", class_id, l.classes, l.classes-1);
getchar();
continue; // if label contains class_id more than number of classes in the cfg-file
}

View File

@ -361,8 +361,8 @@ void forward_yolo_layer(const layer l, network_state state)
box truth = float_to_box_stride(state.truth + t*(4 + 1) + b*l.truths, 1);
int class_id = state.truth[t*(4 + 1) + b*l.truths + 4];
if (class_id >= l.classes) {
printf(" Warning: in txt-labels class_id=%d >= classes=%d in cfg-file. In txt-labels class_id should be [from 0 to %d] \n", class_id, l.classes, l.classes - 1);
printf(" truth.x = %f, truth.y = %f, truth.w = %f, truth.h = %f, class_id = %d \n", truth.x, truth.y, truth.w, truth.h, class_id);
printf("\n Warning: in txt-labels class_id=%d >= classes=%d in cfg-file. In txt-labels class_id should be [from 0 to %d] \n", class_id, l.classes, l.classes - 1);
printf("\n truth.x = %f, truth.y = %f, truth.w = %f, truth.h = %f, class_id = %d \n", truth.x, truth.y, truth.w, truth.h, class_id);
getchar();
continue; // if label contains class_id more than number of classes in the cfg-file
}
@ -575,7 +575,7 @@ void forward_yolo_layer(const layer l, network_state state)
classification_loss /= l.batch;
iou_loss /= l.batch;
printf("v3 (%s loss, Normalizer: (iou: %.2f, cls: %.2f) Region %d Avg (IOU: %f, GIOU: %f), Class: %f, Obj: %f, No Obj: %f, .5R: %f, .75R: %f, count: %d, class_loss = %f, iou_loss = %f, total_loss = %f \n",
fprintf(stderr, "v3 (%s loss, Normalizer: (iou: %.2f, cls: %.2f) Region %d Avg (IOU: %f, GIOU: %f), Class: %f, Obj: %f, No Obj: %f, .5R: %f, .75R: %f, count: %d, class_loss = %f, iou_loss = %f, total_loss = %f \n",
(l.iou_loss == MSE ? "mse" : (l.iou_loss == GIOU ? "giou" : "iou")), l.iou_normalizer, l.cls_normalizer, state.index, tot_iou / count, tot_giou / count, avg_cat / class_count, avg_obj / count, avg_anyobj / (l.w*l.h*l.n*l.batch), recall / count, recall75 / count, count,
classification_loss, iou_loss, loss);
}