Skip to content

Commit

Permalink
[skip ci] Documentation updates
Browse files Browse the repository at this point in the history
  • Loading branch information
felixdittrich92 committed Mar 15, 2024
1 parent 80e529f commit aac1526
Show file tree
Hide file tree
Showing 40 changed files with 269 additions and 119 deletions.
Binary file modified .doctrees/environment.pickle
Binary file not shown.
12 changes: 3 additions & 9 deletions latest/_modules/doctr/models/recognition/sar/tensorflow.html
Original file line number Diff line number Diff line change
Expand Up @@ -425,23 +425,17 @@ <h1>Source code for doctr.models.recognition.sar.tensorflow</h1><div class="high
<span class="k">elif</span> <span class="n">t</span> <span class="o">==</span> <span class="mi">1</span><span class="p">:</span>
<span class="c1"># step to init a &#39;blank&#39; sequence of length vocab_size + 1 filled with zeros</span>
<span class="c1"># (N, vocab_size + 1) --&gt; (N, embedding_units)</span>
<span class="n">prev_symbol</span> <span class="o">=</span> <span class="n">tf</span><span class="o">.</span><span class="n">zeros</span><span class="p">([</span><span class="n">features</span><span class="o">.</span><span class="n">shape</span><span class="p">[</span><span class="mi">0</span><span class="p">],</span> <span class="bp">self</span><span class="o">.</span><span class="n">vocab_size</span> <span class="o">+</span> <span class="mi">1</span><span class="p">])</span>
<span class="n">prev_symbol</span> <span class="o">=</span> <span class="n">tf</span><span class="o">.</span><span class="n">zeros</span><span class="p">([</span><span class="n">features</span><span class="o">.</span><span class="n">shape</span><span class="p">[</span><span class="mi">0</span><span class="p">],</span> <span class="bp">self</span><span class="o">.</span><span class="n">vocab_size</span> <span class="o">+</span> <span class="mi">1</span><span class="p">],</span> <span class="n">dtype</span><span class="o">=</span><span class="n">features</span><span class="o">.</span><span class="n">dtype</span><span class="p">)</span>
<span class="n">prev_symbol</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">embed</span><span class="p">(</span><span class="n">prev_symbol</span><span class="p">,</span> <span class="o">**</span><span class="n">kwargs</span><span class="p">)</span>
<span class="k">else</span><span class="p">:</span>
<span class="k">if</span> <span class="n">gt</span> <span class="ow">is</span> <span class="ow">not</span> <span class="kc">None</span><span class="p">:</span>
<span class="k">if</span> <span class="n">gt</span> <span class="ow">is</span> <span class="ow">not</span> <span class="kc">None</span> <span class="ow">and</span> <span class="n">kwargs</span><span class="o">.</span><span class="n">get</span><span class="p">(</span><span class="s2">&quot;training&quot;</span><span class="p">,</span> <span class="kc">False</span><span class="p">):</span>
<span class="c1"># (N, embedding_units) -2 because of &lt;bos&gt; and &lt;eos&gt; (same)</span>
<span class="n">prev_symbol</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">embed</span><span class="p">(</span><span class="n">gt_embedding</span><span class="p">[:,</span> <span class="n">t</span> <span class="o">-</span> <span class="mi">2</span><span class="p">],</span> <span class="o">**</span><span class="n">kwargs</span><span class="p">)</span>
<span class="k">else</span><span class="p">:</span>
<span class="c1"># -1 to start at timestep where prev_symbol was initialized</span>
<span class="n">index</span> <span class="o">=</span> <span class="n">tf</span><span class="o">.</span><span class="n">argmax</span><span class="p">(</span><span class="n">logits_list</span><span class="p">[</span><span class="n">t</span> <span class="o">-</span> <span class="mi">1</span><span class="p">],</span> <span class="n">axis</span><span class="o">=-</span><span class="mi">1</span><span class="p">)</span>
<span class="c1"># update prev_symbol with ones at the index of the previous logit vector</span>
<span class="c1"># (N, embedding_units)</span>
<span class="n">index</span> <span class="o">=</span> <span class="n">tf</span><span class="o">.</span><span class="n">ones_like</span><span class="p">(</span><span class="n">index</span><span class="p">)</span>
<span class="n">prev_symbol</span> <span class="o">=</span> <span class="n">tf</span><span class="o">.</span><span class="n">scatter_nd</span><span class="p">(</span>
<span class="n">tf</span><span class="o">.</span><span class="n">expand_dims</span><span class="p">(</span><span class="n">index</span><span class="p">,</span> <span class="n">axis</span><span class="o">=</span><span class="mi">1</span><span class="p">),</span>
<span class="n">prev_symbol</span><span class="p">,</span>
<span class="n">tf</span><span class="o">.</span><span class="n">constant</span><span class="p">([</span><span class="n">features</span><span class="o">.</span><span class="n">shape</span><span class="p">[</span><span class="mi">0</span><span class="p">],</span> <span class="n">features</span><span class="o">.</span><span class="n">shape</span><span class="p">[</span><span class="o">-</span><span class="mi">1</span><span class="p">]],</span> <span class="n">dtype</span><span class="o">=</span><span class="n">tf</span><span class="o">.</span><span class="n">int64</span><span class="p">),</span>
<span class="p">)</span>
<span class="n">prev_symbol</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">embed</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">embed_tgt</span><span class="p">(</span><span class="n">index</span><span class="p">,</span> <span class="o">**</span><span class="n">kwargs</span><span class="p">),</span> <span class="o">**</span><span class="n">kwargs</span><span class="p">)</span>

<span class="c1"># (N, C), (N, C) take the last hidden state and cell state from current timestep</span>
<span class="n">_</span><span class="p">,</span> <span class="n">states</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">lstm_cells</span><span class="p">(</span><span class="n">prev_symbol</span><span class="p">,</span> <span class="n">states</span><span class="p">,</span> <span class="o">**</span><span class="n">kwargs</span><span class="p">)</span>
Expand Down
4 changes: 4 additions & 0 deletions latest/_sources/using_doctr/using_models.rst.txt
Original file line number Diff line number Diff line change
Expand Up @@ -228,6 +228,8 @@ For a comprehensive comparison, we have compiled a detailed benchmark on publicl
+----------------+----------------------------------------------------------+------------+---------------+------------+---------------+
| TensorFlow | db_resnet50 + master | 72.73 | 74.00 | 84.13 | 75.05 |
+----------------+----------------------------------------------------------+------------+---------------+------------+---------------+
| TensorFlow | db_resnet50 + sar_resnet31 | 73.23 | 74.51 | 85.34 | 76.03 |
+----------------+----------------------------------------------------------+------------+---------------+------------+---------------+
| TensorFlow | db_resnet50 + vitstr_small | 68.57 | 69.77 | 78.24 | 69.51 |
+----------------+----------------------------------------------------------+------------+---------------+------------+---------------+
| TensorFlow | db_resnet50 + vitstr_base | 70.96 | 72.20 | 82.10 | 72.94 |
Expand All @@ -242,6 +244,8 @@ For a comprehensive comparison, we have compiled a detailed benchmark on publicl
+----------------+----------------------------------------------------------+------------+---------------+------------+---------------+
| PyTorch | db_resnet50 + master | 73.90 | 76.66 | 85.84 | 80.07 |
+----------------+----------------------------------------------------------+------------+---------------+------------+---------------+
| PyTorch | db_resnet50 + sar_resnet31 | 73.58 | 76.33 | 85.64 | 79.88 |
+----------------+----------------------------------------------------------+------------+---------------+------------+---------------+
| PyTorch | db_resnet50 + vitstr_small | 73.06 | 75.79 | 85.95 | 80.17 |
+----------------+----------------------------------------------------------+------------+---------------+------------+---------------+
| PyTorch | db_resnet50 + vitstr_base | 73.70 | 76.46 | 85.76 | 79.99 |
Expand Down
2 changes: 1 addition & 1 deletion latest/searchindex.js

Large diffs are not rendered by default.

26 changes: 20 additions & 6 deletions latest/using_doctr/using_models.html
Original file line number Diff line number Diff line change
Expand Up @@ -770,54 +770,68 @@ <h3>Available architectures<a class="headerlink" href="#id2" title="Permalink to
<td><p>75.05</p></td>
</tr>
<tr class="row-odd"><td><p>TensorFlow</p></td>
<td><p>db_resnet50 + sar_resnet31</p></td>
<td><p>73.23</p></td>
<td><p>74.51</p></td>
<td><p>85.34</p></td>
<td><p>76.03</p></td>
</tr>
<tr class="row-even"><td><p>TensorFlow</p></td>
<td><p>db_resnet50 + vitstr_small</p></td>
<td><p>68.57</p></td>
<td><p>69.77</p></td>
<td><p>78.24</p></td>
<td><p>69.51</p></td>
</tr>
<tr class="row-even"><td><p>TensorFlow</p></td>
<tr class="row-odd"><td><p>TensorFlow</p></td>
<td><p>db_resnet50 + vitstr_base</p></td>
<td><p>70.96</p></td>
<td><p>72.20</p></td>
<td><p>82.10</p></td>
<td><p>72.94</p></td>
</tr>
<tr class="row-odd"><td><p>TensorFlow</p></td>
<tr class="row-even"><td><p>TensorFlow</p></td>
<td><p>db_resnet50 + parseq</p></td>
<td><p>68.85</p></td>
<td><p>70.05</p></td>
<td><p>72.38</p></td>
<td><p>64.30</p></td>
</tr>
<tr class="row-even"><td><p>PyTorch</p></td>
<tr class="row-odd"><td><p>PyTorch</p></td>
<td><p>db_resnet50 + crnn_vgg16_bn</p></td>
<td><p>72.43</p></td>
<td><p>75.13</p></td>
<td><p>85.05</p></td>
<td><p>79.33</p></td>
</tr>
<tr class="row-odd"><td><p>PyTorch</p></td>
<tr class="row-even"><td><p>PyTorch</p></td>
<td><p>db_resnet50 + crnn_mobilenet_v3_small</p></td>
<td><p>73.06</p></td>
<td><p>75.79</p></td>
<td><p>84.64</p></td>
<td><p>78.94</p></td>
</tr>
<tr class="row-even"><td><p>PyTorch</p></td>
<tr class="row-odd"><td><p>PyTorch</p></td>
<td><p>db_resnet50 + crnn_mobilenet_v3_large</p></td>
<td><p>73.17</p></td>
<td><p>75.90</p></td>
<td><p>84.96</p></td>
<td><p>79.25</p></td>
</tr>
<tr class="row-odd"><td><p>PyTorch</p></td>
<tr class="row-even"><td><p>PyTorch</p></td>
<td><p>db_resnet50 + master</p></td>
<td><p>73.90</p></td>
<td><p>76.66</p></td>
<td><p>85.84</p></td>
<td><p>80.07</p></td>
</tr>
<tr class="row-odd"><td><p>PyTorch</p></td>
<td><p>db_resnet50 + sar_resnet31</p></td>
<td><p>73.58</p></td>
<td><p>76.33</p></td>
<td><p>85.64</p></td>
<td><p>79.88</p></td>
</tr>
<tr class="row-even"><td><p>PyTorch</p></td>
<td><p>db_resnet50 + vitstr_small</p></td>
<td><p>73.06</p></td>
Expand Down
12 changes: 3 additions & 9 deletions v0.1.0/_modules/doctr/models/recognition/sar/tensorflow.html
Original file line number Diff line number Diff line change
Expand Up @@ -425,23 +425,17 @@ <h1>Source code for doctr.models.recognition.sar.tensorflow</h1><div class="high
<span class="k">elif</span> <span class="n">t</span> <span class="o">==</span> <span class="mi">1</span><span class="p">:</span>
<span class="c1"># step to init a &#39;blank&#39; sequence of length vocab_size + 1 filled with zeros</span>
<span class="c1"># (N, vocab_size + 1) --&gt; (N, embedding_units)</span>
<span class="n">prev_symbol</span> <span class="o">=</span> <span class="n">tf</span><span class="o">.</span><span class="n">zeros</span><span class="p">([</span><span class="n">features</span><span class="o">.</span><span class="n">shape</span><span class="p">[</span><span class="mi">0</span><span class="p">],</span> <span class="bp">self</span><span class="o">.</span><span class="n">vocab_size</span> <span class="o">+</span> <span class="mi">1</span><span class="p">])</span>
<span class="n">prev_symbol</span> <span class="o">=</span> <span class="n">tf</span><span class="o">.</span><span class="n">zeros</span><span class="p">([</span><span class="n">features</span><span class="o">.</span><span class="n">shape</span><span class="p">[</span><span class="mi">0</span><span class="p">],</span> <span class="bp">self</span><span class="o">.</span><span class="n">vocab_size</span> <span class="o">+</span> <span class="mi">1</span><span class="p">],</span> <span class="n">dtype</span><span class="o">=</span><span class="n">features</span><span class="o">.</span><span class="n">dtype</span><span class="p">)</span>
<span class="n">prev_symbol</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">embed</span><span class="p">(</span><span class="n">prev_symbol</span><span class="p">,</span> <span class="o">**</span><span class="n">kwargs</span><span class="p">)</span>
<span class="k">else</span><span class="p">:</span>
<span class="k">if</span> <span class="n">gt</span> <span class="ow">is</span> <span class="ow">not</span> <span class="kc">None</span><span class="p">:</span>
<span class="k">if</span> <span class="n">gt</span> <span class="ow">is</span> <span class="ow">not</span> <span class="kc">None</span> <span class="ow">and</span> <span class="n">kwargs</span><span class="o">.</span><span class="n">get</span><span class="p">(</span><span class="s2">&quot;training&quot;</span><span class="p">,</span> <span class="kc">False</span><span class="p">):</span>
<span class="c1"># (N, embedding_units) -2 because of &lt;bos&gt; and &lt;eos&gt; (same)</span>
<span class="n">prev_symbol</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">embed</span><span class="p">(</span><span class="n">gt_embedding</span><span class="p">[:,</span> <span class="n">t</span> <span class="o">-</span> <span class="mi">2</span><span class="p">],</span> <span class="o">**</span><span class="n">kwargs</span><span class="p">)</span>
<span class="k">else</span><span class="p">:</span>
<span class="c1"># -1 to start at timestep where prev_symbol was initialized</span>
<span class="n">index</span> <span class="o">=</span> <span class="n">tf</span><span class="o">.</span><span class="n">argmax</span><span class="p">(</span><span class="n">logits_list</span><span class="p">[</span><span class="n">t</span> <span class="o">-</span> <span class="mi">1</span><span class="p">],</span> <span class="n">axis</span><span class="o">=-</span><span class="mi">1</span><span class="p">)</span>
<span class="c1"># update prev_symbol with ones at the index of the previous logit vector</span>
<span class="c1"># (N, embedding_units)</span>
<span class="n">index</span> <span class="o">=</span> <span class="n">tf</span><span class="o">.</span><span class="n">ones_like</span><span class="p">(</span><span class="n">index</span><span class="p">)</span>
<span class="n">prev_symbol</span> <span class="o">=</span> <span class="n">tf</span><span class="o">.</span><span class="n">scatter_nd</span><span class="p">(</span>
<span class="n">tf</span><span class="o">.</span><span class="n">expand_dims</span><span class="p">(</span><span class="n">index</span><span class="p">,</span> <span class="n">axis</span><span class="o">=</span><span class="mi">1</span><span class="p">),</span>
<span class="n">prev_symbol</span><span class="p">,</span>
<span class="n">tf</span><span class="o">.</span><span class="n">constant</span><span class="p">([</span><span class="n">features</span><span class="o">.</span><span class="n">shape</span><span class="p">[</span><span class="mi">0</span><span class="p">],</span> <span class="n">features</span><span class="o">.</span><span class="n">shape</span><span class="p">[</span><span class="o">-</span><span class="mi">1</span><span class="p">]],</span> <span class="n">dtype</span><span class="o">=</span><span class="n">tf</span><span class="o">.</span><span class="n">int64</span><span class="p">),</span>
<span class="p">)</span>
<span class="n">prev_symbol</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">embed</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">embed_tgt</span><span class="p">(</span><span class="n">index</span><span class="p">,</span> <span class="o">**</span><span class="n">kwargs</span><span class="p">),</span> <span class="o">**</span><span class="n">kwargs</span><span class="p">)</span>

<span class="c1"># (N, C), (N, C) take the last hidden state and cell state from current timestep</span>
<span class="n">_</span><span class="p">,</span> <span class="n">states</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">lstm_cells</span><span class="p">(</span><span class="n">prev_symbol</span><span class="p">,</span> <span class="n">states</span><span class="p">,</span> <span class="o">**</span><span class="n">kwargs</span><span class="p">)</span>
Expand Down
4 changes: 4 additions & 0 deletions v0.1.0/_sources/using_doctr/using_models.rst.txt
Original file line number Diff line number Diff line change
Expand Up @@ -228,6 +228,8 @@ For a comprehensive comparison, we have compiled a detailed benchmark on publicl
+----------------+----------------------------------------------------------+------------+---------------+------------+---------------+
| TensorFlow | db_resnet50 + master | 72.73 | 74.00 | 84.13 | 75.05 |
+----------------+----------------------------------------------------------+------------+---------------+------------+---------------+
| TensorFlow | db_resnet50 + sar_resnet31 | 73.23 | 74.51 | 85.34 | 76.03 |
+----------------+----------------------------------------------------------+------------+---------------+------------+---------------+
| TensorFlow | db_resnet50 + vitstr_small | 68.57 | 69.77 | 78.24 | 69.51 |
+----------------+----------------------------------------------------------+------------+---------------+------------+---------------+
| TensorFlow | db_resnet50 + vitstr_base | 70.96 | 72.20 | 82.10 | 72.94 |
Expand All @@ -242,6 +244,8 @@ For a comprehensive comparison, we have compiled a detailed benchmark on publicl
+----------------+----------------------------------------------------------+------------+---------------+------------+---------------+
| PyTorch | db_resnet50 + master | 73.90 | 76.66 | 85.84 | 80.07 |
+----------------+----------------------------------------------------------+------------+---------------+------------+---------------+
| PyTorch | db_resnet50 + sar_resnet31 | 73.58 | 76.33 | 85.64 | 79.88 |
+----------------+----------------------------------------------------------+------------+---------------+------------+---------------+
| PyTorch | db_resnet50 + vitstr_small | 73.06 | 75.79 | 85.95 | 80.17 |
+----------------+----------------------------------------------------------+------------+---------------+------------+---------------+
| PyTorch | db_resnet50 + vitstr_base | 73.70 | 76.46 | 85.76 | 79.99 |
Expand Down
2 changes: 1 addition & 1 deletion v0.1.0/searchindex.js

Large diffs are not rendered by default.

Loading

0 comments on commit aac1526

Please sign in to comment.