Joseph Redmon
2015-07-24 fdcc096694791f92d2cff0e4fd74fbabfca12936
src/network.c
@@ -68,6 +68,9 @@
    int i;
    for(i = 0; i < net.n; ++i){
        layer l = net.layers[i];
        if(l.delta){
            scal_cpu(l.outputs * l.batch, 0, l.delta, 1);
        }
        if(l.type == CONVOLUTIONAL){
            forward_convolutional_layer(l, state);
        } else if(l.type == DECONVOLUTIONAL){
@@ -122,13 +125,20 @@
float get_network_cost(network net)
{
    if(net.layers[net.n-1].type == COST){
        return net.layers[net.n-1].output[0];
    int i;
    float sum = 0;
    int count = 0;
    for(i = 0; i < net.n; ++i){
        if(net.layers[net.n-1].type == COST){
            sum += net.layers[net.n-1].output[0];
            ++count;
        }
        if(net.layers[net.n-1].type == DETECTION){
            sum += net.layers[net.n-1].cost[0];
            ++count;
        }
    }
    if(net.layers[net.n-1].type == DETECTION){
        return net.layers[net.n-1].cost[0];
    }
    return 0;
    return sum/count;
}
int get_predicted_class_network(network net)
@@ -181,9 +191,9 @@
float train_network_datum(network net, float *x, float *y)
{
    #ifdef GPU
#ifdef GPU
    if(gpu_index >= 0) return train_network_datum_gpu(net, x, y);
    #endif
#endif
    network_state state;
    state.input = x;
    state.delta = 0;