ccmain/callnet.cpp File Reference

#include "mfcpch.h"
#include "errcode.h"
#include "globals.h"

Go to the source code of this file.

Defines

Functions

Variables


Define Documentation

#define OUTPUT_NODES   94

Note:
File: callnet.cpp (Formerly callnet.c)
Interface to Neural Net matcher
Author:
Phil Cheatle
Date:
Wed Nov 18 10:35:00 GMT 1992
 * (C) Copyright 1992, Hewlett-Packard Ltd.
 ** Licensed under the Apache License, Version 2.0 (the "License");
 ** you may not use this file except in compliance with the License.
 ** You may obtain a copy of the License at
 ** http://www.apache.org/licenses/LICENSE-2.0
 ** Unless required by applicable law or agreed to in writing, software
 ** distributed under the License is distributed on an "AS IS" BASIS,
 ** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 ** See the License for the specific language governing permissions and
 ** limitations under the License.

Definition at line 25 of file callnet.cpp.

Referenced by callnet().


Function Documentation

void callnet ( float *  input_vector,
char *  top,
float *  top_score,
char *  next,
float *  next_score 
)

Apply image to net: ONLY IF ASPIRIN_INCLUDED

Definition at line 52 of file callnet.cpp.

References OUTPUT_NODES.

00057                                 {
00058 #ifdef ASPIRIN_INCLUDED
00059   float *output_vector;
00060   int i;
00061   int max_out_i = 0;
00062   int next_max_out_i = 0;
00063   float max_out = -9;
00064   float next_max_out = -9;
00065 
00066   nmatch_set_input(input_vector);
00067   nmatch_propagate_forward();
00068   output_vector = nmatch_get_output ();
00069 
00070   /* Now find top two choices */
00071   for (i = 0; i < OUTPUT_NODES; i++) {
00072     if (output_vector[i] > max_out) {
00073       next_max_out = max_out;
00074       max_out = output_vector[i];
00075       next_max_out_i = max_out_i;
00076       max_out_i = i;
00077     }
00078     else {
00079       if (output_vector[i] > next_max_out) {
00080         next_max_out = output_vector[i];
00081         next_max_out_i = i;
00082       }
00083     }
00084   }
00085   *top = max_out_i + '!';
00086   *next = next_max_out_i + '!';
00087   *top_score = max_out;
00088   *next_score = next_max_out;
00089 #endif
00090 }

void init_net (  ) 

Note:
File: callnet.h (Formerly callnet.h)
Interface to Neural Net matcher
Author:
Phil Cheatle
Date:
Wed Nov 18 10:35:00 GMT 1992
 * (C) Copyright 1992, Hewlett-Packard Ltd.
 ** Licensed under the Apache License, Version 2.0 (the "License");
 ** you may not use this file except in compliance with the License.
 ** You may obtain a copy of the License at
 ** http://www.apache.org/licenses/LICENSE-2.0
 ** Unless required by applicable law or agreed to in writing, software
 ** distributed under the License is distributed on an "AS IS" BASIS,
 ** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 ** See the License for the specific language governing permissions and
 ** limitations under the License.

Definition at line 33 of file callnet.cpp.

References demodir, ERRCODE::error(), EXIT, and NETINIT.

Referenced by init_tesseract().

00033                 {  /* Initialise net */
00034 #ifdef ASPIRIN_INCLUDED
00035   char wts_filename[256];
00036 
00037   if (nmatch_init_network () != 0) {
00038     NETINIT.error ("Init_net", EXIT, "Errcode %s", nmatch_error_string ());
00039   }
00040   strcpy(wts_filename, demodir);
00041   strcat (wts_filename, "tessdata/netwts");
00042 
00043   if (nmatch_load_network (wts_filename) != 0) {
00044     NETINIT.error ("Init_net", EXIT, "Weights failed, Errcode %s",
00045       nmatch_error_string ());
00046   }
00047 #endif
00048 }


Variable Documentation

const ERRCODE NETINIT = "NN init error"

Definition at line 27 of file callnet.cpp.

Referenced by init_net().


Generated on Wed Feb 28 19:49:13 2007 for Tesseract by  doxygen 1.5.1