checkpoint

This commit is contained in:
Joseph Redmon
2014-11-18 13:51:04 -08:00
parent b13ad6d5fd
commit d407bffde9
23 changed files with 194 additions and 96 deletions

View File

@ -476,25 +476,11 @@ void visualize_network(network net)
}
}
void top_predictions(network net, int n, int *index)
void top_predictions(network net, int k, int *index)
{
int i,j;
int k = get_network_output_size(net);
int size = 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;
}
top_k(out, size, k, index);
}