Joseph Redmon
2014-10-26 5c9a773bb6e994889354c181de5a872e867aa35b
src/network.c
@@ -38,6 +38,7 @@
    //printf("start\n");
    int i;
    for(i = 0; i < net.n; ++i){
        clock_t time = clock();
        if(net.types[i] == CONVOLUTIONAL){
            convolutional_layer layer = *(convolutional_layer *)net.layers[i];
            forward_convolutional_layer_gpu(layer, input);
@@ -62,6 +63,7 @@
            forward_softmax_layer_gpu(layer, input);
            input = layer.output_cl;
        }
        printf("%d %f\n", i, sec(clock()-time));
        /*
           else if(net.types[i] == CROP){
           crop_layer layer = *(crop_layer *)net.layers[i];
@@ -621,7 +623,7 @@
    image *prev = 0;
    int i;
    char buff[256];
    show_image(get_network_image_layer(net, 0), "Crop");
    //show_image(get_network_image_layer(net, 0), "Crop");
    for(i = 0; i < net.n; ++i){
        sprintf(buff, "Layer %d", i);
        if(net.types[i] == CONVOLUTIONAL){
@@ -635,6 +637,27 @@
    } 
}
void top_predictions(network net, int n, int *index)
{
    int i,j;
    int k = get_network_output_size(net);
    float *out = get_network_output(net);
    float thresh = FLT_MAX;
    for(i = 0; i < n; ++i){
        float max = -FLT_MAX;
        int max_i = -1;
        for(j = 0; j < k; ++j){
            float val = out[j];
            if(val > max &&  val < thresh){
                max = val;
                max_i = j;
            }
        }
        index[i] = max_i;
        thresh = max;
    }
}
float *network_predict(network net, float *input)
{
    forward_network(net, input, 0, 0);