summaryrefslogtreecommitdiff
path: root/docs/posts/2019-12-08-Image-Classifier-Tensorflow.html
diff options
context:
space:
mode:
authorNavan Chauhan <navanchauhan@gmail.com>2024-04-03 09:36:58 -0600
committerGitHub <noreply@github.com>2024-04-03 09:36:58 -0600
commit84ad5d8360fb0683f12f9bae8f29d6b36964dde3 (patch)
tree64bb1d9675ac3d6a3604d512311a754b08c53be2 /docs/posts/2019-12-08-Image-Classifier-Tensorflow.html
parent0e4b5fcc164cd8432678bdffd58b8c123acee186 (diff)
parentd00b2da99ef2d498074a6e4eb8d80995cdfc4476 (diff)
Merge branch 'vanilla-ssg' into dependabot/pip/jinja2-3.1.3
Diffstat (limited to 'docs/posts/2019-12-08-Image-Classifier-Tensorflow.html')
-rw-r--r--docs/posts/2019-12-08-Image-Classifier-Tensorflow.html91
1 files changed, 62 insertions, 29 deletions
diff --git a/docs/posts/2019-12-08-Image-Classifier-Tensorflow.html b/docs/posts/2019-12-08-Image-Classifier-Tensorflow.html
index a8491ee..c9ee1e0 100644
--- a/docs/posts/2019-12-08-Image-Classifier-Tensorflow.html
+++ b/docs/posts/2019-12-08-Image-Classifier-Tensorflow.html
@@ -2,14 +2,27 @@
<html lang="en">
<head>
- <link rel="stylesheet" href="https://unpkg.com/latex.css/style.min.css" />
+ <meta http-equiv="X-UA-Compatible" content="IE=edge">
+ <meta http-equiv="content-type" content="text/html; charset=utf-8">
+ <meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1">
+ <meta name="theme-color" content="#6a9fb5">
+
+ <title>Creating a Custom Image Classifier using Tensorflow 2.x and Keras for Detecting Malaria</title>
+
+ <!--
+ <link rel="stylesheet" href="https://unpkg.com/latex.css/style.min.css" />
+ -->
+
+ <link rel="stylesheet" href="/assets/c-hyde.css" />
+
+ <link rel="stylesheet" href="http://fonts.googleapis.com/css?family=PT+Sans:400,400italic,700|Abril+Fatface">
+
<link rel="stylesheet" href="/assets/main.css" />
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
- <title>Creating a Custom Image Classifier using Tensorflow 2.x and Keras for Detecting Malaria</title>
<meta name="og:site_name" content="Navan Chauhan" />
<link rel="canonical" href="https://web.navan.dev/posts/2019-12-08-Image-Classifier-Tensorflow.html" />
- <meta name="twitter:url" content="https://web.navan.dev/posts/2019-12-08-Image-Classifier-Tensorflow.html />
+ <meta name="twitter:url" content="https://web.navan.dev/posts/2019-12-08-Image-Classifier-Tensorflow.html" />
<meta name="og:url" content="https://web.navan.dev/posts/2019-12-08-Image-Classifier-Tensorflow.html" />
<meta name="twitter:title" content="Creating a Custom Image Classifier using Tensorflow 2.x and Keras for Detecting Malaria" />
<meta name="og:title" content="Creating a Custom Image Classifier using Tensorflow 2.x and Keras for Detecting Malaria" />
@@ -26,28 +39,47 @@
<script data-goatcounter="https://navanchauhan.goatcounter.com/count"
async src="//gc.zgo.at/count.js"></script>
<script defer data-domain="web.navan.dev" src="https://plausible.io/js/plausible.js"></script>
- <link rel="manifest" href="manifest.json" />
+ <link rel="manifest" href="/manifest.json" />
</head>
-<body>
- <center><nav style="display: block;">
-|
-<a href="/">home</a> |
-<a href="/about/">about/links</a> |
-<a href="/posts/">posts</a> |
-<!--<a href="/publications/">publications</a> |-->
-<!--<a href="/repo/">iOS repo</a> |-->
-<a href="/feed.rss">RSS Feed</a> |
-</nav>
-</center>
-
-<main>
+<body class="theme-base-0d">
+ <div class="sidebar">
+ <div class="container sidebar-sticky">
+ <div class="sidebar-about">
+ <h1><a href="/">Navan</a></h1>
+ <p class="lead" id="random-lead">Alea iacta est.</p>
+ </div>
+
+ <ul class="sidebar-nav">
+ <li><a class="sidebar-nav-item" href="/about/">about/links</a></li>
+ <li><a class="sidebar-nav-item" href="/posts/">posts</a></li>
+ <li><a class="sidebar-nav-item" href="/3D-Designs/">3D designs</a></li>
+ <li><a class="sidebar-nav-item" href="/feed.rss">RSS Feed</a></li>
+ <li><a class="sidebar-nav-item" href="/colophon/">colophon</a></li>
+ </ul>
+ <div class="copyright"><p>&copy; 2019-2024. Navan Chauhan <br> <a href="/feed.rss">RSS</a></p></div>
+ </div>
+</div>
- <h1>Creating a Custom Image Classifier using Tensorflow 2.x and Keras for Detecting Malaria</h1>
+<script>
+let phrases = [
+ "Something Funny", "Veni, vidi, vici", "Alea iacta est", "In vino veritas", "Acta, non verba", "Castigat ridendo mores",
+ "Cui bono?", "Memento vivere", "अहम् ब्रह्मास्मि", "अनुगच्छतु प्रवाहं", "चरन्मार्गान्विजानाति", "coq de cheval", "我愛啤酒"
+ ];
+
+let new_phrase = phrases[Math.floor(Math.random()*phrases.length)];
+
+let lead = document.getElementById("random-lead");
+lead.innerText = new_phrase;
+</script>
+ <div class="content container">
+
+ <div class="post">
+ <h1 id="creating-a-custom-image-classifier-using-tensorflow-2x-and-keras-for-detecting-malaria">Creating a Custom Image Classifier using Tensorflow 2.x and Keras for Detecting Malaria</h1>
<p><strong>Done during Google Code-In. Org: Tensorflow.</strong></p>
-<h2>Imports</h2>
+<h2 id="imports">Imports</h2>
<div class="codehilite">
<pre><span></span><code><span class="o">%</span><span class="n">tensorflow_version</span> <span class="mf">2.</span><span class="n">x</span> <span class="c1">#This is for telling Colab that you want to use TF 2.0, ignore if running on local machine</span>
@@ -65,9 +97,9 @@
</code></pre>
</div>
-<h2>Dataset</h2>
+<h2 id="dataset">Dataset</h2>
-<h3>Fetching the Data</h3>
+<h3 id="fetching-the-data">Fetching the Data</h3>
<div class="codehilite">
<pre><span></span><code><span class="err">!</span><span class="n">wget</span> <span class="n">ftp</span><span class="p">:</span><span class="o">//</span><span class="n">lhcftp</span><span class="o">.</span><span class="n">nlm</span><span class="o">.</span><span class="n">nih</span><span class="o">.</span><span class="n">gov</span><span class="o">/</span><span class="n">Open</span><span class="o">-</span><span class="n">Access</span><span class="o">-</span><span class="n">Datasets</span><span class="o">/</span><span class="n">Malaria</span><span class="o">/</span><span class="n">cell_images</span><span class="o">.</span><span class="n">zip</span>
@@ -75,7 +107,7 @@
</code></pre>
</div>
-<h3>Processing the Data</h3>
+<h3 id="processing-the-data">Processing the Data</h3>
<p>We resize all the images as 50x50 and add the numpy array of that image as well as their label names (Infected or Not) to common arrays.</p>
@@ -107,7 +139,7 @@
</code></pre>
</div>
-<h3>Splitting Data</h3>
+<h3 id="splitting-data">Splitting Data</h3>
<div class="codehilite">
<pre><span></span><code><span class="n">df</span> <span class="o">=</span> <span class="n">np</span><span class="o">.</span><span class="n">array</span><span class="p">(</span><span class="n">data</span><span class="p">)</span>
@@ -124,9 +156,9 @@ y_train=y_train[s]
X_train = X_train/255.0
</code></pre>
-<h2>Model</h2>
+<h2 id="model">Model</h2>
-<h3>Creating Model</h3>
+<h3 id="creating-model">Creating Model</h3>
<p>By creating a sequential model, we create a linear stack of layers.</p>
@@ -149,7 +181,7 @@ X_train = X_train/255.0
</code></pre>
</div>
-<h3>Compiling Model</h3>
+<h3 id="compiling-model">Compiling Model</h3>
<p>We use the Adam optimiser as it is an adaptive learning rate optimisation algorithm that's been designed specifically for <em>training</em> deep neural networks, which means it changes its learning rate automatically to get the best results</p>
@@ -160,7 +192,7 @@ X_train = X_train/255.0
</code></pre>
</div>
-<h3>Training Model</h3>
+<h3 id="training-model">Training Model</h3>
<p>We train the model for 10 epochs on the training data and then validate it using the testing data</p>
@@ -194,7 +226,7 @@ X_train = X_train/255.0
</code></pre>
</div>
-<h3>Results</h3>
+<h3 id="results">Results</h3>
<div class="codehilite">
<pre><span></span><code><span class="n">accuracy</span> <span class="o">=</span> <span class="n">history</span><span class="o">.</span><span class="n">history</span><span class="p">[</span><span class="s1">&#39;accuracy&#39;</span><span class="p">][</span><span class="o">-</span><span class="mi">1</span><span class="p">]</span><span class="o">*</span><span class="mi">100</span>
@@ -223,14 +255,15 @@ X_train = X_train/255.0
<p><a rel="noopener" target="_blank" href="https://colab.research.google.com/drive/1ZswDsxLwYZEnev89MzlL5Lwt6ut7iwp-" title="Colab Notebook">Link to Colab Notebook</a></p>
+ </div>
<blockquote>If you have scrolled this far, consider subscribing to my mailing list <a href="https://listmonk.navan.dev/subscription/form">here.</a> You can subscribe to either a specific type of post you are interested in, or subscribe to everything with the "Everything" list.</blockquote>
<script data-isso="https://comments.navan.dev/"
src="https://comments.navan.dev/js/embed.min.js"></script>
<section id="isso-thread">
<noscript>Javascript needs to be activated to view comments.</noscript>
</section>
-</main>
+ </div>
<script src="assets/manup.min.js"></script>
<script src="/pwabuilder-sw-register.js"></script>
</body>