Beispiel #1
0
void
test(net_t *net, int n, nfloat_t *set, int rows_n, int image_size, int output_size)
{
  int       i = 0, j = 0, r = 0;
  int       input_size = image_size * image_size;
  nfloat_t  *input, *output, *correct_output;
  int       correct_bits = 0;
  int       correct_letters = 0;
  double    result_bits = 0.0;
  double    result_letters = 0.0;
  char      tmp;

  output = (nfloat_t *) malloc(output_size * sizeof(nfloat_t));
  n = rows_n;

  for (i = 0; i < n; ++i) {
    r = i;
    input = set + r * (input_size + output_size);
    correct_output = input + input_size;
    net_run(net, input, output);
    //~ print_input_data(input, image_size);
    //~ print_output_data(output, output_size);

    tmp = 0;

    for (j = 0; j < output_size; ++j)
      if (((output[j] >= 0) ^ (correct_output[j] >= 0)) == 0) {
        ++correct_bits;
        ++tmp;
      }

    if (tmp == output_size)
      ++correct_letters;
  }

  result_bits = (double) correct_bits * 100.0 / (output_size * n);
  result_letters = (double) correct_letters * 100.0 / n;

  printf("%12.9f %12.9f\n", result_bits, result_letters);
}
Beispiel #2
0
DWORD WINAPI net_thread(PVOID pParam)
{
	net_run();
	return 0;
}