tesseract  5.0.0
lstm_squashed_test.cc
Go to the documentation of this file.
1 // (C) Copyright 2017, Google Inc.
2 // Licensed under the Apache License, Version 2.0 (the "License");
3 // you may not use this file except in compliance with the License.
4 // You may obtain a copy of the License at
5 // http://www.apache.org/licenses/LICENSE-2.0
6 // Unless required by applicable law or agreed to in writing, software
7 // distributed under the License is distributed on an "AS IS" BASIS,
8 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
9 // See the License for the specific language governing permissions and
10 // limitations under the License.
11 
12 #include "lstm_test.h"
13 
14 namespace tesseract {
15 
16 // Tests that a Squashed network learns correctly.
17 // Almost as fast as the 2d-lstm.
18 TEST_F(LSTMTrainerTest, TestSquashed) {
19  // A 2-layer LSTM with a Squashed feature-extracting LSTM on the bottom, and
20  // a small convolution/maxpool below that.
21  // Match training conditions to those typically used with this spec:
22  // recoding on, adam on.
23  SetupTrainerEng("[1,32,0,1 Ct3,3,16 Mp3,3 Lfys48 Lbx96 O1c1]", "SQU-2-layer-lstm",
24  /*recode*/ true, /*adam*/ true);
25  double lstm_2d_err = TrainIterations(kTrainerIterations * 3 / 2);
26  EXPECT_LT(lstm_2d_err, 80);
27  LOG(INFO) << "********** < 80 ************\n";
28  TestIntMode(kTrainerIterations);
29 }
30 
31 } // namespace tesseract.
@ LOG
@ INFO
Definition: log.h:28
const int kTrainerIterations
Definition: lstm_test.h:34
TEST_F(EuroText, FastLatinOCR)