bool MainWindow::RunFann() {
try {
QDebugStream qds (std::cout,ui->textEdit);
if ((ui->lineEdit_4->text() == "") || (ui->lineEdit_5->text() == "")) {
QMessageBox::warning(this,tr
("Warning"),tr
("Select a valid test data file and a trainded FANN file first!"));
return(false);
}
RedirectOutput(0);
QByteArray ba
= ui
->lineEdit_5
->text
().
toLocal8Bit();
struct fann *ann = fann_create_from_file(ba.data());
ba = ui->lineEdit_4->text().toLocal8Bit();
struct fann_train_data *TestData = fann_read_train_from_file(ba.data()); //< external lib function call
fann_type *result;
printf("SEQUENCE : SOURCE : CALCULATED\n");
for (int i=0;i<TestData->num_data;i++) {
result = fann_run(ann,TestData->input[i]); //< external lib function call
for (int j=0;j<ann->num_output;j++) {
char str[10];
sprintf(str,"%d %s %f %s %f\n",i,":",result[j],":",TestData->output[i][j]);
printf(str);
}
}
RedirectOutput(1);
} catch (std::exception & e) {
printf("something weired happened..");
}
}
bool MainWindow::RunFann() {
try {
QDebugStream qds (std::cout,ui->textEdit);
if ((ui->lineEdit_4->text() == "") || (ui->lineEdit_5->text() == "")) {
QMessageBox::warning(this,tr("Warning"),tr("Select a valid test data file and a trainded FANN file first!"));
return(false);
}
RedirectOutput(0);
QByteArray ba = ui->lineEdit_5->text().toLocal8Bit();
struct fann *ann = fann_create_from_file(ba.data());
ba = ui->lineEdit_4->text().toLocal8Bit();
struct fann_train_data *TestData = fann_read_train_from_file(ba.data()); //< external lib function call
fann_type *result;
printf("SEQUENCE : SOURCE : CALCULATED\n");
for (int i=0;i<TestData->num_data;i++) {
result = fann_run(ann,TestData->input[i]); //< external lib function call
for (int j=0;j<ann->num_output;j++) {
char str[10];
sprintf(str,"%d %s %f %s %f\n",i,":",result[j],":",TestData->output[i][j]);
printf(str);
}
}
RedirectOutput(1);
} catch (std::exception & e) {
printf("something weired happened..");
}
}
To copy to clipboard, switch view to plain text mode
Any help much appreciated.
Bookmarks