| | |
| | | #include "convolutional_layer.h" |
| | | #include "deconvolutional_layer.h" |
| | | #include "detection_layer.h" |
| | | #include "region_layer.h" |
| | | #include "normalization_layer.h" |
| | | #include "maxpool_layer.h" |
| | | #include "avgpool_layer.h" |
| | |
| | | return "softmax"; |
| | | case DETECTION: |
| | | return "detection"; |
| | | case REGION: |
| | | return "region"; |
| | | case DROPOUT: |
| | | return "dropout"; |
| | | case CROP: |
| | |
| | | forward_normalization_layer(l, state); |
| | | } else if(l.type == DETECTION){ |
| | | forward_detection_layer(l, state); |
| | | } else if(l.type == REGION){ |
| | | forward_region_layer(l, state); |
| | | } else if(l.type == CONNECTED){ |
| | | forward_connected_layer(l, state); |
| | | } else if(l.type == CROP){ |
| | |
| | | sum += net.layers[i].cost[0]; |
| | | ++count; |
| | | } |
| | | if(net.layers[i].type == REGION){ |
| | | sum += net.layers[i].cost[0]; |
| | | ++count; |
| | | } |
| | | } |
| | | return sum/count; |
| | | } |
| | |
| | | backward_dropout_layer(l, state); |
| | | } else if(l.type == DETECTION){ |
| | | backward_detection_layer(l, state); |
| | | } else if(l.type == REGION){ |
| | | backward_region_layer(l, state); |
| | | } else if(l.type == SOFTMAX){ |
| | | if(i != 0) backward_softmax_layer(l, state); |
| | | } else if(l.type == CONNECTED){ |
| | |
| | | return acc; |
| | | } |
| | | |
| | | float *network_accuracies(network net, data d) |
| | | float *network_accuracies(network net, data d, int n) |
| | | { |
| | | static float acc[2]; |
| | | matrix guess = network_predict_data(net, d); |
| | | acc[0] = matrix_topk_accuracy(d.y, guess,1); |
| | | acc[1] = matrix_topk_accuracy(d.y, guess,5); |
| | | acc[0] = matrix_topk_accuracy(d.y, guess, 1); |
| | | acc[1] = matrix_topk_accuracy(d.y, guess, n); |
| | | free_matrix(guess); |
| | | return acc; |
| | | } |