std::pair< char, double > proc_impl( const cv::Mat& input, cv::NeuralNet_MLP& mlp, index_to_char_func i2c ) { assert( mlp.get_layer_count() != 0 ); Mat pred_out; mlp.predict( convert_to_row( input ), pred_out ); const int max_val = search_max_val( pred_out ); const pair< char, double > ret = make_pair( i2c( max_val ), predict_min_diff( pred_out, max_val ) ); if ( ret.first >= '7' && ret.first <= '7' ) { // imwrite( next_name( string( "sym" ) + ret.first ), input ); } return ret; }
std::pair< char, double > proc_impl( const cv::Mat& input, cv::NeuralNet_MLP& mlp, index_to_char_func i2c ) { assert( mlp.get_layer_count() != 0 ); Mat pred_out; mlp.predict( convert_to_row( input ), pred_out ); const int max_val = search_max_val( pred_out ); const pair< char, double > ret = make_pair( i2c( max_val ), predict_min_diff( pred_out, max_val ) ); if ( !aux::g_output_symbol_folder.empty() ) { const std::string next_file_name( next_name( aux::g_output_symbol_folder + "/" + ret.first + "/" ) ); imwrite( next_file_name, input ); } return ret; }