LPRNet issue while training using custom data

While launching all of the code from cv_samples_v1.3.0/lprnet all works well, but when I replace training data with my own, I gen an error. All changes made to spec file are: max_label_length: 9, num_epochs: 80. Traceback below.

• NVIDIA GeForce RTX 3060
• LPRNet
• TAO Toolkit version: 3.21.11
• Training spec file:

random_seed: 42
lpr_config {
  hidden_units: 512
  max_label_length: 9
  arch: "baseline"
  nlayers: 18 #setting nlayers to be 10 to use baseline10 model
}
training_config {
  batch_size_per_gpu: 32
  num_epochs: 80
  learning_rate {
  soft_start_annealing_schedule {
    min_learning_rate: 1e-6
    max_learning_rate: 1e-5
    soft_start: 0.001
    annealing: 0.5
  }
  }
  regularizer {
    type: L2
    weight: 5e-4
  }
}
eval_config {
  validation_period_during_training: 5
  batch_size: 1
}
augmentation_config {
    output_width: 96
    output_height: 48
    output_channel: 3
    max_rotate_degree: 5
    rotate_prob: 0.5
    gaussian_kernel_size: 5
    gaussian_kernel_size: 7
    gaussian_kernel_size: 15
    blur_prob: 0.5
    reverse_color_prob: 0.5
    keep_original_prob: 0.3
}
dataset_config {
  data_sources: {
    label_directory_path: "/workspace/tao-experiments/data/openalpr/train/label"
    image_directory_path: "/workspace/tao-experiments/data/openalpr/train/image"
  }
  characters_list_file: "/workspace/tao-experiments/lprnet/specs/us_lp_characters.txt"
  validation_data_sources: {
    label_directory_path: "/workspace/tao-experiments/data/openalpr/val/label"
    image_directory_path: "/workspace/tao-experiments/data/openalpr/val/image"
  }
}

• Using code from cv_samples_v1.3.0/lprnet

• Traceback

Epoch 1/80
Traceback (most recent call last):
  File "/root/.cache/bazel/_bazel_root/ed34e6d125608f91724fda23656f1726/execroot/ai_infra/bazel-out/k8-fastbuild/bin/magnet/packages/iva/build_wheel.runfiles/ai_infra/iva/lprnet/scripts/train.py", line 279, in <module>
  File "/root/.cache/bazel/_bazel_root/ed34e6d125608f91724fda23656f1726/execroot/ai_infra/bazel-out/k8-fastbuild/bin/magnet/packages/iva/build_wheel.runfiles/ai_infra/iva/lprnet/scripts/train.py", line 275, in main
  File "/root/.cache/bazel/_bazel_root/ed34e6d125608f91724fda23656f1726/execroot/ai_infra/bazel-out/k8-fastbuild/bin/magnet/packages/iva/build_wheel.runfiles/ai_infra/iva/lprnet/scripts/train.py", line 200, in run_experiment
  File "/usr/local/lib/python3.6/dist-packages/tensorflow_core/python/keras/engine/training.py", line 727, in fit
    use_multiprocessing=use_multiprocessing)
  File "/usr/local/lib/python3.6/dist-packages/tensorflow_core/python/keras/engine/training_generator.py", line 603, in fit
    steps_name='steps_per_epoch')
  File "/usr/local/lib/python3.6/dist-packages/tensorflow_core/python/keras/engine/training_generator.py", line 221, in model_iteration
    batch_data = _get_next_batch(generator)
  File "/usr/local/lib/python3.6/dist-packages/tensorflow_core/python/keras/engine/training_generator.py", line 363, in _get_next_batch
    generator_output = next(generator)
  File "/usr/local/lib/python3.6/dist-packages/tensorflow_core/python/keras/utils/data_utils.py", line 789, in get
    six.reraise(*sys.exc_info())
  File "/usr/local/lib/python3.6/dist-packages/six.py", line 696, in reraise
    raise value
  File "/usr/local/lib/python3.6/dist-packages/tensorflow_core/python/keras/utils/data_utils.py", line 783, in get
    inputs = self.queue.get(block=True).get()
  File "/usr/lib/python3.6/multiprocessing/pool.py", line 644, in get
    raise self._value
  File "/usr/lib/python3.6/multiprocessing/pool.py", line 119, in worker
    result = (True, func(*args, **kwds))
  File "/usr/local/lib/python3.6/dist-packages/tensorflow_core/python/keras/utils/data_utils.py", line 571, in get_index
    return _SHARED_SEQUENCES[uid][i]
  File "/root/.cache/bazel/_bazel_root/ed34e6d125608f91724fda23656f1726/execroot/ai_infra/bazel-out/k8-fastbuild/bin/magnet/packages/iva/build_wheel.runfiles/ai_infra/iva/lprnet/dataloader/data_sequence.py", line 118, in __getitem__
  File "/root/.cache/bazel/_bazel_root/ed34e6d125608f91724fda23656f1726/execroot/ai_infra/bazel-out/k8-fastbuild/bin/magnet/packages/iva/build_wheel.runfiles/ai_infra/iva/lprnet/dataloader/data_sequence.py", line 118, in <listcomp>
KeyError: 'O'
2021-12-06 08:22:18,201 [INFO] tlt.components.docker_handler.docker_handler: Stopping container.

Can you check whether your data has “O” character?

Yes I do.
Amount of chars in train:

0: 15739
1: 16285
2: 15103
3: 14752
4: 14949
5: 15172
6: 14589
7: 14501
8: 14319
9: 14532
A: 9506
B: 8618
C: 5306
D: 5087
E: 6214
F: 3803
G: 5507
H: 5295
I: 1935
J: 4780
K: 6713
L: 5468
M: 4790
N: 4512
O: 1556
P: 5414
Q: 299
R: 5364
S: 6605
T: 5744
U: 2485
V: 3436
W: 2609
X: 3630
Y: 2127
Z: 4579

And val:

0: 314
1: 370
2: 362
3: 330
4: 326
5: 332
6: 422
7: 319
8: 413
9: 384
A: 152
B: 102
C: 104
D: 92
E: 168
F: 87
G: 76
H: 121
I: 22
J: 123
K: 128
L: 134
M: 61
N: 68
O: 49
P: 97
Q: 2
R: 162
S: 166
T: 98
U: 59
V: 57
W: 71
X: 40
Y: 33
Z: 126

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.