LSTM

来源:互联网 发布:手机网络时间同步软件 编辑:程序博客网 时间:2024/05/22 15:01
  1. name: "BasicLstm"  
  2.   
  3. layer {  
  4.   name: "data"  
  5.   type: "HDF5Data"  
  6.   top: "data" //输入数据  
  7.   top: "cont" //数据切分(不是1就是0)  
  8.   top: "label"//对应的标签  
  9.   include {  
  10.     phase: TRAIN  
  11.   }  
  12.   hdf5_data_param {  
  13.     source: "./path_to_txt.txt"  
  14.     batch_size: 2000  
  15.   }  
  16. }  
  17.   
  18.   
  19. layer {  
  20.   name: "lstm1"  
  21.   type: "LSTM"  
  22.   bottom: "data"  
  23.   bottom: "cont"  
  24.   top: "lstm1"  
  25.   recurrent_param {  
  26.     num_output: 5 //LSTM1输出的对应维度  
  27.     weight_filler {  
  28.       type: "uniform"  
  29.       min: -0.08  
  30.       max: 0.08  
  31.     }  
  32.     bias_filler {  
  33.       type: "constant"  
  34.       value: 0  
  35.     }  
  36.   }  
  37. }  
  38.   
  39. layer {  
  40.   name: "lstm2"  
  41.   type: "LSTM"  
  42.   bottom: "lstm1"   
  43.   bottom: "cont"  
  44.   top: "lstm2"  
  45.   recurrent_param {  
  46.     num_output: 4    //LSTM2输出对应的维度  
  47.     weight_filler {  
  48.       type: "uniform"  
  49.       min: -0.08  
  50.       max: 0.08  
  51.     }  
  52.     bias_filler {  
  53.       type: "constant"  
  54.       value: 0  
  55.     }  
  56.   }  
  57. }  
  58.   
  59.   
  60. layer {  
  61.   name: "predict"  
  62.   type: "InnerProduct"  
  63.   bottom: "lstm2"  
  64.   top: "predict"  
  65.   param {  
  66.     lr_mult: 1  
  67.     decay_mult: 1  
  68.   }  
  69.   param {  
  70.     lr_mult: 2  
  71.     decay_mult: 0  
  72.   }  
  73.   inner_product_param {  
  74.     num_output: 39    //对应的输出维度用于分类  
  75.     weight_filler {  
  76.       type: "gaussian"  
  77.       std: 0.01  
  78.     }  
  79.     bias_filler {  
  80.       type: "constant"  
  81.       value: 0  
  82.     }  
  83.     axis: 2  
  84.   }  
  85. }  
  86.   
  87.   
  88.   
  89. layer {  
  90.   name: "softmax_loss"  
  91.   type: "SoftmaxWithLoss" //softmax分类  
  92.   bottom: "predict"  
  93.   bottom: "label"  
  94.   top: "loss"  
  95.   loss_weight: 20  
  96.   softmax_param {  
  97.     axis: 2  
  98.   }  
  99.   loss_param {  
  100.     ignore_label: -1 //忽略标签为-1的数据  
  101.   }  
  102. }  
原创粉丝点击