Skip to content

Commit 23ae744

Browse files
Discussing the particular qualities of the new test images
1 parent c9ec5fb commit 23ae744

File tree

6 files changed

+1559
-6
lines changed

6 files changed

+1559
-6
lines changed

.ipynb_checkpoints/Traffic_Sign_Classifier-checkpoint.ipynb

+1,503
Large diffs are not rendered by default.

README.md

+13-1
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,8 @@ I'll explain each step in details below.
3232
---
3333
## Step 1: Load The Data
3434

35+
Download the dataset from [here](https://d17h27t6h515a5.cloudfront.net/topher/2017/February/5898cd6f_traffic-signs-data/traffic-signs-data.zip). This is a pickled dataset in which we've already resized the images to 32x32.
36+
3537
We already have three `.p` files of 32x32 resized images:
3638
- `train.p`: The training set.
3739
- `test.p`: The testing set.
@@ -387,7 +389,11 @@ Number of new testing examples: 5
387389
</figcaption>
388390
</figure>
389391

390-
Now we'll input these 5 images to the VGGNet model and output the top 5 softmax proabilities of each prediction.
392+
These test images include some easy to predict signs, and other signs are considered hard for the model to predict.
393+
394+
For instance, we have easy to predict signs like the "Stop" and the "No entry". The two signs are clear and belong to classes where the model can predict with high accuracy.
395+
396+
On the other hand, we have signs belong to classes where has poor accuracy, like the "Speed limit" sign, because as stated above it turns out that the various speed limits are sometimes misclassified among themselves, and the "Pedestrians" sign, because traffic signs with traingular shape are misclassified among themselves.
391397

392398
<figure>
393399
<img src="./traffic-signs-data/Screenshots/TopSoft.png" width="1072" alt="Combined Image" />
@@ -396,6 +402,12 @@ Now we'll input these 5 images to the VGGNet model and output the top 5 softmax
396402
</figcaption>
397403
</figure>
398404

405+
As we can notice from the top 5 softmax probabilities, the model has very high confidence (100%) when it comes to predict simple signs, like the "Stop" and the "No entry" sign, and even high confidence when predicting simple triangular signs in a very clear image, like the "Yield" sign.
406+
407+
On the other hand, the model's confidence slightly reduces with more complex triangular sign in a "pretty noisy" image, in the "Pedestrian" sign image, we have a triangular sign with a shape inside it, and the images copyrights adds some noise to the image, the model was able to predict the true class, but with 80% confidence.
408+
409+
And in the "Speed limit" sign, we can observe that the model accurately predicted that it's a "Speed limit" sign, but was somehow confused between the different speed limits. However, it predicted the true class at the end.
410+
399411
The VGGNet model was able to predict the right class for each of the 5 new test images. Test Accuracy = 100.0%.
400412
In all cases, the model was very certain (80% - 100%).
401413

Traffic_Sign_Classifier.html

+18-3
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<!DOCTYPE html>
22
<html>
33
<head><meta charset="utf-8" />
4-
<title>Traffic_Sign_Classifier</title><script src="https://cdnjs.cloudflare.com/ajax/libs/require.js/2.1.10/require.min.js"></script>
4+
<title>Traffic_Sign_Classifier</title><script src="https://unpkg.com/[email protected].*/dist/embed.js"></script><script src="https://cdnjs.cloudflare.com/ajax/libs/require.js/2.1.10/require.min.js"></script>
55
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/2.0.3/jquery.min.js"></script>
66

77
<style type="text/css">
@@ -11864,6 +11864,7 @@ <h2 id="Step-1:-Load-The-Data">Step 1: Load The Data<a class="anchor-link" href=
1186411864
</div>
1186511865
<div class="inner_cell">
1186611866
<div class="text_cell_render border-box-sizing rendered_html">
11867+
<p>Download the dataset from <a href="https://d17h27t6h515a5.cloudfront.net/topher/2017/February/5898cd6f_traffic-signs-data/traffic-signs-data.zip">here</a>. This is a pickled dataset in which we've already resized the images to 32x32.</p>
1186711868
<p>We already have three <code>.p</code> files of 32x32 resized images:</p>
1186811869
<ul>
1186911870
<li><code>train.p</code>: The training set.</li>
@@ -16306,7 +16307,7 @@ <h2 id="Step-5:-Testing-the-Model-using-the-Test-Set">Step 5: Testing the Model
1630616307
</div>
1630716308
<div class="cell border-box-sizing code_cell rendered">
1630816309
<div class="input">
16309-
<div class="prompt input_prompt">In&nbsp;[29]:</div>
16310+
<div class="prompt input_prompt">In&nbsp;[42]:</div>
1631016311
<div class="inner_cell">
1631116312
<div class="input_area">
1631216313
<div class=" highlight hl-ipython3"><pre><span></span><span class="k">with</span> <span class="n">tf</span><span class="o">.</span><span class="n">Session</span><span class="p">()</span> <span class="k">as</span> <span class="n">sess</span><span class="p">:</span>
@@ -16624,7 +16625,7 @@ <h2 id="Step-6:-Testing-the-Model-on-New-Images">Step 6: Testing the Model on Ne
1662416625
<div class="input_area">
1662516626
<div class=" highlight hl-ipython3"><pre><span></span><span class="n">plt</span><span class="o">.</span><span class="n">figure</span><span class="p">(</span><span class="n">figsize</span><span class="o">=</span><span class="p">(</span><span class="mi">15</span><span class="p">,</span> <span class="mi">16</span><span class="p">))</span>
1662616627
<span class="k">for</span> <span class="n">i</span> <span class="ow">in</span> <span class="nb">range</span><span class="p">(</span><span class="nb">len</span><span class="p">(</span><span class="n">new_test_images</span><span class="p">)):</span>
16627-
<span class="n">plt</span><span class="o">.</span><span class="n">subplot</span><span class="p">(</span><span class="mi">3</span><span class="p">,</span> <span class="mi">5</span><span class="p">,</span> <span class="n">i</span><span class="o">+</span><span class="mi">1</span><span class="p">)</span>
16628+
<span class="n">plt</span><span class="o">.</span><span class="n">subplot</span><span class="p">(</span><span class="mi">2</span><span class="p">,</span> <span class="mi">5</span><span class="p">,</span> <span class="n">i</span><span class="o">+</span><span class="mi">1</span><span class="p">)</span>
1662816629
<span class="n">plt</span><span class="o">.</span><span class="n">imshow</span><span class="p">(</span><span class="n">new_test_images</span><span class="p">[</span><span class="n">i</span><span class="p">])</span>
1662916630
<span class="n">plt</span><span class="o">.</span><span class="n">xlabel</span><span class="p">(</span><span class="n">signs</span><span class="p">[</span><span class="n">new_IDs</span><span class="p">[</span><span class="n">i</span><span class="p">]])</span>
1663016631
<span class="n">plt</span><span class="o">.</span><span class="n">ylabel</span><span class="p">(</span><span class="s2">&quot;New testing image&quot;</span><span class="p">)</span>
@@ -17171,6 +17172,17 @@ <h2 id="Step-6:-Testing-the-Model-on-New-Images">Step 6: Testing the Model on Ne
1717117172
</div>
1717217173
</div>
1717317174

17175+
</div>
17176+
<div class="cell border-box-sizing text_cell rendered"><div class="prompt input_prompt">
17177+
</div>
17178+
<div class="inner_cell">
17179+
<div class="text_cell_render border-box-sizing rendered_html">
17180+
<p>These test images include some easy to predict signs, and other signs are considered hard for the model to predict.</p>
17181+
<p>For instance, we have easy to predict signs like the "Stop" and the "No entry". The two signs are clear and belong to classes where the model can predict with high accuracy.</p>
17182+
<p>On the other hand, we have signs belong to classes where has poor accuracy, like the "Speed limit" sign, because as stated above it turns out that the various speed limits are sometimes misclassified among themselves, and the "Pedestrians" sign, because traffic signs with traingular shape are misclassified among themselves.</p>
17183+
17184+
</div>
17185+
</div>
1717417186
</div>
1717517187
<div class="cell border-box-sizing code_cell rendered">
1717617188
<div class="input">
@@ -18338,6 +18350,9 @@ <h2 id="Step-6:-Testing-the-Model-on-New-Images">Step 6: Testing the Model on Ne
1833818350
</div>
1833918351
<div class="inner_cell">
1834018352
<div class="text_cell_render border-box-sizing rendered_html">
18353+
<p>As we can notice from the top 5 softmax probabilities, the model has very high confidence (100%) when it comes to predict simple signs, like the "Stop" and the "No entry" sign, and even high confidence when predicting simple triangular signs in a very clear image, like the "Yield" sign.</p>
18354+
<p>On the other hand, the model's confidence slightly reduces with more complex triangular sign in a "pretty noisy" image, in the "Pedestrian" sign image, we have a triangular sign with a shape inside it, and the images copyrights adds some noise to the image, the model was able to predict the true class, but with 80% confidence.</p>
18355+
<p>And in the "Speed limit" sign, we can observe that the model accurately predicted that it's a "Speed limit" sign, but was somehow confused between the different speed limits. However, it predicted the true class at the end.</p>
1834118356
<p>The VGGNet model was able to predict the right class for each of the 5 new test images. Test Accuracy = 100.0%.
1834218357
In all cases, the model was very certain (80% - 100%).</p>
1834318358

Traffic_Sign_Classifier.ipynb

+25-2
Original file line numberDiff line numberDiff line change
@@ -80,6 +80,8 @@
8080
"cell_type": "markdown",
8181
"metadata": {},
8282
"source": [
83+
"Download the dataset from [here](https://d17h27t6h515a5.cloudfront.net/topher/2017/February/5898cd6f_traffic-signs-data/traffic-signs-data.zip). This is a pickled dataset in which we've already resized the images to 32x32.\n",
84+
"\n",
8385
"We already have three `.p` files of 32x32 resized images:\n",
8486
"- `train.p`: The training set.\n",
8587
"- `test.p`: The testing set.\n",
@@ -1343,7 +1345,7 @@
13431345
"source": [
13441346
"plt.figure(figsize=(15, 16))\n",
13451347
"for i in range(len(new_test_images)):\n",
1346-
" plt.subplot(3, 5, i+1)\n",
1348+
" plt.subplot(2, 5, i+1)\n",
13471349
" plt.imshow(new_test_images[i])\n",
13481350
" plt.xlabel(signs[new_IDs[i]])\n",
13491351
" plt.ylabel(\"New testing image\")\n",
@@ -1353,6 +1355,17 @@
13531355
"plt.show()"
13541356
]
13551357
},
1358+
{
1359+
"cell_type": "markdown",
1360+
"metadata": {},
1361+
"source": [
1362+
"These test images include some easy to predict signs, and other signs are considered hard for the model to predict.\n",
1363+
"\n",
1364+
"For instance, we have easy to predict signs like the \"Stop\" and the \"No entry\". The two signs are clear and belong to classes where the model can predict with high accuracy.\n",
1365+
"\n",
1366+
"On the other hand, we have signs belong to classes where has poor accuracy, like the \"Speed limit\" sign, because as stated above it turns out that the various speed limits are sometimes misclassified among themselves, and the \"Pedestrians\" sign, because traffic signs with traingular shape are misclassified among themselves."
1367+
]
1368+
},
13561369
{
13571370
"cell_type": "code",
13581371
"execution_count": 40,
@@ -1429,8 +1442,14 @@
14291442
"cell_type": "markdown",
14301443
"metadata": {},
14311444
"source": [
1445+
"As we can notice from the top 5 softmax probabilities, the model has very high confidence (100%) when it comes to predict simple signs, like the \"Stop\" and the \"No entry\" sign, and even high confidence when predicting simple triangular signs in a very clear image, like the \"Yield\" sign.\n",
1446+
"\n",
1447+
"On the other hand, the model's confidence slightly reduces with more complex triangular sign in a \"pretty noisy\" image, in the \"Pedestrian\" sign image, we have a triangular sign with a shape inside it, and the images copyrights adds some noise to the image, the model was able to predict the true class, but with 80% confidence.\n",
1448+
"\n",
1449+
"And in the \"Speed limit\" sign, we can observe that the model accurately predicted that it's a \"Speed limit\" sign, but was somehow confused between the different speed limits. However, it predicted the true class at the end.\n",
1450+
"\n",
14321451
"The VGGNet model was able to predict the right class for each of the 5 new test images. Test Accuracy = 100.0%.\n",
1433-
"In all cases, the model was very certain (80% - 100%). "
1452+
"In all cases, the model was very certain (80% - 100%)."
14341453
]
14351454
},
14361455
{
@@ -1473,6 +1492,10 @@
14731492
"nbconvert_exporter": "python",
14741493
"pygments_lexer": "ipython3",
14751494
"version": "3.5.2"
1495+
},
1496+
"widgets": {
1497+
"state": {},
1498+
"version": "1.1.2"
14761499
}
14771500
},
14781501
"nbformat": 4,
71.4 KB
Loading
19.6 KB
Loading

0 commit comments

Comments
 (0)