ankandrew / fast-plate-ocr

Lightweight & fast OCR models for license plate text recognition.
https://ankandrew.github.io/fast-plate-ocr
MIT License
74 stars 16 forks source link

Assistance Required with Training Error #22

Open i-ninte opened 5 days ago

i-ninte commented 5 days ago

Dear Ankandrew,

I hope this message finds you well. I would like to take a moment to thank you for your ongoing support and contributions to the Fast Plate OCR project. Your work is invaluable, and I truly appreciate your dedication.

I am currently working on training a model for recognizing Ghanaian license plates using the Fast Plate OCR framework on my Mac M3. However, I have encountered an issue during the training process, and I would greatly appreciate your assistance.

Below are the contents of the training log leading up to the error:

                                 CLI Training Parameters                        
╭─────────────────────────┬─────────────────────────────────────────────────────
│ Parameter               │ Details                                             
├─────────────────────────┼─────────────────────────────────────────────────────
│ dense                   │ True                                                
│ config_file             │ '/Users/ninte/desktop/fast-plate-ocr/ghanaocr/config
│ annotations             │ '/Users/ninte/desktop/fast-plate-ocr/ghanaocr/Ghanai
│                         │ License Plates.v2i.tensorflow/train/annotations.csv'
│ val_annotations         │ '/Users/ninte/desktop/fast-plate-ocr/ghanaocr/Ghanai
│                         │ License Plates.v2i.tensorflow/valid/annotations.csv'
│ augmentation_path       │ None                                                
│ lr                      │ 0.001                                               
│ batch_size              │ 128                                                 
│ num_workers             │ 0                                                   
│ output_dir              │ 'trained_models'                                    
│ epochs                  │ 750                                                 
│ tensorboard             │ False                                               
│ tensorboard_dir         │ 'tensorboard_logs'                                  
│ early_stopping_patience │ 100                                                 
│ reduce_lr_patience      │ 50                                                  
│ reduce_lr_factor        │ 0.85                                                
│ activation              │ 'relu'                                              
│ pool_layer              │ 'max'                                               
╰─────────────────────────┴─────────────────────────────────────────────────────

Augmentation Pipeline:
Compose([
  ShiftScaleRotate(p=1.0, shift_limit_x=(-0.06, 0.06), shift_limit_y=(-0.06, 
0.06), scale_limit=(-0.09999999999999998, 0.10000000000000009), 
rotate_limit=(-9, 9), interpolation=1, border_mode=0, value=(0.0, 0.0, 0.0), 
mask_value=0.0, rotate_method='largest_box'),
  RandomBrightnessContrast(p=1.0, brightness_limit=(-0.1, 0.1), 
contrast_limit=(-0.1, 0.1), brightness_by_max=True),
  MotionBlur(p=0.1, blur_limit=(3, 5), allow_shifted=True),
  OneOf([
    CoarseDropout(p=0.3, fill_value=0.0, mask_fill_value=None, 
num_holes_range=(10, 10), hole_height_range=(4, 4), hole_width_range=(4, 4)),
    PixelDropout(p=0.2, dropout_prob=0.01, per_channel=False, drop_value=0.0, 
mask_drop_value=None),
  ], p=0.7),
], p=1.0, bbox_params=None, keypoint_params=None, additional_targets={}, 
is_check_shapes=True)

Configuration:
{
    'max_plate_slots': 10,
    'alphabet': '0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ- ',
    'pad_char': ' ',
    'img_height': 70,
    'img_width': 140,
    'vocabulary_size': 38
}

Epoch 1/750

I ran the following command to initiate the training:

KERAS_BACKEND=tensorflow fast_plate_ocr train \
    --annotations '/Users/ninte/desktop/fast-plate-ocr/ghanaocr/Ghanaian License Plates.v2i.tensorflow/train/annotations.csv' \
    --val-annotations '/Users/ninte/desktop/fast-plate-ocr/ghanaocr/Ghanaian License Plates.v2i.tensorflow/valid/annotations.csv' \
    --config-file '/Users/ninte/desktop/fast-plate-ocr/ghanaocr/config.yaml' \
    --batch-size 128 \
    --epochs 750 \
    --dense \
    --early-stopping-patience 100 \
    --reduce-lr-patience 50

Unfortunately, I encountered the following error:

zsh: bus error  KERAS_BACKEND=tensorflow fast_plate_ocr train --annotations  --val-annotation

I would greatly appreciate any guidance or assistance you could provide to help resolve this issue.

Thank you once again for your time and support.

Best regards,

Ninte

ankandrew commented 4 days ago

Hi! Great that you want to train on your custom dataset 🚀! See this issues that is exact same problem, I'm aware of the issue. You can try changing ML framework i.e. to PyTorch/JAX or try this solution https://github.com/ankandrew/fast-plate-ocr/issues/21#issuecomment-2425249440.

i-ninte commented 3 days ago

thank you very much will do