Why the “get_output_size” is len(alphabet) + 1 not len(alphabet) in the Keras OCR example?












-2















I am just a Keras beginner and I try to implement a OCR project by Keras.So I try to learn from Keras OCR example.Here's a link!

I do not understand why "get_output_size" in class TextImageGenerator is len(alphabet) + 1 but not len(alphabet)?
I will appreciate it if someone can tell me why ..










share|improve this question



























    -2















    I am just a Keras beginner and I try to implement a OCR project by Keras.So I try to learn from Keras OCR example.Here's a link!

    I do not understand why "get_output_size" in class TextImageGenerator is len(alphabet) + 1 but not len(alphabet)?
    I will appreciate it if someone can tell me why ..










    share|improve this question

























      -2












      -2








      -2








      I am just a Keras beginner and I try to implement a OCR project by Keras.So I try to learn from Keras OCR example.Here's a link!

      I do not understand why "get_output_size" in class TextImageGenerator is len(alphabet) + 1 but not len(alphabet)?
      I will appreciate it if someone can tell me why ..










      share|improve this question














      I am just a Keras beginner and I try to implement a OCR project by Keras.So I try to learn from Keras OCR example.Here's a link!

      I do not understand why "get_output_size" in class TextImageGenerator is len(alphabet) + 1 but not len(alphabet)?
      I will appreciate it if someone can tell me why ..







      keras ocr






      share|improve this question













      share|improve this question











      share|improve this question




      share|improve this question










      asked Nov 22 '18 at 6:11









      CaptainSamaCaptainSama

      11




      11
























          2 Answers
          2






          active

          oldest

          votes


















          0














          It's related to the CTC layer used as cost function. Maybe reading the scientific papers will give you more perspective, but it's related to a "extra" class used by the model to say ("there is no letter").
          Paper by Graves explaining the algorithm behind






          share|improve this answer
























          • I will read this paper..thank you .

            – CaptainSama
            Nov 27 '18 at 8:16



















          0














          There is one extra-character needed in neural networks trained with CTC loss. This extra-character essentially means "no character seen at this position" and is called CTC blank.



          It is used to allow different alignments of a text or to allow some white-space between characters (think of an image containing " hello" or "hello " with whitespace around them, for both you want to recognize "hello").
          When recognizing the text, these blanks are removed: e.g. when using best path decoding, the best-scoring character at each position is taken, but the blanks will be removed.



          To get a better idea of this special CTC blank character, let's look at the illustration below. The output of the neural network contains the characters a, b and the CTC blank (denoted as "-").
          Let's pick the best-scoring characters for each position t0...t4, this gives us "aaa-b". Best path decoding removes repeated characters, this gives us "a-b", and finally removes all blanks, which gives us "ab".
          enter image description here



          If you want some more information, you can look at my CTC article, or this article, or the original paper.






          share|improve this answer
























          • Thank you for helping me to explain this problem...I will read some paper about CTC...

            – CaptainSama
            Nov 27 '18 at 8:12











          Your Answer






          StackExchange.ifUsing("editor", function () {
          StackExchange.using("externalEditor", function () {
          StackExchange.using("snippets", function () {
          StackExchange.snippets.init();
          });
          });
          }, "code-snippets");

          StackExchange.ready(function() {
          var channelOptions = {
          tags: "".split(" "),
          id: "1"
          };
          initTagRenderer("".split(" "), "".split(" "), channelOptions);

          StackExchange.using("externalEditor", function() {
          // Have to fire editor after snippets, if snippets enabled
          if (StackExchange.settings.snippets.snippetsEnabled) {
          StackExchange.using("snippets", function() {
          createEditor();
          });
          }
          else {
          createEditor();
          }
          });

          function createEditor() {
          StackExchange.prepareEditor({
          heartbeatType: 'answer',
          autoActivateHeartbeat: false,
          convertImagesToLinks: true,
          noModals: true,
          showLowRepImageUploadWarning: true,
          reputationToPostImages: 10,
          bindNavPrevention: true,
          postfix: "",
          imageUploader: {
          brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
          contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
          allowUrls: true
          },
          onDemand: true,
          discardSelector: ".discard-answer"
          ,immediatelyShowMarkdownHelp:true
          });


          }
          });














          draft saved

          draft discarded


















          StackExchange.ready(
          function () {
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53424847%2fwhy-the-get-output-size-is-lenalphabet-1-not-lenalphabet-in-the-keras-oc%23new-answer', 'question_page');
          }
          );

          Post as a guest















          Required, but never shown

























          2 Answers
          2






          active

          oldest

          votes








          2 Answers
          2






          active

          oldest

          votes









          active

          oldest

          votes






          active

          oldest

          votes









          0














          It's related to the CTC layer used as cost function. Maybe reading the scientific papers will give you more perspective, but it's related to a "extra" class used by the model to say ("there is no letter").
          Paper by Graves explaining the algorithm behind






          share|improve this answer
























          • I will read this paper..thank you .

            – CaptainSama
            Nov 27 '18 at 8:16
















          0














          It's related to the CTC layer used as cost function. Maybe reading the scientific papers will give you more perspective, but it's related to a "extra" class used by the model to say ("there is no letter").
          Paper by Graves explaining the algorithm behind






          share|improve this answer
























          • I will read this paper..thank you .

            – CaptainSama
            Nov 27 '18 at 8:16














          0












          0








          0







          It's related to the CTC layer used as cost function. Maybe reading the scientific papers will give you more perspective, but it's related to a "extra" class used by the model to say ("there is no letter").
          Paper by Graves explaining the algorithm behind






          share|improve this answer













          It's related to the CTC layer used as cost function. Maybe reading the scientific papers will give you more perspective, but it's related to a "extra" class used by the model to say ("there is no letter").
          Paper by Graves explaining the algorithm behind







          share|improve this answer












          share|improve this answer



          share|improve this answer










          answered Nov 22 '18 at 9:25









          Daniel GLDaniel GL

          791416




          791416













          • I will read this paper..thank you .

            – CaptainSama
            Nov 27 '18 at 8:16



















          • I will read this paper..thank you .

            – CaptainSama
            Nov 27 '18 at 8:16

















          I will read this paper..thank you .

          – CaptainSama
          Nov 27 '18 at 8:16





          I will read this paper..thank you .

          – CaptainSama
          Nov 27 '18 at 8:16













          0














          There is one extra-character needed in neural networks trained with CTC loss. This extra-character essentially means "no character seen at this position" and is called CTC blank.



          It is used to allow different alignments of a text or to allow some white-space between characters (think of an image containing " hello" or "hello " with whitespace around them, for both you want to recognize "hello").
          When recognizing the text, these blanks are removed: e.g. when using best path decoding, the best-scoring character at each position is taken, but the blanks will be removed.



          To get a better idea of this special CTC blank character, let's look at the illustration below. The output of the neural network contains the characters a, b and the CTC blank (denoted as "-").
          Let's pick the best-scoring characters for each position t0...t4, this gives us "aaa-b". Best path decoding removes repeated characters, this gives us "a-b", and finally removes all blanks, which gives us "ab".
          enter image description here



          If you want some more information, you can look at my CTC article, or this article, or the original paper.






          share|improve this answer
























          • Thank you for helping me to explain this problem...I will read some paper about CTC...

            – CaptainSama
            Nov 27 '18 at 8:12
















          0














          There is one extra-character needed in neural networks trained with CTC loss. This extra-character essentially means "no character seen at this position" and is called CTC blank.



          It is used to allow different alignments of a text or to allow some white-space between characters (think of an image containing " hello" or "hello " with whitespace around them, for both you want to recognize "hello").
          When recognizing the text, these blanks are removed: e.g. when using best path decoding, the best-scoring character at each position is taken, but the blanks will be removed.



          To get a better idea of this special CTC blank character, let's look at the illustration below. The output of the neural network contains the characters a, b and the CTC blank (denoted as "-").
          Let's pick the best-scoring characters for each position t0...t4, this gives us "aaa-b". Best path decoding removes repeated characters, this gives us "a-b", and finally removes all blanks, which gives us "ab".
          enter image description here



          If you want some more information, you can look at my CTC article, or this article, or the original paper.






          share|improve this answer
























          • Thank you for helping me to explain this problem...I will read some paper about CTC...

            – CaptainSama
            Nov 27 '18 at 8:12














          0












          0








          0







          There is one extra-character needed in neural networks trained with CTC loss. This extra-character essentially means "no character seen at this position" and is called CTC blank.



          It is used to allow different alignments of a text or to allow some white-space between characters (think of an image containing " hello" or "hello " with whitespace around them, for both you want to recognize "hello").
          When recognizing the text, these blanks are removed: e.g. when using best path decoding, the best-scoring character at each position is taken, but the blanks will be removed.



          To get a better idea of this special CTC blank character, let's look at the illustration below. The output of the neural network contains the characters a, b and the CTC blank (denoted as "-").
          Let's pick the best-scoring characters for each position t0...t4, this gives us "aaa-b". Best path decoding removes repeated characters, this gives us "a-b", and finally removes all blanks, which gives us "ab".
          enter image description here



          If you want some more information, you can look at my CTC article, or this article, or the original paper.






          share|improve this answer













          There is one extra-character needed in neural networks trained with CTC loss. This extra-character essentially means "no character seen at this position" and is called CTC blank.



          It is used to allow different alignments of a text or to allow some white-space between characters (think of an image containing " hello" or "hello " with whitespace around them, for both you want to recognize "hello").
          When recognizing the text, these blanks are removed: e.g. when using best path decoding, the best-scoring character at each position is taken, but the blanks will be removed.



          To get a better idea of this special CTC blank character, let's look at the illustration below. The output of the neural network contains the characters a, b and the CTC blank (denoted as "-").
          Let's pick the best-scoring characters for each position t0...t4, this gives us "aaa-b". Best path decoding removes repeated characters, this gives us "a-b", and finally removes all blanks, which gives us "ab".
          enter image description here



          If you want some more information, you can look at my CTC article, or this article, or the original paper.







          share|improve this answer












          share|improve this answer



          share|improve this answer










          answered Nov 22 '18 at 15:18









          HarryHarry

          457313




          457313













          • Thank you for helping me to explain this problem...I will read some paper about CTC...

            – CaptainSama
            Nov 27 '18 at 8:12



















          • Thank you for helping me to explain this problem...I will read some paper about CTC...

            – CaptainSama
            Nov 27 '18 at 8:12

















          Thank you for helping me to explain this problem...I will read some paper about CTC...

          – CaptainSama
          Nov 27 '18 at 8:12





          Thank you for helping me to explain this problem...I will read some paper about CTC...

          – CaptainSama
          Nov 27 '18 at 8:12


















          draft saved

          draft discarded




















































          Thanks for contributing an answer to Stack Overflow!


          • Please be sure to answer the question. Provide details and share your research!

          But avoid



          • Asking for help, clarification, or responding to other answers.

          • Making statements based on opinion; back them up with references or personal experience.


          To learn more, see our tips on writing great answers.




          draft saved


          draft discarded














          StackExchange.ready(
          function () {
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53424847%2fwhy-the-get-output-size-is-lenalphabet-1-not-lenalphabet-in-the-keras-oc%23new-answer', 'question_page');
          }
          );

          Post as a guest















          Required, but never shown





















































          Required, but never shown














          Required, but never shown












          Required, but never shown







          Required, but never shown

































          Required, but never shown














          Required, but never shown












          Required, but never shown







          Required, but never shown







          Popular posts from this blog

          MongoDB - Not Authorized To Execute Command

          How to fix TextFormField cause rebuild widget in Flutter

          in spring boot 2.1 many test slices are not allowed anymore due to multiple @BootstrapWith