Skip to content

Commit

Permalink
[skip ci] Documentation updates
Browse files Browse the repository at this point in the history
  • Loading branch information
odulcy-mindee committed Apr 26, 2024
1 parent 9f65590 commit ad83079
Show file tree
Hide file tree
Showing 55 changed files with 2,550 additions and 1,517 deletions.
Binary file modified .doctrees/environment.pickle
Binary file not shown.
Original file line number Diff line number Diff line change
Expand Up @@ -272,6 +272,7 @@ <h1>Source code for doctr.models.classification.mobilenet.tensorflow</h1><div cl
<span class="s2">&quot;mobilenet_v3_large&quot;</span><span class="p">,</span>
<span class="s2">&quot;mobilenet_v3_large_r&quot;</span><span class="p">,</span>
<span class="s2">&quot;mobilenet_v3_small_crop_orientation&quot;</span><span class="p">,</span>
<span class="s2">&quot;mobilenet_v3_small_page_orientation&quot;</span><span class="p">,</span>
<span class="p">]</span>


Expand Down Expand Up @@ -679,6 +680,29 @@ <h1>Source code for doctr.models.classification.mobilenet.tensorflow</h1><div cl
<span class="sd"> &quot;&quot;&quot;</span>
<span class="k">return</span> <span class="n">_mobilenet_v3</span><span class="p">(</span><span class="s2">&quot;mobilenet_v3_small_crop_orientation&quot;</span><span class="p">,</span> <span class="n">pretrained</span><span class="p">,</span> <span class="n">include_top</span><span class="o">=</span><span class="kc">True</span><span class="p">,</span> <span class="o">**</span><span class="n">kwargs</span><span class="p">)</span></div>



<div class="viewcode-block" id="mobilenet_v3_small_page_orientation">
<a class="viewcode-back" href="../../../../../modules/models.html#doctr.models.classification.mobilenet_v3_small_page_orientation">[docs]</a>
<span class="k">def</span> <span class="nf">mobilenet_v3_small_page_orientation</span><span class="p">(</span><span class="n">pretrained</span><span class="p">:</span> <span class="nb">bool</span> <span class="o">=</span> <span class="kc">False</span><span class="p">,</span> <span class="o">**</span><span class="n">kwargs</span><span class="p">:</span> <span class="n">Any</span><span class="p">)</span> <span class="o">-&gt;</span> <span class="n">MobileNetV3</span><span class="p">:</span>
<span class="w"> </span><span class="sd">&quot;&quot;&quot;MobileNetV3-Small architecture as described in</span>
<span class="sd"> `&quot;Searching for MobileNetV3&quot;,</span>
<span class="sd"> &lt;https://arxiv.org/pdf/1905.02244.pdf&gt;`_.</span>
<span class="sd"> &gt;&gt;&gt; import tensorflow as tf</span>
<span class="sd"> &gt;&gt;&gt; from doctr.models import mobilenet_v3_small_page_orientation</span>
<span class="sd"> &gt;&gt;&gt; model = mobilenet_v3_small_page_orientation(pretrained=False)</span>
<span class="sd"> &gt;&gt;&gt; input_tensor = tf.random.uniform(shape=[1, 512, 512, 3], maxval=1, dtype=tf.float32)</span>
<span class="sd"> &gt;&gt;&gt; out = model(input_tensor)</span>
<span class="sd"> Args:</span>
<span class="sd"> ----</span>
<span class="sd"> pretrained: boolean, True if model is pretrained</span>
<span class="sd"> **kwargs: keyword arguments of the MobileNetV3 architecture</span>
<span class="sd"> Returns:</span>
<span class="sd"> -------</span>
<span class="sd"> a keras.Model</span>
<span class="sd"> &quot;&quot;&quot;</span>
<span class="k">return</span> <span class="n">_mobilenet_v3</span><span class="p">(</span><span class="s2">&quot;mobilenet_v3_small_page_orientation&quot;</span><span class="p">,</span> <span class="n">pretrained</span><span class="p">,</span> <span class="n">include_top</span><span class="o">=</span><span class="kc">True</span><span class="p">,</span> <span class="o">**</span><span class="n">kwargs</span><span class="p">)</span></div>

</pre></div>
</article>
</div>
Expand Down
41 changes: 34 additions & 7 deletions latest/_modules/doctr/models/classification/zoo.html
Original file line number Diff line number Diff line change
Expand Up @@ -261,7 +261,7 @@ <h1>Source code for doctr.models.classification.zoo</h1><div class="highlight"><
<span class="kn">from</span> <span class="nn">..preprocessor</span> <span class="kn">import</span> <span class="n">PreProcessor</span>
<span class="kn">from</span> <span class="nn">.predictor</span> <span class="kn">import</span> <span class="n">OrientationPredictor</span>

<span class="n">__all__</span> <span class="o">=</span> <span class="p">[</span><span class="s2">&quot;crop_orientation_predictor&quot;</span><span class="p">]</span>
<span class="n">__all__</span> <span class="o">=</span> <span class="p">[</span><span class="s2">&quot;crop_orientation_predictor&quot;</span><span class="p">,</span> <span class="s2">&quot;page_orientation_predictor&quot;</span><span class="p">]</span>

<span class="n">ARCHS</span><span class="p">:</span> <span class="n">List</span><span class="p">[</span><span class="nb">str</span><span class="p">]</span> <span class="o">=</span> <span class="p">[</span>
<span class="s2">&quot;magc_resnet31&quot;</span><span class="p">,</span>
Expand All @@ -281,7 +281,7 @@ <h1>Source code for doctr.models.classification.zoo</h1><div class="highlight"><
<span class="s2">&quot;vit_s&quot;</span><span class="p">,</span>
<span class="s2">&quot;vit_b&quot;</span><span class="p">,</span>
<span class="p">]</span>
<span class="n">ORIENTATION_ARCHS</span><span class="p">:</span> <span class="n">List</span><span class="p">[</span><span class="nb">str</span><span class="p">]</span> <span class="o">=</span> <span class="p">[</span><span class="s2">&quot;mobilenet_v3_small_crop_orientation&quot;</span><span class="p">]</span>
<span class="n">ORIENTATION_ARCHS</span><span class="p">:</span> <span class="n">List</span><span class="p">[</span><span class="nb">str</span><span class="p">]</span> <span class="o">=</span> <span class="p">[</span><span class="s2">&quot;mobilenet_v3_small_crop_orientation&quot;</span><span class="p">,</span> <span class="s2">&quot;mobilenet_v3_small_page_orientation&quot;</span><span class="p">]</span>


<span class="k">def</span> <span class="nf">_orientation_predictor</span><span class="p">(</span><span class="n">arch</span><span class="p">:</span> <span class="nb">str</span><span class="p">,</span> <span class="n">pretrained</span><span class="p">:</span> <span class="nb">bool</span><span class="p">,</span> <span class="o">**</span><span class="n">kwargs</span><span class="p">:</span> <span class="n">Any</span><span class="p">)</span> <span class="o">-&gt;</span> <span class="n">OrientationPredictor</span><span class="p">:</span>
Expand All @@ -292,7 +292,7 @@ <h1>Source code for doctr.models.classification.zoo</h1><div class="highlight"><
<span class="n">_model</span> <span class="o">=</span> <span class="n">classification</span><span class="o">.</span><span class="vm">__dict__</span><span class="p">[</span><span class="n">arch</span><span class="p">](</span><span class="n">pretrained</span><span class="o">=</span><span class="n">pretrained</span><span class="p">)</span>
<span class="n">kwargs</span><span class="p">[</span><span class="s2">&quot;mean&quot;</span><span class="p">]</span> <span class="o">=</span> <span class="n">kwargs</span><span class="o">.</span><span class="n">get</span><span class="p">(</span><span class="s2">&quot;mean&quot;</span><span class="p">,</span> <span class="n">_model</span><span class="o">.</span><span class="n">cfg</span><span class="p">[</span><span class="s2">&quot;mean&quot;</span><span class="p">])</span>
<span class="n">kwargs</span><span class="p">[</span><span class="s2">&quot;std&quot;</span><span class="p">]</span> <span class="o">=</span> <span class="n">kwargs</span><span class="o">.</span><span class="n">get</span><span class="p">(</span><span class="s2">&quot;std&quot;</span><span class="p">,</span> <span class="n">_model</span><span class="o">.</span><span class="n">cfg</span><span class="p">[</span><span class="s2">&quot;std&quot;</span><span class="p">])</span>
<span class="n">kwargs</span><span class="p">[</span><span class="s2">&quot;batch_size&quot;</span><span class="p">]</span> <span class="o">=</span> <span class="n">kwargs</span><span class="o">.</span><span class="n">get</span><span class="p">(</span><span class="s2">&quot;batch_size&quot;</span><span class="p">,</span> <span class="mi">128</span><span class="p">)</span>
<span class="n">kwargs</span><span class="p">[</span><span class="s2">&quot;batch_size&quot;</span><span class="p">]</span> <span class="o">=</span> <span class="n">kwargs</span><span class="o">.</span><span class="n">get</span><span class="p">(</span><span class="s2">&quot;batch_size&quot;</span><span class="p">,</span> <span class="mi">128</span> <span class="k">if</span> <span class="s2">&quot;crop&quot;</span> <span class="ow">in</span> <span class="n">arch</span> <span class="k">else</span> <span class="mi">4</span><span class="p">)</span>
<span class="n">input_shape</span> <span class="o">=</span> <span class="n">_model</span><span class="o">.</span><span class="n">cfg</span><span class="p">[</span><span class="s2">&quot;input_shape&quot;</span><span class="p">][:</span><span class="o">-</span><span class="mi">1</span><span class="p">]</span> <span class="k">if</span> <span class="n">is_tf_available</span><span class="p">()</span> <span class="k">else</span> <span class="n">_model</span><span class="o">.</span><span class="n">cfg</span><span class="p">[</span><span class="s2">&quot;input_shape&quot;</span><span class="p">][</span><span class="mi">1</span><span class="p">:]</span>
<span class="n">predictor</span> <span class="o">=</span> <span class="n">OrientationPredictor</span><span class="p">(</span>
<span class="n">PreProcessor</span><span class="p">(</span><span class="n">input_shape</span><span class="p">,</span> <span class="n">preserve_aspect_ratio</span><span class="o">=</span><span class="kc">True</span><span class="p">,</span> <span class="n">symmetric_pad</span><span class="o">=</span><span class="kc">True</span><span class="p">,</span> <span class="o">**</span><span class="n">kwargs</span><span class="p">),</span> <span class="n">_model</span>
Expand All @@ -305,17 +305,44 @@ <h1>Source code for doctr.models.classification.zoo</h1><div class="highlight"><
<span class="k">def</span> <span class="nf">crop_orientation_predictor</span><span class="p">(</span>
<span class="n">arch</span><span class="p">:</span> <span class="nb">str</span> <span class="o">=</span> <span class="s2">&quot;mobilenet_v3_small_crop_orientation&quot;</span><span class="p">,</span> <span class="n">pretrained</span><span class="p">:</span> <span class="nb">bool</span> <span class="o">=</span> <span class="kc">False</span><span class="p">,</span> <span class="o">**</span><span class="n">kwargs</span><span class="p">:</span> <span class="n">Any</span>
<span class="p">)</span> <span class="o">-&gt;</span> <span class="n">OrientationPredictor</span><span class="p">:</span>
<span class="w"> </span><span class="sd">&quot;&quot;&quot;Orientation classification architecture.</span>
<span class="w"> </span><span class="sd">&quot;&quot;&quot;Crop orientation classification architecture.</span>

<span class="sd"> &gt;&gt;&gt; import numpy as np</span>
<span class="sd"> &gt;&gt;&gt; from doctr.models import crop_orientation_predictor</span>
<span class="sd"> &gt;&gt;&gt; model = crop_orientation_predictor(arch=&#39;classif_mobilenet_v3_small&#39;, pretrained=True)</span>
<span class="sd"> &gt;&gt;&gt; input_crop = (255 * np.random.rand(600, 800, 3)).astype(np.uint8)</span>
<span class="sd"> &gt;&gt;&gt; model = crop_orientation_predictor(arch=&#39;mobilenet_v3_small_crop_orientation&#39;, pretrained=True)</span>
<span class="sd"> &gt;&gt;&gt; input_crop = (255 * np.random.rand(256, 256, 3)).astype(np.uint8)</span>
<span class="sd"> &gt;&gt;&gt; out = model([input_crop])</span>

<span class="sd"> Args:</span>
<span class="sd"> ----</span>
<span class="sd"> arch: name of the architecture to use (e.g. &#39;mobilenet_v3_small&#39;)</span>
<span class="sd"> arch: name of the architecture to use (e.g. &#39;mobilenet_v3_small_crop_orientation&#39;)</span>
<span class="sd"> pretrained: If True, returns a model pre-trained on our recognition crops dataset</span>
<span class="sd"> **kwargs: keyword arguments to be passed to the OrientationPredictor</span>

<span class="sd"> Returns:</span>
<span class="sd"> -------</span>
<span class="sd"> OrientationPredictor</span>
<span class="sd"> &quot;&quot;&quot;</span>
<span class="k">return</span> <span class="n">_orientation_predictor</span><span class="p">(</span><span class="n">arch</span><span class="p">,</span> <span class="n">pretrained</span><span class="p">,</span> <span class="o">**</span><span class="n">kwargs</span><span class="p">)</span></div>



<div class="viewcode-block" id="page_orientation_predictor">
<a class="viewcode-back" href="../../../../modules/models.html#doctr.models.classification.page_orientation_predictor">[docs]</a>
<span class="k">def</span> <span class="nf">page_orientation_predictor</span><span class="p">(</span>
<span class="n">arch</span><span class="p">:</span> <span class="nb">str</span> <span class="o">=</span> <span class="s2">&quot;mobilenet_v3_small_page_orientation&quot;</span><span class="p">,</span> <span class="n">pretrained</span><span class="p">:</span> <span class="nb">bool</span> <span class="o">=</span> <span class="kc">False</span><span class="p">,</span> <span class="o">**</span><span class="n">kwargs</span><span class="p">:</span> <span class="n">Any</span>
<span class="p">)</span> <span class="o">-&gt;</span> <span class="n">OrientationPredictor</span><span class="p">:</span>
<span class="w"> </span><span class="sd">&quot;&quot;&quot;Page orientation classification architecture.</span>

<span class="sd"> &gt;&gt;&gt; import numpy as np</span>
<span class="sd"> &gt;&gt;&gt; from doctr.models import page_orientation_predictor</span>
<span class="sd"> &gt;&gt;&gt; model = page_orientation_predictor(arch=&#39;mobilenet_v3_small_page_orientation&#39;, pretrained=True)</span>
<span class="sd"> &gt;&gt;&gt; input_page = (255 * np.random.rand(512, 512, 3)).astype(np.uint8)</span>
<span class="sd"> &gt;&gt;&gt; out = model([input_page])</span>

<span class="sd"> Args:</span>
<span class="sd"> ----</span>
<span class="sd"> arch: name of the architecture to use (e.g. &#39;mobilenet_v3_small_page_orientation&#39;)</span>
<span class="sd"> pretrained: If True, returns a model pre-trained on our recognition crops dataset</span>
<span class="sd"> **kwargs: keyword arguments to be passed to the OrientationPredictor</span>

Expand Down
4 changes: 4 additions & 0 deletions latest/_sources/modules/models.rst.txt
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,8 @@ doctr.models.classification

.. autofunction:: doctr.models.classification.mobilenet_v3_small_crop_orientation

.. autofunction:: doctr.models.classification.mobilenet_v3_small_page_orientation

.. autofunction:: doctr.models.classification.magc_resnet31

.. autofunction:: doctr.models.classification.vit_s
Expand All @@ -41,6 +43,8 @@ doctr.models.classification

.. autofunction:: doctr.models.classification.crop_orientation_predictor

.. autofunction:: doctr.models.classification.page_orientation_predictor


doctr.models.detection
----------------------
Expand Down
4 changes: 4 additions & 0 deletions latest/genindex.html
Original file line number Diff line number Diff line change
Expand Up @@ -452,6 +452,8 @@ <h2>M</h2>
<li><a href="modules/models.html#doctr.models.classification.mobilenet_v3_small">mobilenet_v3_small() (in module doctr.models.classification)</a>
</li>
<li><a href="modules/models.html#doctr.models.classification.mobilenet_v3_small_crop_orientation">mobilenet_v3_small_crop_orientation() (in module doctr.models.classification)</a>
</li>
<li><a href="modules/models.html#doctr.models.classification.mobilenet_v3_small_page_orientation">mobilenet_v3_small_page_orientation() (in module doctr.models.classification)</a>
</li>
<li><a href="modules/models.html#doctr.models.classification.mobilenet_v3_small_r">mobilenet_v3_small_r() (in module doctr.models.classification)</a>
</li>
Expand Down Expand Up @@ -492,6 +494,8 @@ <h2>P</h2>
<table style="width: 100%" class="indextable genindextable"><tr>
<td style="width: 33%; vertical-align: top;"><ul>
<li><a href="modules/io.html#doctr.io.Page">Page (class in doctr.io)</a>
</li>
<li><a href="modules/models.html#doctr.models.classification.page_orientation_predictor">page_orientation_predictor() (in module doctr.models.classification)</a>
</li>
</ul></td>
<td style="width: 33%; vertical-align: top;"><ul>
Expand Down
Loading

0 comments on commit ad83079

Please sign in to comment.