C识别车牌(国外英语资料).docVIP

  • 3
  • 0
  • 约1.22万字
  • 约 35页
  • 2017-06-26 发布于河南
  • 举报
C识别车牌(国外英语资料)

C识别车牌(国外英语资料) / *训练BP网络* / void bpnn_train(BPNN * net,double eta,double动量,double * eo,double * eh) { int,藏; 双out_err hid_err; 在=净- input_n; 藏=净- hidden_n; =净- output_n; / * * *前向输入激活* * * / bpnn_layerforward(净- input_units,净- hidden_units, 净- input_weights,、藏); bpnn_layerforward(净- hidden_units,净- output_units, 网- hidden_weights、藏); / * * *计算隐含层和输出层误差* * * / bpnn_output_error(网- output_delta,网- 目标,净- output_units, ,out_err); bpnn_hidden_error(净- hidden_delta、藏、净- output_delta,, 网- hidden_weights,网- hidden_units,hid_err); * eo = out_err; *呃= hid_err; / * * *调整输入层和隐含层权值* * * / bpnn_adjust_weights(净- output_delta,净- hidden_units,藏, 网- hidden_weights,网- hidden_prev_weights,η,动量); bpnn_adjust_weights(净- hidden_delta、藏、净- input_units,, 网- input_weights,网- input_prev_weights,η,动量); } / *保存BP网络* / void bpnn_save(BPNN * net,char *文件名) { 用文件; char * mem; 第n1,n2,n3,i,j,memcnt; 双dvalue,* * w; n1 = net - input_n;n2 = net - hidden_n;n3 = net - output_n; printf(“将% dx % dx % d网络保存到”% s“\ n”、n1、n2、n3、文件名); 试一试 { file.Open(文件名用::modeWrite |用:内容|用:modeNoTruncate); } 抓住(CFileException * e) { e - ReportError(); e - Delete(); } file.Write(n1,sizeof(int)); file.Write(n2,sizeof(int)); file.Write(n3,sizeof(int)); memcnt = 0; w =净- input_weights; mem =(char *)malloc((unsigned)((n1 + 1)*(n2 + 1)* sizeof(双))); / / mem =(char *)malloc(((n1 + 1)*(n2 + 1)* sizeof(双))); for(i = 0;i = n1;i + +){ for(j = 0;j = n2;j + +){ dvalue = w[我][j]; / / fastcopy(mem memcnt,dvalue,sizeof(双)); fastcopy(mem[memcnt],dvalue sizeof(双)); memcnt + =运算符(双); } } file.Write(mem sizeof(双)*(n1 + 1)*(n2 + 1)); 免费(mem); memcnt = 0; w =净- hidden_weights; mem =(char *)malloc((unsigned)((n2 + 1)*(n3 + 1)* sizeof(双))); / / mem =(char *)malloc(((n2 + 1)*(n3 + 1)* sizeof(双))); for(i = 0;i = n2;i + +){ for(j = 0;j = n3;j + +){ dvalue = w[我][j]; fastcopy(mem[memcnt],dvalue sizeof(双)); / / fastcopy(mem memcnt,dvalue,sizeof(双)); memcnt + =运算符(双); } } 文件。写入(mem,(n2 + 1)*(n3 + 1)* sizeof(double)); / /

您可能关注的文档

文档评论(0)

1亿VIP精品文档

相关文档