From f8452b3a499c7a3c078c03824c41b480bfe8bceb Mon Sep 17 00:00:00 2001 From: ankandrew <61120139+ankandrew@users.noreply.github.com> Date: Sat, 30 Mar 2024 23:44:15 -0300 Subject: [PATCH] Revert "Change label smoothing to 0.1" This reverts commit c0f72459a78664cfc639cbe9ab1216f0fb517f17. --- fast_plate_ocr/model/custom.py | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/fast_plate_ocr/model/custom.py b/fast_plate_ocr/model/custom.py index 04a994a..9634363 100644 --- a/fast_plate_ocr/model/custom.py +++ b/fast_plate_ocr/model/custom.py @@ -61,7 +61,7 @@ def top_3_k(y_true, y_pred): # Custom loss -def cce_loss(vocabulary_size: int, label_smoothing: float = 0.1): +def cce_loss(vocabulary_size: int): """ Categorical cross-entropy loss. """ @@ -73,9 +73,7 @@ def cce(y_true, y_pred): y_true = ops.reshape(y_true, newshape=(-1, vocabulary_size)) y_pred = ops.reshape(y_pred, newshape=(-1, vocabulary_size)) return ops.mean( - losses.categorical_crossentropy( - y_true, y_pred, from_logits=False, label_smoothing=label_smoothing - ) + losses.categorical_crossentropy(y_true, y_pred, from_logits=False, label_smoothing=0.2) ) return cce