Skip to content

Commit 6ea095c

Browse files
authored
Add files via upload
1 parent fb92953 commit 6ea095c

31 files changed

+3828
-3
lines changed
Binary file not shown.
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
MIT License
2+
3+
Copyright (c) 2018 Udacity
4+
5+
Permission is hereby granted, free of charge, to any person obtaining a copy
6+
of this software and associated documentation files (the "Software"), to deal
7+
in the Software without restriction, including without limitation the rights
8+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9+
copies of the Software, and to permit persons to whom the Software is
10+
furnished to do so, subject to the following conditions:
11+
12+
The above copyright notice and this permission notice shall be included in all
13+
copies or substantial portions of the Software.
14+
15+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21+
SOFTWARE.

Image Classifier to Identify Dog Breeds/README.md

Lines changed: 27 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,28 @@
1-
# Image Classifier to Identify Dog Breeds
1+
# AIPND-revision
2+
This repository contains _REVISED_ code and associated files for the AI Programming with Python Nanodegree program. This repository consists of a number of tutorial notebooks for various coding exercises and programming labs that will be used to supplement the lessons of the course.
3+
4+
## Table Of Contents
5+
6+
### Tutorial Notebooks
7+
* No revisions
8+
9+
### Programming Project
10+
* [Intro to Python Project - Classifying Pet Images:](https://github.com/udacity/AIPND-revision/tree/master/intropyproject-classify-pet-images "Classifying Pet Images Project") Determine which CNN architecture model works best at classifying images of dogs and their breeds.
11+
12+
### NumPy and Pandas Mini-Projects
13+
* No revisions
14+
15+
### Matplotlib
16+
* No revisions
17+
18+
### Quiz Notes
19+
* [Notes:](https://github.com/udacity/AIPND-revision/tree/master/notes "Notes") This directory contains more information about certain quizzes that are testing more challenging concepts. Additionally, one will find the [Frequently Asked Questions](https://github.com/udacity/AIPND-revision/blob/master/notes/project_intro-to-python.md) for the _Intro to Python Project_. Click on the filename to view the contents of the notes on a _quiz_ or the _Intro to Python Project_.
20+
21+
## Dependencies
22+
23+
Each directory has a `requirements.txt` describing the minimal dependencies required to run the notebooks in that directory.
24+
25+
### pip
26+
27+
To install these dependencies with pip, you can issue `pip3 install -r requirements.txt`.
228

3-
![AI Programming with python Nanodegree](https://cdn-images-1.medium.com/freeze/max/1000/1*LgS-4aqPaCjPLF7YDyzdbw.png?q=20)
4-
PROJECT WORK
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
# Submission and extra information
2+
3+
* I added a section to check_images to print out the final results, in a format that can easily be matched to the tables provided.
4+
5+
* For the uploaded images section, I added an image of a Spaniel. AlexNet failed to identify the breed correctly, thinking it was a golden retriever (very similar).
6+
7+
* AlexNet was the fastest classifier (3 seconds), followed by ResNet (8 seconds), and VGG was the slowest at 29 seconds.
Lines changed: 78 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,78 @@
1+
#!/usr/bin/env python3
2+
# -*- coding: utf-8 -*-
3+
# */AIPND-revision/intropyproject-classify-pet-images/adjust_results4_isadog.py
4+
#
5+
# PROGRAMMER: JAYARAJ J
6+
# DATE CREATED: 18 April 2020
7+
# REVISED DATE:
8+
# PURPOSE: Create a function adjust_results4_isadog that adjusts the results
9+
# dictionary to indicate whether or not the pet image label is of-a-dog,
10+
# and to indicate whether or not the classifier image label is of-a-dog.
11+
# All dog labels from both the pet images and the classifier function
12+
# will be found in the dognames.txt file. We recommend reading all the
13+
# dog names in dognames.txt into a dictionary where the 'key' is the
14+
# dog name (from dognames.txt) and the 'value' is one. If a label is
15+
# found to exist within this dictionary of dog names then the label
16+
# is of-a-dog, otherwise the label isn't of a dog. Alternatively one
17+
# could also read all the dog names into a list and then if the label
18+
# is found to exist within this list - the label is of-a-dog, otherwise
19+
# the label isn't of a dog.
20+
# This function inputs:
21+
# -The results dictionary as results_dic within adjust_results4_isadog
22+
# function and results for the function call within main.
23+
# -The text file with dog names as dogfile within adjust_results4_isadog
24+
# function and in_arg.dogfile for the function call within main.
25+
# This function uses the extend function to add items to the list
26+
# that's the 'value' of the results dictionary. You will be adding the
27+
# whether or not the pet image label is of-a-dog as the item at index
28+
# 3 of the list and whether or not the classifier label is of-a-dog as
29+
# the item at index 4 of the list. Note we recommend setting the values
30+
# at indices 3 & 4 to 1 when the label is of-a-dog and to 0 when the
31+
# label isn't a dog.
32+
#
33+
##
34+
35+
def adjust_results4_isadog(results_dic, dogfile):
36+
"""
37+
Adjusts the results dictionary to determine if classifier correctly
38+
classified images 'as a dog' or 'not a dog' especially when not a match.
39+
Demonstrates if model architecture correctly classifies dog images even if
40+
it gets dog breed wrong (not a match).
41+
Parameters:
42+
results_dic - Dictionary with 'key' as image filename and 'value' as a
43+
List. Where the list will contain the following items:
44+
index 0 = pet image label (string)
45+
index 1 = classifier label (string)
46+
index 2 = 1/0 (int) where 1 = match between pet image
47+
and classifer labels and 0 = no match between labels
48+
------ where index 3 & index 4 are added by this function -----
49+
NEW - index 3 = 1/0 (int) where 1 = pet image 'is-a' dog and
50+
0 = pet Image 'is-NOT-a' dog.
51+
NEW - index 4 = 1/0 (int) where 1 = Classifier classifies image
52+
'as-a' dog and 0 = Classifier classifies image
53+
'as-NOT-a' dog.
54+
dogfile - A text file that contains names of all dogs from the classifier
55+
function and dog names from the pet image files. This file has
56+
one dog name per line dog names are all in lowercase with
57+
spaces separating the distinct words of the dog name. Dog names
58+
from the classifier function can be a string of dog names separated
59+
by commas when a particular breed of dog has multiple dog names
60+
associated with that breed (ex. maltese dog, maltese terrier,
61+
maltese) (string - indicates text file's filename)
62+
Returns:
63+
None - results_dic is mutable data type so no return needed.
64+
"""
65+
dognames_dic = {}
66+
with open(dogfile) as f:
67+
dogs = f.readlines()
68+
69+
for dog in dogs:
70+
dog = dog.rstrip()
71+
dognames_dic[dog] = 1
72+
73+
for img_file in results_dic:
74+
img_is_a_dog = 1 if results_dic[img_file][0] in dognames_dic else 0
75+
pred_is_a_dog = 1 if results_dic[img_file][1] in dognames_dic else 0
76+
results_dic[img_file].append(img_is_a_dog)
77+
results_dic[img_file].append(pred_is_a_dog)
78+
return None

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy