Gennerate simple data to evaluate algorithm
NOTE: Using test_func without decode_batch (ctc) is better than when using ctc for predicting phase
- clean set (expected rnn model > 97%)
- noise set (expected < acc of clean set)
- padding set => so then we can apply IQA to imporve acc on noise set and padding set
1. Change function predict in Recognizor with test function (only X as input not length)
2. pad background identity card to same reality situation.
3. Create thin datase for 1080 train
4. **survey noise and padding method **
1. add noise (same real) for back [DONE]
2. Imporve training rnn
- loss visualization not smooth
- Augument data too much => variation
- batch size small
- too much noise
-
Increase batch size
-
About data generation
2.0 [x] Train with shuffe gen data MORE time before gen new data. 2.1 [x] Reduce random in gen function data: rand in font, rand in noise 2.2 [x] Use less noise: only use noise in real intuation.
-
[] Standardize data
-
[] check preprocessing of train
-
[] Too much regularization : dropout, batchnorm, weight L2. Reduce them. (Search more ...)
-
Switch mode Train to Test in layers: Batch Norm, Dropout, ... Don't use Dropout in test mode For example.
-
Decrease learning rate. (use sgd (0.003) instead of using Adadelta)
-
[] Init weight properly (maybe).
-
Use dropout in LSTM : LSTM(dropout=0.4). Dropout is diff dropout recurrent.
-
Save the best model in entire training process=> compare loss
- small batch size => more diff between batches => loss in between batches diff
- Train in small duration cause cannot learning deep in training set
- []
- []
- []
- With dropout cannot app dropout in testing because when test we need to use all weight.
Note that if your model has a different behavior in training and testing phase (e.g. if it uses Dropout, BatchNormalization, etc.), you will need to pass the learning phase flag to your function:
get_3rd_layer_output = K.function([model.layers[0].input, K.learning_phase()], [model.layers[3].output])
output in test mode = 0
layer_output = get_3rd_layer_output([x, 0])[0]
- Large lr => hard to converge.
- []
- Dropout for input and dropout for recurrent state. BatchNorm : Conv2d(Non-activation)->BatchNorm->Activation(ReLU). https://stackoverflow.com/questions/39691902/ordering-of-batch-normalization-and-dropout-in-tensorflow
Should use batch before Activation :(
https://github.com/ducha-aiki/caffenet-benchmark/blob/master/batchnorm.md
-
[] Low accuracy : add more test sample to training sample.
1.1 [x] add red sin background for training 1.2 [] add padded id area when id card is padded. 1.3 [x] find font for id card.
Using example on imgaug
- Add(-20,20)
- AdditiveGaussionNoise
- Salt p=(0->0.03)
- Pepper p= (0->0.03)
- GaussianBlur sigma=(0->0.25 or 0.5)
- AverageBlur k=(1, 3)
- MedianBlur k=(1,3)