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











up vote
-2
down vote

favorite












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


























    up vote
    -2
    down vote

    favorite












    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
























      up vote
      -2
      down vote

      favorite









      up vote
      -2
      down vote

      favorite











      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 at 6:11









      CaptainSama

      11




      11
























          2 Answers
          2






          active

          oldest

          votes

















          up vote
          0
          down vote













          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 at 8:16


















          up vote
          0
          down vote













          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 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',
          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








          up vote
          0
          down vote













          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 at 8:16















          up vote
          0
          down vote













          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 at 8:16













          up vote
          0
          down vote










          up vote
          0
          down vote









          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 at 9:25









          Daniel GL

          757316




          757316












          • I will read this paper..thank you .
            – CaptainSama
            Nov 27 at 8:16


















          • I will read this paper..thank you .
            – CaptainSama
            Nov 27 at 8:16
















          I will read this paper..thank you .
          – CaptainSama
          Nov 27 at 8:16




          I will read this paper..thank you .
          – CaptainSama
          Nov 27 at 8:16












          up vote
          0
          down vote













          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 at 8:12















          up vote
          0
          down vote













          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 at 8:12













          up vote
          0
          down vote










          up vote
          0
          down vote









          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 at 15:18









          Harry

          379213




          379213












          • Thank you for helping me to explain this problem...I will read some paper about CTC...
            – CaptainSama
            Nov 27 at 8:12


















          • Thank you for helping me to explain this problem...I will read some paper about CTC...
            – CaptainSama
            Nov 27 at 8:12
















          Thank you for helping me to explain this problem...I will read some paper about CTC...
          – CaptainSama
          Nov 27 at 8:12




          Thank you for helping me to explain this problem...I will read some paper about CTC...
          – CaptainSama
          Nov 27 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.





          Some of your past answers have not been well-received, and you're in danger of being blocked from answering.


          Please pay close attention to the following guidance:


          • 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

          A CLEAN and SIMPLE way to add appendices to Table of Contents and bookmarks

          Calculate evaluation metrics using cross_val_predict sklearn

          Insert data from modal to MySQL (multiple modal on website)