diff options
Diffstat (limited to 'posts/2019-12-10-TensorFlow-Model-Prediction/index.html')
-rw-r--r-- | posts/2019-12-10-TensorFlow-Model-Prediction/index.html | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/posts/2019-12-10-TensorFlow-Model-Prediction/index.html b/posts/2019-12-10-TensorFlow-Model-Prediction/index.html index 5f73c10..bf1c102 100644 --- a/posts/2019-12-10-TensorFlow-Model-Prediction/index.html +++ b/posts/2019-12-10-TensorFlow-Model-Prediction/index.html @@ -6,4 +6,4 @@ </div></code></pre><p>After this we create a batch consisting of only one image</p><pre><code><div class="highlight"><span></span><span class="n">p</span> <span class="o">=</span> <span class="n">np</span><span class="o">.</span><span class="n">expand_dims</span><span class="p">(</span><span class="n">size_image</span><span class="p">,</span> <span class="mi">0</span><span class="p">)</span> </div></code></pre><p>We then convert this uint8 datatype to a float32 datatype</p><pre><code><div class="highlight"><span></span><span class="n">img</span> <span class="o">=</span> <span class="n">tf</span><span class="o">.</span><span class="n">cast</span><span class="p">(</span><span class="n">p</span><span class="p">,</span> <span class="n">tf</span><span class="o">.</span><span class="n">float32</span><span class="p">)</span> </div></code></pre><p>Finally we make the prediction</p><pre><code><div class="highlight"><span></span><span class="nb">print</span><span class="p">([</span><span class="s1">'Infected'</span><span class="p">,</span><span class="s1">'Uninfected'</span><span class="p">][</span><span class="n">np</span><span class="o">.</span><span class="n">argmax</span><span class="p">(</span><span class="n">model</span><span class="o">.</span><span class="n">predict</span><span class="p">(</span><span class="n">img</span><span class="p">))])</span> -</div></code></pre><p><code>Infected</code></p></div><span>Tagged with: </span><ul class="tag-list"><li><a href="/tags/tutorial">Tutorial</a></li><li><a href="/tags/tensorflow">Tensorflow</a></li><li><a href="/tags/codesnippet">Code-Snippet</a></li></ul><div id="disqus_thread"></div><script src="/assets/disqus.js"></script><noscript>Please enable JavaScript to view the comments</noscript></article></div><footer><p>Made with ❤️ using <a href="https://github.com/johnsundell/publish">Publish</a></p><p><a href="/feed.rss">RSS feed</a></p></footer></body></html>
\ No newline at end of file +</div></code></pre><p><code>Infected</code></p></div><span>Tagged with: </span><ul class="tag-list"><li><a href="/tags/tutorial">Tutorial</a></li><li><a href="/tags/tensorflow">Tensorflow</a></li><li><a href="/tags/codesnippet">Code-Snippet</a></li></ul></article></div><footer><p>Made with ❤️ using <a href="https://github.com/johnsundell/publish">Publish</a></p><p><a href="/feed.rss">RSS feed</a></p></footer></body></html>
\ No newline at end of file |