question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. ItΒ collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Training yeld terrible results

See original GitHub issue

I’ve trained calamari with 1000 iterarions to detect data like: https://imgur.com/a/EgS6iwS

The log presents a high confidence:

calamari-predict --checkpoint model_00001001.ckpt --files pardal/crop_calamari/s06.jpg  
Found 1 files in the dataset
Checkpoint version 2 is up-to-date.
2020-04-02 11:15:46.185850: I tensorflow/core/platform/cpu_feature_guard.cc:142] Your CPU supports instructions that this TensorFlow binary was not compiled to use: SSE4.1 SSE4.2 AVX AVX2 FMA
2020-04-02 11:15:46.208737: I tensorflow/core/platform/profile_utils/cpu_utils.cc:94] CPU Frequency: 3699850000 Hz
2020-04-02 11:15:46.208948: I tensorflow/compiler/xla/service/service.cc:168] XLA service 0x555d6aabbd30 initialized for platform Host (this does not guarantee that XLA will be used). Devices:
2020-04-02 11:15:46.208960: I tensorflow/compiler/xla/service/service.cc:176]   StreamExecutor device (0): Host, Default Version
2020-04-02 11:15:46.209011: I tensorflow/core/common_runtime/process_util.cc:147] Creating new thread pool with default inter op setting: 2. Tune using inter_op_parallelism_threads for best performance.
Model: "model"
__________________________________________________________________________________________________
Layer (type)                    Output Shape         Param #     Connected to                     
==================================================================================================
input_data (InputLayer)         [(None, None, 48, 1) 0                                            
__________________________________________________________________________________________________
conv2d_0 (Conv2D)               (None, None, 48, 40) 400         input_data[0][0]                 
__________________________________________________________________________________________________
pool2d_1 (MaxPooling2D)         (None, None, 24, 40) 0           conv2d_0[0][0]                   
__________________________________________________________________________________________________
conv2d_1 (Conv2D)               (None, None, 24, 60) 21660       pool2d_1[0][0]                   
__________________________________________________________________________________________________
pool2d_3 (MaxPooling2D)         (None, None, 12, 60) 0           conv2d_1[0][0]                   
__________________________________________________________________________________________________
reshape (Reshape)               (None, None, 720)    0           pool2d_3[0][0]                   
__________________________________________________________________________________________________
bidirectional (Bidirectional)   (None, None, 400)    1473600     reshape[0][0]                    
__________________________________________________________________________________________________
input_sequence_length (InputLay [(None, 1)]          0                                            
__________________________________________________________________________________________________
dropout (Dropout)               (None, None, 400)    0           bidirectional[0][0]              
__________________________________________________________________________________________________
tf_op_layer_floordiv (TensorFlo [(None, 1)]          0           input_sequence_length[0][0]      
__________________________________________________________________________________________________
logits (Dense)                  (None, None, 7)      2807        dropout[0][0]                    
__________________________________________________________________________________________________
tf_op_layer_floordiv_1 (TensorF [(None, 1)]          0           tf_op_layer_floordiv[0][0]       
__________________________________________________________________________________________________
softmax (Softmax)               (None, None, 7)      0           logits[0][0]                     
__________________________________________________________________________________________________
input_data_params (InputLayer)  [(None, 1)]          0                                            
__________________________________________________________________________________________________
tf_op_layer_Cast (TensorFlowOpL [(None, 1)]          0           tf_op_layer_floordiv_1[0][0]     
==================================================================================================
Total params: 1,498,467
Trainable params: 1,498,467
Non-trainable params: 0
__________________________________________________________________________________________________
None
Prediction: 100%|β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆ| 1/1 [00:02<00:00,  2.15s/it]
Prediction of 1 models took 2.1655163764953613s
Average sentence confidence: 90.60%
All files written


Yet the result is: 29/12/21201429/12429/120/014

Which is obviously wrong. What am I doing wrong?

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:7 (3 by maintainers)

github_iconTop GitHub Comments

2reactions
andbuecommented, Apr 2, 2020

Could you please also check the corresponding .gt.txt files in train_test/sub_test and maybe provide the output of calamari-train at the start of the training process?

1reaction
ChWickcommented, Apr 2, 2020

You have only 16 training files? This are far too few lines to learn a robust model (here your model memorizes the training files but does not generalize). You probably need at least 1000 or even 10000 (since the lines are very short). Furthermore, you should start training from a pretrained model (–weights parapmeter, models can be found at https://github.com/Calamari-OCR/calamari_models). I recommend to use antiqua modern (only model 0 if you train only one model)

Read more comments on GitHub >

github_iconTop Results From Across the Web

Training the same model on the same data yielding extremely ...
I noticed that using shuffle(..., reshuffle_each_iteration=True) yield terrible results. And that using shuffle(dataset.cardinality().numpy())Β ...
Read more >
Why Leadership Training Programs Fail to Deliver the Results ...
Did you know that only 50% of leadership training programs yield the desired results? That's a pretty startling statistic.
Read more >
Companies Waste Billions Of Dollars On Ineffective Corporate ...
Everybody's got leadership development programs,” Beer says. Some studies have shown that only 10% of corporate training is effective, he says.
Read more >
Courageous Training: Bold Actions for Business Results (Bk ...
As they see more evidence that training is not working, they are more reluctant than ever to change course and provide active support....
Read more >
an excerpt from Courageous Training
an excerpt from. Courageous Training: Bold Actions for Business Results by Tim Mooney and Robert O. Brinkerhoff. Published by Berrett-Koehler PublishersΒ ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found