sumit
2007-05-09 20:57:24 UTC
Hi
I am making an OCR for my project using fann.
I am using Cascade training .
i am attaching my training code below
Initially i used
fann_set_activation_function_output(ann,FANN_SIGMOID_SYMMETRIC);
and
fann_set_activation_function_hidden(ann,FANN_LINEAR);
I am taking image pixel as input (25*25)
for black pixel : -1
for white pixel : 1
my output is 1 corresponding to right char (what i fixed)
and -1 for all.
It get converged in what it write "Neurons 10 Current Error......."
At last it write training error 0 test error 0 (in my case test file and
train file are same)
but when i pass my OCR the same trained char it gives error .
Is that (training error 0 and testing error 0) not reliable ????
What are the impact of
cascade activation functions[]
cascade activation steepnesses[]
RPROP increase factor
RPROP decrease factor
on training ?????
Should i use default or should i change it ????
Thanks
////////////////////////////////////////////////////////////////CODE////////////////////////////////////////////////////////////////////////////
#include <stdio.h>
#include "fann.h"
int main()
{
struct fann *ann;
struct fann_train_data *train_data, *test_data;
const float desired_error = (const float) 0.0000000;
unsigned int max_neurons = 1500;
unsigned int neurons_between_reports = 1;
const float learning_rate = (const float) 0.001;
int k;
printf("Reading data.\n");
train_data = fann_read_train_from_file("cascadeOCR.train");
test_data = fann_read_train_from_file("cascadeOCR.test");
printf("Creating network.\n");
ann = fann_create_shortcut(2, fann_num_input_train_data(train_data),
fann_num_output_train_data(train_data));
fann_set_training_algorithm(ann, FANN_TRAIN_RPROP);
fann_set_activation_function_hidden(ann,FANN_LINEAR);//FANN_SIGMOID_SYMMETRIC);
fann_set_activation_function_output(ann,FANN_LINEAR);
//FANN_SIGMOID_SYMMETRIC);
fann_set_train_error_function(ann, FANN_ERRORFUNC_LINEAR);
fann_set_learning_rate(ann, learning_rate);
fann_print_parameters(ann);
printf("Training network.\n");
fann_cascadetrain_on_data(ann, train_data, max_neurons,
neurons_between_reports, desired_error);
fann_print_connections(ann);
printf("\nTrain error: %f, Test error: %f\n\n", fann_test_data(ann,
train_data),
fann_test_data(ann, test_data));
printf("Saving network.\n");
fann_save(ann, "cascadeOCR.net");
printf("Cleaning up.\n");
fann_destroy_train(train_data);
fann_destroy_train(test_data);
fann_destroy(ann);
return 0;
}
I am making an OCR for my project using fann.
I am using Cascade training .
i am attaching my training code below
Initially i used
fann_set_activation_function_output(ann,FANN_SIGMOID_SYMMETRIC);
and
fann_set_activation_function_hidden(ann,FANN_LINEAR);
I am taking image pixel as input (25*25)
for black pixel : -1
for white pixel : 1
my output is 1 corresponding to right char (what i fixed)
and -1 for all.
It get converged in what it write "Neurons 10 Current Error......."
At last it write training error 0 test error 0 (in my case test file and
train file are same)
but when i pass my OCR the same trained char it gives error .
Is that (training error 0 and testing error 0) not reliable ????
What are the impact of
cascade activation functions[]
cascade activation steepnesses[]
RPROP increase factor
RPROP decrease factor
on training ?????
Should i use default or should i change it ????
Thanks
////////////////////////////////////////////////////////////////CODE////////////////////////////////////////////////////////////////////////////
#include <stdio.h>
#include "fann.h"
int main()
{
struct fann *ann;
struct fann_train_data *train_data, *test_data;
const float desired_error = (const float) 0.0000000;
unsigned int max_neurons = 1500;
unsigned int neurons_between_reports = 1;
const float learning_rate = (const float) 0.001;
int k;
printf("Reading data.\n");
train_data = fann_read_train_from_file("cascadeOCR.train");
test_data = fann_read_train_from_file("cascadeOCR.test");
printf("Creating network.\n");
ann = fann_create_shortcut(2, fann_num_input_train_data(train_data),
fann_num_output_train_data(train_data));
fann_set_training_algorithm(ann, FANN_TRAIN_RPROP);
fann_set_activation_function_hidden(ann,FANN_LINEAR);//FANN_SIGMOID_SYMMETRIC);
fann_set_activation_function_output(ann,FANN_LINEAR);
//FANN_SIGMOID_SYMMETRIC);
fann_set_train_error_function(ann, FANN_ERRORFUNC_LINEAR);
fann_set_learning_rate(ann, learning_rate);
fann_print_parameters(ann);
printf("Training network.\n");
fann_cascadetrain_on_data(ann, train_data, max_neurons,
neurons_between_reports, desired_error);
fann_print_connections(ann);
printf("\nTrain error: %f, Test error: %f\n\n", fann_test_data(ann,
train_data),
fann_test_data(ann, test_data));
printf("Saving network.\n");
fann_save(ann, "cascadeOCR.net");
printf("Cleaning up.\n");
fann_destroy_train(train_data);
fann_destroy_train(test_data);
fann_destroy(ann);
return 0;
}
--
Sumit
Sumit