Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Help runing the lastest version of ".\examples\vision\captcha_ocr.py" #1865

Open
sjhgithub opened this issue May 21, 2024 · 1 comment
Open
Assignees

Comments

@sjhgithub
Copy link

sjhgithub commented May 21, 2024

Issue Type

Others

Source

source

Keras Version

keras 3.3.3

Custom Code

No

OS Platform and Distribution

Windows 11

Python version

3.12.3

GPU model and memory

NO GPU and 32G of memory

Current Behavior?

I want to train with the example code captcha_ocr.py at CPU mode,but maybe it not work

Visualize the data

1

Let's check results on some validation samples

2

Standalone code to reproduce the issue or tutorial link

I using the fully orignal code!

Relevant log output

Number of images found:  1040
Number of labels found:  1040
Number of unique characters:  19
Characters present:  ['2', '3', '4', '5', '6', '7', '8', 'b', 'c', 'd', 'e', 'f', 'g', 'm', 'n', 'p', 'w', 'x', 'y']
Backend QtAgg is interactive backend. Turning interactive mode on.
WARNING:tensorflow:From ~\.pyenv\pyenv-win\versions\3.12.3\Lib\site-packages\keras\src\backend\tensorflow\core.py:184: The name tf.placeholder is deprecated. Please use tf.compat.v1.placeholder instead.

WARNING:tensorflow:From .\Keras\captcha_ocr/main.py:206: The name tf.nn.ctc_loss is deprecated. Please use tf.compat.v1.nn.ctc_loss instead.

Model: "ocr_model_v1"
┏━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┳━━━━━━━━━━━━━━━━━━━━━━━━━━━┳━━━━━━━━━━━━━━━━━┳━━━━━━━━━━━━━━━━━━━━━━━━━━━━┓
┃ Layer (type)                  ┃ Output Shape              ┃         Param # ┃ Connected to               ┃
┡━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━╇━━━━━━━━━━━━━━━━━━━━━━━━━━━╇━━━━━━━━━━━━━━━━━╇━━━━━━━━━━━━━━━━━━━━━━━━━━━━┩
│ image (InputLayer)            │ (None, 200, 50, 1)        │               0 │ -                          │
├───────────────────────────────┼───────────────────────────┼─────────────────┼────────────────────────────┤
│ Conv1 (Conv2D)                │ (None, 200, 50, 32)       │             320 │ image[0][0]                │
├───────────────────────────────┼───────────────────────────┼─────────────────┼────────────────────────────┤
│ pool1 (MaxPooling2D)          │ (None, 100, 25, 32)       │               0 │ Conv1[0][0]                │
├───────────────────────────────┼───────────────────────────┼─────────────────┼────────────────────────────┤
│ Conv2 (Conv2D)                │ (None, 100, 25, 64)       │          18,496 │ pool1[0][0]                │
├───────────────────────────────┼───────────────────────────┼─────────────────┼────────────────────────────┤
│ pool2 (MaxPooling2D)          │ (None, 50, 12, 64)        │               0 │ Conv2[0][0]                │
├───────────────────────────────┼───────────────────────────┼─────────────────┼────────────────────────────┤
│ reshape (Reshape)             │ (None, 50, 768)           │               0 │ pool2[0][0]                │
├───────────────────────────────┼───────────────────────────┼─────────────────┼────────────────────────────┤
│ dense1 (Dense)                │ (None, 50, 64)            │          49,216 │ reshape[0][0]              │
├───────────────────────────────┼───────────────────────────┼─────────────────┼────────────────────────────┤
│ dropout (Dropout)             │ (None, 50, 64)            │               0 │ dense1[0][0]               │
├───────────────────────────────┼───────────────────────────┼─────────────────┼────────────────────────────┤
│ bidirectional (Bidirectional) │ (None, 50, 256)           │         197,632 │ dropout[0][0]              │
├───────────────────────────────┼───────────────────────────┼─────────────────┼────────────────────────────┤
│ bidirectional_1               │ (None, 50, 128)           │         164,352 │ bidirectional[0][0]        │
│ (Bidirectional)               │                           │                 │                            │
├───────────────────────────────┼───────────────────────────┼─────────────────┼────────────────────────────┤
│ label (InputLayer)            │ (None, None)              │               0 │ -                          │
├───────────────────────────────┼───────────────────────────┼─────────────────┼────────────────────────────┤
│ dense2 (Dense)                │ (None, 50, 21)            │           2,709 │ bidirectional_1[0][0]      │
├───────────────────────────────┼───────────────────────────┼─────────────────┼────────────────────────────┤
│ ctc_loss (CTCLayer)           │ (None, 50, 21)            │               0 │ label[0][0], dense2[0][0]  │
└───────────────────────────────┴───────────────────────────┴─────────────────┴────────────────────────────┘
 Total params: 432,725 (1.65 MB)
 Trainable params: 432,725 (1.65 MB)
 Non-trainable params: 0 (0.00 B)
Epoch 1/100
59/59 ━━━━━━━━━━━━━━━━━━━━ 22s 151ms/step - loss: 573.8171 - val_loss: 259.9441
Epoch 2/100
59/59 ━━━━━━━━━━━━━━━━━━━━ 7s 115ms/step - loss: 266.0679 - val_loss: 259.6601
Epoch 3/100
59/59 ━━━━━━━━━━━━━━━━━━━━ 7s 118ms/step - loss: 265.8085 - val_loss: 259.5720
Epoch 4/100
59/59 ━━━━━━━━━━━━━━━━━━━━ 7s 125ms/step - loss: 265.4333 - val_loss: 259.6912
Epoch 5/100
59/59 ━━━━━━━━━━━━━━━━━━━━ 7s 122ms/step - loss: 265.0823 - val_loss: 259.8639
Epoch 6/100
59/59 ━━━━━━━━━━━━━━━━━━━━ 7s 124ms/step - loss: 264.9500 - val_loss: 260.3272
Epoch 7/100
59/59 ━━━━━━━━━━━━━━━━━━━━ 7s 124ms/step - loss: 264.4566 - val_loss: 260.4218
Epoch 8/100
59/59 ━━━━━━━━━━━━━━━━━━━━ 7s 125ms/step - loss: 264.2820 - val_loss: 261.2303
Epoch 9/100
59/59 ━━━━━━━━━━━━━━━━━━━━ 7s 123ms/step - loss: 264.0614 - val_loss: 261.7300
Epoch 10/100
59/59 ━━━━━━━━━━━━━━━━━━━━ 7s 122ms/step - loss: 263.7991 - val_loss: 262.3080
Epoch 11/100
59/59 ━━━━━━━━━━━━━━━━━━━━ 7s 122ms/step - loss: 263.3847 - val_loss: 263.0411
Epoch 12/100
59/59 ━━━━━━━━━━━━━━━━━━━━ 7s 123ms/step - loss: 263.3570 - val_loss: 263.9005
Epoch 13/100
59/59 ━━━━━━━━━━━━━━━━━━━━ 7s 125ms/step - loss: 262.9985 - val_loss: 264.1309
Model: "functional_1"
┏━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┳━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┳━━━━━━━━━━━━━━━━━┓
┃ Layer (type)                         ┃ Output Shape                ┃         Param #
┡━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━╇━━━━━━━━━━━━━━━━━━━━━━━━━━━━━╇━━━━━━━━━━━━━━━━━┩
│ image (InputLayer)                   │ (None, 200, 50, 1)          │               0 │
├──────────────────────────────────────┼─────────────────────────────┼─────────────────┤
│ Conv1 (Conv2D)                       │ (None, 200, 50, 32)         │             320 │
├──────────────────────────────────────┼─────────────────────────────┼─────────────────┤
│ pool1 (MaxPooling2D)                 │ (None, 100, 25, 32)         │               0 │
├──────────────────────────────────────┼─────────────────────────────┼─────────────────┤
│ Conv2 (Conv2D)                       │ (None, 100, 25, 64)         │          18,496 │
├──────────────────────────────────────┼─────────────────────────────┼─────────────────┤
│ pool2 (MaxPooling2D)                 │ (None, 50, 12, 64)          │               0 │
├──────────────────────────────────────┼─────────────────────────────┼─────────────────┤
│ reshape (Reshape)                    │ (None, 50, 768)             │               0 │
├──────────────────────────────────────┼─────────────────────────────┼─────────────────┤
│ dense1 (Dense)                       │ (None, 50, 64)              │          49,216 │
├──────────────────────────────────────┼─────────────────────────────┼─────────────────┤
│ dropout (Dropout)                    │ (None, 50, 64)              │               0 │
├──────────────────────────────────────┼─────────────────────────────┼─────────────────┤
│ bidirectional (Bidirectional)        │ (None, 50, 256)             │         197,632 │
├──────────────────────────────────────┼─────────────────────────────┼─────────────────┤
│ bidirectional_1 (Bidirectional)      │ (None, 50, 128)             │         164,352 │
├──────────────────────────────────────┼─────────────────────────────┼─────────────────┤
│ dense2 (Dense)                       │ (None, 50, 21)              │           2,709 │
└──────────────────────────────────────┴─────────────────────────────┴─────────────────┘
 Total params: 432,725 (1.65 MB)
 Trainable params: 432,725 (1.65 MB)
 Non-trainable params: 0 (0.00 B)
1/1 ━━━━━━━━━━━━━━━━━━━━ 1s 1s/step
@LukasPetrov
Copy link

same problem

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants