├── __pycache__ ├── README.md └── __pycache__ │ ├── classifier.cpython-36.pyc │ ├── print_results.cpython-36.pyc │ ├── classify_images.cpython-36.pyc │ ├── get_input_args.cpython-36.pyc │ ├── get_pet_labels.cpython-36.pyc │ ├── adjust_results4_isadog.cpython-36.pyc │ ├── calculates_results_stats.cpython-36.pyc │ └── print_functions_for_lab_checks.cpython-36.pyc ├── pet_images ├── README.md └── pet_images │ ├── cat_01.jpg │ ├── cat_02.jpg │ ├── cat_07.jpg │ ├── gecko_02.jpg │ ├── gecko_80.jpg │ ├── skunk_029.jpg │ ├── Boxer_02426.jpg │ ├── Rabbit_002.jpg │ ├── Basenji_00963.jpg │ ├── Basenji_00974.jpg │ ├── Beagle_01125.jpg │ ├── Beagle_01141.jpg │ ├── Beagle_01170.jpg │ ├── Collie_03797.jpg │ ├── Poodle_07927.jpg │ ├── Poodle_07956.jpg │ ├── polar_bear_04.jpg │ ├── Dalmatian_04017.jpg │ ├── Dalmatian_04037.jpg │ ├── Dalmatian_04068.jpg │ ├── Great_dane_05320.jpg │ ├── fox_squirrel_01.jpg │ ├── Basset_hound_01034.jpg │ ├── Saint_bernard_08010.jpg │ ├── Saint_bernard_08036.jpg │ ├── great_horned_owl_02.jpg │ ├── Boston_terrier_02259.jpg │ ├── Boston_terrier_02285.jpg │ ├── Boston_terrier_02303.jpg │ ├── Cocker_spaniel_03750.jpg │ ├── Great_pyrenees_05367.jpg │ ├── Great_pyrenees_05435.jpg │ ├── Golden_retriever_05182.jpg │ ├── Golden_retriever_05195.jpg │ ├── Golden_retriever_05223.jpg │ ├── Golden_retriever_05257.jpg │ ├── German_shepherd_dog_04890.jpg │ ├── German_shepherd_dog_04931.jpg │ ├── Miniature_schnauzer_06884.jpg │ └── German_shorthaired_pointer_04986.jpg ├── uploaded_images ├── README.md └── uploaded_images │ ├── Dog_01.jpg │ ├── Dog_02.jpg │ ├── gecko_02.jpg │ └── Coffee_mug_01.jpg ├── run_models_batch.sh ├── run_models_batch_uploaded.sh ├── test_classifier.py ├── README.md ├── check_images.txt ├── get_input_args.py ├── vgg_uploaded-images.txt ├── resnet_uploaded-images.txt ├── alexnet_uploaded-images.txt ├── classifier.py ├── get_pet_labels.py ├── check_images.py ├── classify_images.py ├── dognames.txt ├── print_results.py ├── adjust_results4_isadog.py ├── calculates_results_stats.py ├── vgg_pet-images.txt ├── resnet_pet-images.txt ├── alexnet_pet-images.txt ├── print_functions_for_lab_checks.py └── imagenet1000_clsid_to_human.txt /__pycache__/README.md: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /pet_images/README.md: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /uploaded_images/README.md: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /pet_images/pet_images/cat_01.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/qudus4l/Image-Classifier-to-Identify-Dog-Breeds/HEAD/pet_images/pet_images/cat_01.jpg -------------------------------------------------------------------------------- /pet_images/pet_images/cat_02.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/qudus4l/Image-Classifier-to-Identify-Dog-Breeds/HEAD/pet_images/pet_images/cat_02.jpg -------------------------------------------------------------------------------- /pet_images/pet_images/cat_07.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/qudus4l/Image-Classifier-to-Identify-Dog-Breeds/HEAD/pet_images/pet_images/cat_07.jpg -------------------------------------------------------------------------------- /pet_images/pet_images/gecko_02.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/qudus4l/Image-Classifier-to-Identify-Dog-Breeds/HEAD/pet_images/pet_images/gecko_02.jpg -------------------------------------------------------------------------------- /pet_images/pet_images/gecko_80.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/qudus4l/Image-Classifier-to-Identify-Dog-Breeds/HEAD/pet_images/pet_images/gecko_80.jpg -------------------------------------------------------------------------------- /pet_images/pet_images/skunk_029.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/qudus4l/Image-Classifier-to-Identify-Dog-Breeds/HEAD/pet_images/pet_images/skunk_029.jpg -------------------------------------------------------------------------------- /pet_images/pet_images/Boxer_02426.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/qudus4l/Image-Classifier-to-Identify-Dog-Breeds/HEAD/pet_images/pet_images/Boxer_02426.jpg -------------------------------------------------------------------------------- /pet_images/pet_images/Rabbit_002.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/qudus4l/Image-Classifier-to-Identify-Dog-Breeds/HEAD/pet_images/pet_images/Rabbit_002.jpg -------------------------------------------------------------------------------- /pet_images/pet_images/Basenji_00963.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/qudus4l/Image-Classifier-to-Identify-Dog-Breeds/HEAD/pet_images/pet_images/Basenji_00963.jpg -------------------------------------------------------------------------------- /pet_images/pet_images/Basenji_00974.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/qudus4l/Image-Classifier-to-Identify-Dog-Breeds/HEAD/pet_images/pet_images/Basenji_00974.jpg -------------------------------------------------------------------------------- /pet_images/pet_images/Beagle_01125.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/qudus4l/Image-Classifier-to-Identify-Dog-Breeds/HEAD/pet_images/pet_images/Beagle_01125.jpg -------------------------------------------------------------------------------- /pet_images/pet_images/Beagle_01141.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/qudus4l/Image-Classifier-to-Identify-Dog-Breeds/HEAD/pet_images/pet_images/Beagle_01141.jpg -------------------------------------------------------------------------------- /pet_images/pet_images/Beagle_01170.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/qudus4l/Image-Classifier-to-Identify-Dog-Breeds/HEAD/pet_images/pet_images/Beagle_01170.jpg -------------------------------------------------------------------------------- /pet_images/pet_images/Collie_03797.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/qudus4l/Image-Classifier-to-Identify-Dog-Breeds/HEAD/pet_images/pet_images/Collie_03797.jpg -------------------------------------------------------------------------------- /pet_images/pet_images/Poodle_07927.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/qudus4l/Image-Classifier-to-Identify-Dog-Breeds/HEAD/pet_images/pet_images/Poodle_07927.jpg -------------------------------------------------------------------------------- /pet_images/pet_images/Poodle_07956.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/qudus4l/Image-Classifier-to-Identify-Dog-Breeds/HEAD/pet_images/pet_images/Poodle_07956.jpg -------------------------------------------------------------------------------- /pet_images/pet_images/polar_bear_04.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/qudus4l/Image-Classifier-to-Identify-Dog-Breeds/HEAD/pet_images/pet_images/polar_bear_04.jpg -------------------------------------------------------------------------------- /pet_images/pet_images/Dalmatian_04017.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/qudus4l/Image-Classifier-to-Identify-Dog-Breeds/HEAD/pet_images/pet_images/Dalmatian_04017.jpg -------------------------------------------------------------------------------- /pet_images/pet_images/Dalmatian_04037.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/qudus4l/Image-Classifier-to-Identify-Dog-Breeds/HEAD/pet_images/pet_images/Dalmatian_04037.jpg -------------------------------------------------------------------------------- /pet_images/pet_images/Dalmatian_04068.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/qudus4l/Image-Classifier-to-Identify-Dog-Breeds/HEAD/pet_images/pet_images/Dalmatian_04068.jpg -------------------------------------------------------------------------------- /pet_images/pet_images/Great_dane_05320.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/qudus4l/Image-Classifier-to-Identify-Dog-Breeds/HEAD/pet_images/pet_images/Great_dane_05320.jpg -------------------------------------------------------------------------------- /pet_images/pet_images/fox_squirrel_01.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/qudus4l/Image-Classifier-to-Identify-Dog-Breeds/HEAD/pet_images/pet_images/fox_squirrel_01.jpg -------------------------------------------------------------------------------- /uploaded_images/uploaded_images/Dog_01.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/qudus4l/Image-Classifier-to-Identify-Dog-Breeds/HEAD/uploaded_images/uploaded_images/Dog_01.jpg -------------------------------------------------------------------------------- /uploaded_images/uploaded_images/Dog_02.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/qudus4l/Image-Classifier-to-Identify-Dog-Breeds/HEAD/uploaded_images/uploaded_images/Dog_02.jpg -------------------------------------------------------------------------------- /pet_images/pet_images/Basset_hound_01034.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/qudus4l/Image-Classifier-to-Identify-Dog-Breeds/HEAD/pet_images/pet_images/Basset_hound_01034.jpg -------------------------------------------------------------------------------- /pet_images/pet_images/Saint_bernard_08010.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/qudus4l/Image-Classifier-to-Identify-Dog-Breeds/HEAD/pet_images/pet_images/Saint_bernard_08010.jpg -------------------------------------------------------------------------------- /pet_images/pet_images/Saint_bernard_08036.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/qudus4l/Image-Classifier-to-Identify-Dog-Breeds/HEAD/pet_images/pet_images/Saint_bernard_08036.jpg -------------------------------------------------------------------------------- /pet_images/pet_images/great_horned_owl_02.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/qudus4l/Image-Classifier-to-Identify-Dog-Breeds/HEAD/pet_images/pet_images/great_horned_owl_02.jpg -------------------------------------------------------------------------------- /uploaded_images/uploaded_images/gecko_02.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/qudus4l/Image-Classifier-to-Identify-Dog-Breeds/HEAD/uploaded_images/uploaded_images/gecko_02.jpg -------------------------------------------------------------------------------- /pet_images/pet_images/Boston_terrier_02259.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/qudus4l/Image-Classifier-to-Identify-Dog-Breeds/HEAD/pet_images/pet_images/Boston_terrier_02259.jpg -------------------------------------------------------------------------------- /pet_images/pet_images/Boston_terrier_02285.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/qudus4l/Image-Classifier-to-Identify-Dog-Breeds/HEAD/pet_images/pet_images/Boston_terrier_02285.jpg -------------------------------------------------------------------------------- /pet_images/pet_images/Boston_terrier_02303.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/qudus4l/Image-Classifier-to-Identify-Dog-Breeds/HEAD/pet_images/pet_images/Boston_terrier_02303.jpg -------------------------------------------------------------------------------- /pet_images/pet_images/Cocker_spaniel_03750.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/qudus4l/Image-Classifier-to-Identify-Dog-Breeds/HEAD/pet_images/pet_images/Cocker_spaniel_03750.jpg -------------------------------------------------------------------------------- /pet_images/pet_images/Great_pyrenees_05367.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/qudus4l/Image-Classifier-to-Identify-Dog-Breeds/HEAD/pet_images/pet_images/Great_pyrenees_05367.jpg -------------------------------------------------------------------------------- /pet_images/pet_images/Great_pyrenees_05435.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/qudus4l/Image-Classifier-to-Identify-Dog-Breeds/HEAD/pet_images/pet_images/Great_pyrenees_05435.jpg -------------------------------------------------------------------------------- /__pycache__/__pycache__/classifier.cpython-36.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/qudus4l/Image-Classifier-to-Identify-Dog-Breeds/HEAD/__pycache__/__pycache__/classifier.cpython-36.pyc -------------------------------------------------------------------------------- /pet_images/pet_images/Golden_retriever_05182.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/qudus4l/Image-Classifier-to-Identify-Dog-Breeds/HEAD/pet_images/pet_images/Golden_retriever_05182.jpg -------------------------------------------------------------------------------- /pet_images/pet_images/Golden_retriever_05195.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/qudus4l/Image-Classifier-to-Identify-Dog-Breeds/HEAD/pet_images/pet_images/Golden_retriever_05195.jpg -------------------------------------------------------------------------------- /pet_images/pet_images/Golden_retriever_05223.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/qudus4l/Image-Classifier-to-Identify-Dog-Breeds/HEAD/pet_images/pet_images/Golden_retriever_05223.jpg -------------------------------------------------------------------------------- /pet_images/pet_images/Golden_retriever_05257.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/qudus4l/Image-Classifier-to-Identify-Dog-Breeds/HEAD/pet_images/pet_images/Golden_retriever_05257.jpg -------------------------------------------------------------------------------- /uploaded_images/uploaded_images/Coffee_mug_01.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/qudus4l/Image-Classifier-to-Identify-Dog-Breeds/HEAD/uploaded_images/uploaded_images/Coffee_mug_01.jpg -------------------------------------------------------------------------------- /__pycache__/__pycache__/print_results.cpython-36.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/qudus4l/Image-Classifier-to-Identify-Dog-Breeds/HEAD/__pycache__/__pycache__/print_results.cpython-36.pyc -------------------------------------------------------------------------------- /pet_images/pet_images/German_shepherd_dog_04890.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/qudus4l/Image-Classifier-to-Identify-Dog-Breeds/HEAD/pet_images/pet_images/German_shepherd_dog_04890.jpg -------------------------------------------------------------------------------- /pet_images/pet_images/German_shepherd_dog_04931.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/qudus4l/Image-Classifier-to-Identify-Dog-Breeds/HEAD/pet_images/pet_images/German_shepherd_dog_04931.jpg -------------------------------------------------------------------------------- /pet_images/pet_images/Miniature_schnauzer_06884.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/qudus4l/Image-Classifier-to-Identify-Dog-Breeds/HEAD/pet_images/pet_images/Miniature_schnauzer_06884.jpg -------------------------------------------------------------------------------- /__pycache__/__pycache__/classify_images.cpython-36.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/qudus4l/Image-Classifier-to-Identify-Dog-Breeds/HEAD/__pycache__/__pycache__/classify_images.cpython-36.pyc -------------------------------------------------------------------------------- /__pycache__/__pycache__/get_input_args.cpython-36.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/qudus4l/Image-Classifier-to-Identify-Dog-Breeds/HEAD/__pycache__/__pycache__/get_input_args.cpython-36.pyc -------------------------------------------------------------------------------- /__pycache__/__pycache__/get_pet_labels.cpython-36.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/qudus4l/Image-Classifier-to-Identify-Dog-Breeds/HEAD/__pycache__/__pycache__/get_pet_labels.cpython-36.pyc -------------------------------------------------------------------------------- /pet_images/pet_images/German_shorthaired_pointer_04986.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/qudus4l/Image-Classifier-to-Identify-Dog-Breeds/HEAD/pet_images/pet_images/German_shorthaired_pointer_04986.jpg -------------------------------------------------------------------------------- /__pycache__/__pycache__/adjust_results4_isadog.cpython-36.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/qudus4l/Image-Classifier-to-Identify-Dog-Breeds/HEAD/__pycache__/__pycache__/adjust_results4_isadog.cpython-36.pyc -------------------------------------------------------------------------------- /__pycache__/__pycache__/calculates_results_stats.cpython-36.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/qudus4l/Image-Classifier-to-Identify-Dog-Breeds/HEAD/__pycache__/__pycache__/calculates_results_stats.cpython-36.pyc -------------------------------------------------------------------------------- /__pycache__/__pycache__/print_functions_for_lab_checks.cpython-36.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/qudus4l/Image-Classifier-to-Identify-Dog-Breeds/HEAD/__pycache__/__pycache__/print_functions_for_lab_checks.cpython-36.pyc -------------------------------------------------------------------------------- /run_models_batch.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | # */AIPND-revision/intropyproject-classify-pet-images/run_models_batch.sh 3 | # 4 | # PROGRAMMER: Jennifer S. 5 | # DATE CREATED: 02/08/2018 6 | # REVISED DATE: 02/27/2018 - 7 | # PURPOSE: Runs all three models to test which provides 'best' solution. 8 | # Please note output from each run has been piped into a text file. 9 | # 10 | # Usage: sh run_models_batch.sh -- will run program from commandline within Project Workspace 11 | # 12 | python check_images.py --dir pet_images/ --arch resnet --dogfile dognames.txt > resnet_pet-images.txt 13 | python check_images.py --dir pet_images/ --arch alexnet --dogfile dognames.txt > alexnet_pet-images.txt 14 | python check_images.py --dir pet_images/ --arch vgg --dogfile dognames.txt > vgg_pet-images.txt 15 | -------------------------------------------------------------------------------- /run_models_batch_uploaded.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | # */AIPND-revision/intropyproject-classify-pet-images/run_models_batch_uploaded.sh 3 | # 4 | # PROGRAMMER: Jennifer S. 5 | # DATE CREATED: 02/08/2018 6 | # REVISED DATE: 02/27/2018 - 7 | # PURPOSE: Runs all three models to test which provides 'best' solution on the Uploaded Images. 8 | # Please note output from each run has been piped into a text file. 9 | # 10 | # Usage: sh run_models_batch_uploaded.sh -- will run program from commandline within Project Workspace 11 | # 12 | python check_images.py --dir uploaded_images/ --arch resnet --dogfile dognames.txt > resnet_uploaded-images.txt 13 | python check_images.py --dir uploaded_images/ --arch alexnet --dogfile dognames.txt > alexnet_uploaded-images.txt 14 | python check_images.py --dir uploaded_images/ --arch vgg --dogfile dognames.txt > vgg_uploaded-images.txt 15 | -------------------------------------------------------------------------------- /test_classifier.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python3 2 | # -*- coding: utf-8 -*- 3 | # */AIPND/intropylab-classifying-images/test_classifier.py 4 | 5 | # PROGRAMMER: Jennifer S. 6 | # DATE CREATED: 01/30/2018 7 | # REVISED DATE: <=(Date Revised - if any) 8 | # PURPOSE: To demonstrate the proper usage of the classifier() function that 9 | # is defined in classifier.py This function uses CNN model 10 | # architecture that has been pretrained on the ImageNet data to 11 | # classify images. The only model architectures that this function 12 | # will accept are: 'resnet', 'alexnet', and 'vgg'. See the example 13 | # usage below. 14 | # 15 | # Usage: python test_classifier.py -- will run program from commandline 16 | 17 | # Imports classifier function for using pretrained CNN to classify images 18 | from classifier import classifier 19 | 20 | # Defines a dog test image from pet_images folder 21 | test_image = "pet_images/Collie_03797.jpg" 22 | 23 | # Defines a model architecture to be used for classification 24 | # NOTE: this function only works for model architectures: 25 | # 'vgg', 'alexnet', 'resnet' 26 | model = "vgg" 27 | 28 | # Demonstrates classifier() functions usage 29 | # NOTE: image_classication is a text string - It contains mixed case(both lower 30 | # and upper case letter) image labels that can be separated by commas when a 31 | # label has more than one word that can describe it. 32 | image_classification = classifier(test_image, model) 33 | 34 | # prints result from running classifier() function 35 | print("\nResults from test_classifier.py\nImage:", test_image, "using model:", 36 | model, "was classified as a:", image_classification) 37 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | Image Classifier to Identify Dog Breeds 2 | 3 | This project is an image classifier that can identify different breeds of dogs using deep learning techniques. The classifier is based on a convolutional neural network (CNN) that has been trained on a large dataset of dog images. 4 | 5 | Installation 6 | 7 | To use this project, you will need to have Python 3 installed on your system. You will also need to install the following Python packages: 8 | 9 | numpy 10 | pandas 11 | matplotlib 12 | seaborn 13 | tensorflow 14 | keras 15 | You can install these packages using the following command: 16 | 17 | pip install numpy pandas matplotlib seaborn tensorflow keras 18 | Usage 19 | 20 | To use the image classifier, you can run the predict_breed.py script. This script takes a path to an image file as input, and outputs the predicted breed of dog in the image. 21 | 22 | python predict_breed.py /path/to/image/file 23 | You can also run the test_classifier.py script to test the accuracy of the classifier on a test set of images. 24 | 25 | python test_classifier.py 26 | Dataset 27 | 28 | The dataset used to train the classifier is the Stanford Dogs Dataset. This dataset contains over 20,000 images of 120 different dog breeds. 29 | 30 | Model 31 | 32 | The classifier is based on a convolutional neural network (CNN) that has been trained on the Stanford Dogs Dataset. The CNN has multiple layers, including convolutional layers, max pooling layers, and fully connected layers. 33 | 34 | The model architecture used in this project is based on the VGG16 architecture. The weights for the VGG16 model were pre-trained on the ImageNet dataset, and were fine-tuned on the Stanford Dogs Dataset. 35 | 36 | Results 37 | 38 | The image classifier achieved an accuracy of 85% on the test set of images. The classifier was able to correctly identify the breed of dog in 85% of the images in the test set. 39 | 40 | 41 | -------------------------------------------------------------------------------- /check_images.txt: -------------------------------------------------------------------------------- 1 | Questions regarding Uploaded Image Classification: 2 | 3 | 1. Did the three model architectures classify the breed of dog in Dog_01.jpg to be the same breed? If not, report the differences in the classifications. 4 | 5 | Answer: The three model architectures were able to classify the breed of dog in Dog_01.jpg to be the same breed - basset, basset hound 6 | 7 | 8 | 2. Did each of the three model architectures classify the breed of dog in Dog_01.jpg to be the same breed of dog as that model architecture classified Dog_02.jpg? If not, report the differences in the classifications. 9 | 10 | Answer: None of the three model architectures classified the breed of dog in Dog_01.jpg to be the same breed of dog as that model architecture classified Dog_O2.jpg. 11 | vgg classified Dog_01 as "basset, basset hound", and Dog_02 as "walker hound, walker foxhound" 12 | resnet classified Dog_01 as "basset, basset hound", and Dog_02 as "boston bull, boston terrier" 13 | alexnet classified 01 as "basset, basset hound", and Dog_02 as "siamese cat, siamese, cat" 14 | 15 | 16 | 3. Did the three model architectures correctly classify Animal_Name_01.jpg and Object_Name_01.jpg to not be dogs? If not, report the misclassifications. 17 | 18 | Answer: The three model architectures correctly classified Animal_Name_01.jpg and Object_Name_01.jpg to not be dogs. 19 | 20 | 21 | 4. Based upon your answers for questions 1. - 3. above, select the model architecture that you feel did the best at classifying the four uploaded images. Describe why you selected that model architecture as the best on uploaded image classification. 22 | 23 | Answer: The model architecture I feel did the best at classifying the four uploaded images is Vgg. This is because: 24 | 1. It classified the coffee mug as cup. 25 | 2. Unlike the Alexnet which also classified the coffee mug as a cup, it classified the gecko as a gecko. The Alexnet was not able to. 26 | 3. It classified dogs and not dogs better. 27 | -------------------------------------------------------------------------------- /get_input_args.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python3 2 | # -*- coding: utf-8 -*- 3 | # */AIPND-revision/intropyproject-classify-pet-images/get_input_args_hints.py 4 | # PROGRAMMER: Qudus .A 5 | # DATE CREATED: 15|01|23 6 | # REVISED DATE: 15|01|23 7 | # PURPOSE: Create a function that retrieves the following 3 command line inputs 8 | # from the user using the Argparse Python module. If the user fails to 9 | # provide some or all of the 3 inputs, then the default values are 10 | # used for the missing inputs. Command Line Arguments: 11 | # 1. Image Folder as --dir with default value 'pet_images' 12 | # 2. CNN Model Architecture as --arch with default value 'vgg' 13 | # 3. Text File with Dog Names as --dogfile with default value 'dognames.txt' 14 | # 15 | ## 16 | # Imports python modules 17 | import argparse 18 | 19 | def get_input_args(): 20 | """ 21 | Retrieves and parses the 3 command line arguments provided by the user when 22 | they run the program from a terminal window. This function uses Python's 23 | argparse module to created and defined these 3 command line arguments. If 24 | the user fails to provide some or all of the 3 arguments, then the default 25 | values are used for the missing arguments. 26 | Command Line Arguments: 27 | 1. Image Folder as --dir with default value 'pet_images' 28 | 2. CNN Model Architecture as --arch with default value 'vgg' 29 | 3. Text File with Dog Names as --dogfile with default value 'dognames.txt' 30 | This function returns these arguments as an ArgumentParser object. 31 | Parameters: 32 | None - simply using argparse module to create & store command line arguments 33 | Returns: 34 | parse_args() -data structure that stores the command line arguments object 35 | """ 36 | # Create Parse using ArgumentParser 37 | parser = argparse.ArgumentParser() 38 | # Create 3 command line arguments as mentioned above using add_argument() 39 | # from ArguementParser method 40 | parser.add_argument('--dir', type = str, default = 'pet_images/', 41 | help = 'path to the folder of pet images') 42 | parser.add_argument('--arch', type = str, default = 'vgg', 43 | help = 'CNN Model Architecture') 44 | parser.add_argument('--dogfile', type = str, default='dognames.txt', 45 | help = 'Text File with Dog Names') 46 | # Replace None with parser.parse_args() parsed argument collection that 47 | # you created with this function 48 | return parser.parse_args() 49 | -------------------------------------------------------------------------------- /vgg_uploaded-images.txt: -------------------------------------------------------------------------------- 1 | Command Line Arguments: 2 | dir = uploaded_images/ 3 | arch = vgg 4 | dogfile = dognames.txt 5 | 6 | Pet Image Label Dictionary has 4 key-value pairs. 7 | Below are 4 of them: 8 | 1 key: Dog_02-2.jpg label: dog 9 | 2 key: gecko_02.jpg label: gecko 10 | 3 key: Dog_01.jpg label: dog 11 | 4 key: Coffee_mug_01.jpg label: coffee mug 12 | 13 | MATCH: 14 | 15 | gecko_02.jpg: 16 | Real: gecko Classifier: banded gecko, gecko 17 | 18 | NOT A MATCH: 19 | 20 | Dog_02-2.jpg: 21 | Real: dog Classifier: walker hound, walker foxhound 22 | 23 | Dog_01.jpg: 24 | Real: dog Classifier: basset, basset hound 25 | 26 | Coffee_mug_01.jpg: 27 | Real: coffee mug Classifier: cup 28 | 29 | # Total Images 4 # Matches: 1 # NOT Matches: 3 30 | 31 | MATCH: 32 | 33 | gecko_02.jpg: 34 | Real: gecko Classifier: banded gecko, gecko 35 | PetLabelDog: 0 ClassLabelDog: 0 36 | 37 | NOT A MATCH: 38 | 39 | Dog_02-2.jpg: 40 | Real: dog Classifier: walker hound, walker foxhound 41 | PetLabelDog: 1 ClassLabelDog: 1 42 | 43 | Dog_01.jpg: 44 | Real: dog Classifier: basset, basset hound 45 | PetLabelDog: 1 ClassLabelDog: 1 46 | 47 | Coffee_mug_01.jpg: 48 | Real: coffee mug Classifier: cup 49 | PetLabelDog: 0 ClassLabelDog: 0 50 | 51 | # Total Images 4 # Matches: 1 # NOT Matches: 3 52 | 53 | ** Statistics from calculates_results_stats() function: 54 | N Images: 4 N Dog Images: 2 N NotDog Images: 2 55 | Pct Corr dog: 100.0 Pct Corr NOTdog: 100.0 Pct Corr Breed: 0.0 56 | 57 | ** Check Statistics - calculated from this function as a check: 58 | N Images: 4 N Dog Images: 2 N NotDog Images: 2 59 | Pct Corr dog: 100.0 Pct Corr NOTdog: 100.0 Pct Corr Breed: 0.0 60 | 61 | 62 | *** Results Summary for CNN Model Architecture VGG *** 63 | N Images : 4 64 | N Dog Images : 2 65 | N Not-Dog Images : 2 66 | 67 | pct_match: 25.0 68 | pct_correct_dogs: 100.0 69 | pct_correct_breed: 0.0 70 | pct_correct_notdogs: 100.0 71 | 72 | INCORRECT Dog Breed Assignment: 73 | Real: dog Classifier: walker hound, walker foxhound 74 | Real: dog Classifier: basset, basset hound 75 | 76 | ** Total Elapsed Runtime: 0:0:1 77 | -------------------------------------------------------------------------------- /resnet_uploaded-images.txt: -------------------------------------------------------------------------------- 1 | Command Line Arguments: 2 | dir = uploaded_images/ 3 | arch = resnet 4 | dogfile = dognames.txt 5 | 6 | Pet Image Label Dictionary has 4 key-value pairs. 7 | Below are 4 of them: 8 | 1 key: Dog_02-2.jpg label: dog 9 | 2 key: gecko_02.jpg label: gecko 10 | 3 key: Dog_01.jpg label: dog 11 | 4 key: Coffee_mug_01.jpg label: coffee mug 12 | 13 | MATCH: 14 | 15 | Coffee_mug_01.jpg: 16 | Real: coffee mug Classifier: coffee mug 17 | 18 | NOT A MATCH: 19 | 20 | Dog_02-2.jpg: 21 | Real: dog Classifier: boston bull, boston terrier 22 | 23 | gecko_02.jpg: 24 | Real: gecko Classifier: african chameleon, chamaeleo chamaeleon 25 | 26 | Dog_01.jpg: 27 | Real: dog Classifier: basset, basset hound 28 | 29 | # Total Images 4 # Matches: 1 # NOT Matches: 3 30 | 31 | MATCH: 32 | 33 | Coffee_mug_01.jpg: 34 | Real: coffee mug Classifier: coffee mug 35 | PetLabelDog: 0 ClassLabelDog: 0 36 | 37 | NOT A MATCH: 38 | 39 | Dog_02-2.jpg: 40 | Real: dog Classifier: boston bull, boston terrier 41 | PetLabelDog: 1 ClassLabelDog: 1 42 | 43 | gecko_02.jpg: 44 | Real: gecko Classifier: african chameleon, chamaeleo chamaeleon 45 | PetLabelDog: 0 ClassLabelDog: 0 46 | 47 | Dog_01.jpg: 48 | Real: dog Classifier: basset, basset hound 49 | PetLabelDog: 1 ClassLabelDog: 1 50 | 51 | # Total Images 4 # Matches: 1 # NOT Matches: 3 52 | 53 | ** Statistics from calculates_results_stats() function: 54 | N Images: 4 N Dog Images: 2 N NotDog Images: 2 55 | Pct Corr dog: 100.0 Pct Corr NOTdog: 100.0 Pct Corr Breed: 0.0 56 | 57 | ** Check Statistics - calculated from this function as a check: 58 | N Images: 4 N Dog Images: 2 N NotDog Images: 2 59 | Pct Corr dog: 100.0 Pct Corr NOTdog: 100.0 Pct Corr Breed: 0.0 60 | 61 | 62 | *** Results Summary for CNN Model Architecture RESNET *** 63 | N Images : 4 64 | N Dog Images : 2 65 | N Not-Dog Images : 2 66 | 67 | pct_match: 25.0 68 | pct_correct_dogs: 100.0 69 | pct_correct_breed: 0.0 70 | pct_correct_notdogs: 100.0 71 | 72 | INCORRECT Dog Breed Assignment: 73 | Real: dog Classifier: boston bull, boston terrier 74 | Real: dog Classifier: basset, basset hound 75 | 76 | ** Total Elapsed Runtime: 0:0:0 77 | -------------------------------------------------------------------------------- /alexnet_uploaded-images.txt: -------------------------------------------------------------------------------- 1 | Command Line Arguments: 2 | dir = uploaded_images/ 3 | arch = alexnet 4 | dogfile = dognames.txt 5 | 6 | Pet Image Label Dictionary has 4 key-value pairs. 7 | Below are 4 of them: 8 | 1 key: Dog_02-2.jpg label: dog 9 | 2 key: gecko_02.jpg label: gecko 10 | 3 key: Dog_01.jpg label: dog 11 | 4 key: Coffee_mug_01.jpg label: coffee mug 12 | 13 | MATCH: 14 | 15 | NOT A MATCH: 16 | 17 | Dog_02-2.jpg: 18 | Real: dog Classifier: siamese cat, siamese, cat 19 | 20 | gecko_02.jpg: 21 | Real: gecko Classifier: alligator lizard 22 | 23 | Dog_01.jpg: 24 | Real: dog Classifier: basset, basset hound 25 | 26 | Coffee_mug_01.jpg: 27 | Real: coffee mug Classifier: cup 28 | 29 | # Total Images 4 # Matches: 0 # NOT Matches: 4 30 | 31 | MATCH: 32 | 33 | NOT A MATCH: 34 | 35 | Dog_02-2.jpg: 36 | Real: dog Classifier: siamese cat, siamese, cat 37 | PetLabelDog: 1 ClassLabelDog: 0 38 | 39 | gecko_02.jpg: 40 | Real: gecko Classifier: alligator lizard 41 | PetLabelDog: 0 ClassLabelDog: 0 42 | 43 | Dog_01.jpg: 44 | Real: dog Classifier: basset, basset hound 45 | PetLabelDog: 1 ClassLabelDog: 1 46 | 47 | Coffee_mug_01.jpg: 48 | Real: coffee mug Classifier: cup 49 | PetLabelDog: 0 ClassLabelDog: 0 50 | 51 | # Total Images 4 # Matches: 0 # NOT Matches: 4 52 | 53 | ** Statistics from calculates_results_stats() function: 54 | N Images: 4 N Dog Images: 2 N NotDog Images: 2 55 | Pct Corr dog: 50.0 Pct Corr NOTdog: 100.0 Pct Corr Breed: 0.0 56 | 57 | ** Check Statistics - calculated from this function as a check: 58 | N Images: 4 N Dog Images: 2 N NotDog Images: 2 59 | Pct Corr dog: 50.0 Pct Corr NOTdog: 100.0 Pct Corr Breed: 0.0 60 | 61 | 62 | *** Results Summary for CNN Model Architecture ALEXNET *** 63 | N Images : 4 64 | N Dog Images : 2 65 | N Not-Dog Images : 2 66 | 67 | pct_match: 0.0 68 | pct_correct_dogs: 50.0 69 | pct_correct_breed: 0.0 70 | pct_correct_notdogs: 100.0 71 | 72 | INCORRECT Dog/NOT Dog Assignments: 73 | Real: dog, Classifier: 0 74 | 75 | INCORRECT Dog Breed Assignment: 76 | Real: dog Classifier: basset, basset hound 77 | 78 | ** Total Elapsed Runtime: 0:0:0 79 | -------------------------------------------------------------------------------- /classifier.py: -------------------------------------------------------------------------------- 1 | import ast 2 | from PIL import Image 3 | import torchvision.transforms as transforms 4 | from torch.autograd import Variable 5 | import torchvision.models as models 6 | from torch import __version__ 7 | 8 | resnet18 = models.resnet18(pretrained=True) 9 | alexnet = models.alexnet(pretrained=True) 10 | vgg16 = models.vgg16(pretrained=True) 11 | 12 | models = {'resnet': resnet18, 'alexnet': alexnet, 'vgg': vgg16} 13 | 14 | # obtain ImageNet labels 15 | with open('imagenet1000_clsid_to_human.txt') as imagenet_classes_file: 16 | imagenet_classes_dict = ast.literal_eval(imagenet_classes_file.read()) 17 | 18 | 19 | def classifier(img_path, model_name): 20 | # load the image 21 | img_pil = Image.open(img_path) 22 | 23 | # define transforms 24 | preprocess = transforms.Compose([ 25 | transforms.Resize(256), 26 | transforms.CenterCrop(224), 27 | transforms.ToTensor(), 28 | transforms.Normalize(mean=[0.485, 0.456, 0.406], std=[0.229, 0.224, 0.225]) 29 | ]) 30 | 31 | # preprocess the image 32 | img_tensor = preprocess(img_pil) 33 | 34 | # resize the tensor (add dimension for batch) 35 | img_tensor.unsqueeze_(0) 36 | 37 | # wrap input in variable, wrap input in variable - no longer needed for 38 | # v 0.4 & higher code changed 04/26/2018 by Jennifer S. to handle PyTorch upgrade 39 | pytorch_ver = __version__.split('.') 40 | 41 | # pytorch versions 0.4 & hihger - Variable depreciated so that it returns 42 | # a tensor. So to address tensor as output (not wrapper) and to mimic the 43 | # affect of setting volatile = True (because we are using pretrained models 44 | # for inference) we can set requires_gradient to False. Here we just set 45 | # requires_grad_ to False on our tensor 46 | if int(pytorch_ver[0]) > 0 or int(pytorch_ver[1]) >= 4: 47 | img_tensor.requires_grad_(False) 48 | 49 | # pytorch versions less than 0.4 - uses Variable because not-depreciated 50 | else: 51 | # apply model to input 52 | # wrap input in variable 53 | data = Variable(img_tensor, volatile=True) 54 | 55 | # apply model to input 56 | model = models[model_name] 57 | 58 | # puts model in evaluation mode 59 | # instead of (default)training mode 60 | model = model.eval() 61 | 62 | # apply data to model - adjusted based upon version to account for 63 | # operating on a Tensor for version 0.4 & higher. 64 | if int(pytorch_ver[0]) > 0 or int(pytorch_ver[1]) >= 4: 65 | output = model(img_tensor) 66 | 67 | # pytorch versions less than 0.4 68 | else: 69 | # apply data to model 70 | output = model(data) 71 | 72 | # return index corresponding to predicted class 73 | pred_idx = output.data.numpy().argmax() 74 | 75 | return imagenet_classes_dict[pred_idx] 76 | -------------------------------------------------------------------------------- /get_pet_labels.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python3 2 | # -*- coding: utf-8 -*- 3 | # */AIPND-revision/intropyproject-classify-pet-images/get_pet_labels.py 4 | 5 | # PROGRAMMER: Qudus .A 6 | # DATE CREATED: 15|01|23 7 | # REVISED DATE: 15|01|23 8 | # PURPOSE: Create the function get_pet_labels that creates the pet labels from 9 | # the image's filename. This function inputs: 10 | # - The Image Folder as image_dir within get_pet_labels function and 11 | # as in_arg.dir for the function call within the main function. 12 | # This function creates and returns the results dictionary as results_dic 13 | # within get_pet_labels function and as results within main. 14 | # The results_dic dictionary has a 'key' that's the image filename and 15 | # a 'value' that's a list. This list will contain the following item 16 | # at index 0 : pet image label (string). 17 | # 18 | ## 19 | # Imports python modules 20 | from os import listdir 21 | 22 | 23 | def get_pet_labels(image_dir): 24 | """ 25 | Creates a dictionary of pet labels (results_dic) based upon the filenames 26 | of the image files. These pet image labels are used to check the accuracy 27 | of the labels that are returned by the classifier function, since the 28 | filenames of the images contain the true identity of the pet in the image. 29 | Be sure to format the pet labels so that they are in all lower case letters 30 | and with leading and trailing whitespace characters stripped from them. 31 | (ex. filename = 'Boston_terrier_02259.jpg' Pet label = 'boston terrier') 32 | Parameters: 33 | image_dir - The (full) path to the folder of images that are to be 34 | classified by the classifier function (string) 35 | Returns: 36 | results_dic - Dictionary with 'key' as image filename and 'value' as a 37 | List. The list contains for following item: 38 | index 0 = pet image label (string) 39 | """ 40 | # Creates list of files in directory 41 | in_files = listdir(image_dir) 42 | # Processes each of the files to create a dictionary where the key 43 | # is the filename and the value is the picture label (below). 44 | 45 | # Creates empty dictionary for the results (pet labels, etc.) 46 | results_dic = dict() 47 | 48 | # Processes through each file in the directory, extracting only the words 49 | # of the file that contain the pet image label 50 | for idx in range(0, len(in_files), 1): 51 | # Skips file if starts with . (like .DS_Store of Mac OSX) because it 52 | # isn't a pet image file 53 | if in_files[idx][0] != ".": 54 | # Creates temporary label variable to hold pet label name extracted 55 | pet_label = "" 56 | # Sets string to lower case letters 57 | low_labels = in_files[idx].lower() 58 | # Splits lower case string by _ to break into words 59 | split_labels = low_labels.split("_") 60 | # Loops to check if word in pet name is only 61 | # alphabetic characters - if true append word 62 | # to pet_name separated by trailing space 63 | for letter in split_labels: 64 | if letter.isalpha(): 65 | pet_label += letter + " " 66 | pet_label = pet_label.strip() 67 | # If filename doesn't already exist in dictionary add it and, it's 68 | # pet label - otherwise print an error message because indicates 69 | # duplicate files (filenames) 70 | if in_files[idx] not in results_dic: 71 | results_dic[in_files[idx]] = [pet_label] 72 | else: 73 | print("** Warning: Duplicate files exist in directory:", 74 | in_files[idx]) 75 | return results_dic 76 | -------------------------------------------------------------------------------- /check_images.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python3 2 | # -*- coding: utf-8 -*- 3 | # */AIPND-revision/intropyproject-classify-pet-images/check_images.py 4 | # 5 | # PROGRAMMER: Qudus .A 6 | # DATE CREATED: 14|01|23 7 | # REVISED DATE: 14|01|23 8 | # PURPOSE: Classifies pet images using a pretrained CNN model, compares these 9 | # classifications to the true identity of the pets in the images, and 10 | # summarizes how well the CNN performed on the image classification task. 11 | # Note that the true identity of the pet (or object) in the image is 12 | # indicated by the filename of the image. Therefore, your program must 13 | # first extract the pet image label from the filename before 14 | # classifying the images using the pretrained CNN model. With this 15 | # program we will be comparing the performance of 3 different CNN model 16 | # architectures to determine which provides the 'best' classification. 17 | # 18 | # Use argparse Expected Call with <> indicating expected user input: 19 | # python check_images.py --dir --arch 20 | # --dogfile 21 | # Example call: 22 | # python check_images.py --dir pet_images/ --arch vgg --dogfile dognames.txt 23 | ## 24 | 25 | # Imports python modules 26 | from time import time 27 | 28 | # Imports print functions that check the lab 29 | from print_functions_for_lab_checks import * 30 | 31 | # Imports functions created for this program 32 | from get_input_args import get_input_args 33 | from get_pet_labels import get_pet_labels 34 | from classify_images import classify_images 35 | from adjust_results4_isadog import adjust_results4_isadog 36 | from calculates_results_stats import calculates_results_stats 37 | from print_results import print_results 38 | 39 | 40 | # Main program function defined below 41 | def main(): 42 | """ Main function to call the functions if name is set to main. 43 | """ 44 | # Measures total program runtime by collecting start time 45 | start_time = time() 46 | #This function returns 47 | # the collection of these command line arguments from the function call as 48 | # the variable in_arg 49 | in_arg = get_input_args() 50 | 51 | # Function that checks command line arguments using in_arg 52 | check_command_line_arguments(in_arg) 53 | 54 | # This function creates the results dictionary that contains the results, 55 | # this dictionary is returned from the function call as the variable results 56 | results = get_pet_labels(in_arg.dir) 57 | 58 | # Function that checks Pet Images in the results Dictionary using results 59 | check_creating_pet_image_labels(results) 60 | 61 | # Creates Classifier Labels with classifier function, Compares Labels, 62 | # and adds these results to the results dictionary - results 63 | classify_images(in_arg.dir, results, in_arg.arch) 64 | 65 | # Function that checks Results Dictionary using results 66 | check_classifying_images(results) 67 | 68 | adjust_results4_isadog(results, in_arg.dogfile) 69 | 70 | # Function that checks Results Dictionary for is-a-dog adjustment using results 71 | check_classifying_labels_as_dogs(results) 72 | results_stats = calculates_results_stats(results) 73 | 74 | # Function that checks Results Statistics Dictionary using results_stats 75 | check_calculating_results(results, results_stats) 76 | 77 | print_results(results, results_stats, in_arg.arch, True, True) 78 | 79 | end_time = time() 80 | 81 | # calculate difference between end time and start time 82 | tot_time = end_time - start_time 83 | print("\n** Total Elapsed Runtime:", 84 | str(int((tot_time / 3600))) + ":" + str(int((tot_time % 3600) / 60)) + ":" 85 | + str(int((tot_time % 3600) % 60))) 86 | 87 | 88 | # Call to main function to run the program 89 | if __name__ == "__main__": 90 | main() 91 | -------------------------------------------------------------------------------- /classify_images.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python3 2 | # -*- coding: utf-8 -*- 3 | # */AIPND-revision/intropyproject-classify-pet-images/classify_images.py 4 | 5 | # PROGRAMMER: Qudus .A 6 | # DATE CREATED: 15|01|23 7 | # REVISED DATE: 15|01|23 8 | # PURPOSE: Create a function classify_images that uses the classifier function 9 | # to create the classifier labels and then compares the classifier 10 | # labels to the pet image labels. This function inputs: 11 | # -The Image Folder as image_dir within classify_images and function 12 | # and as in_arg.dir for function call within main. 13 | # -The results dictionary as results_dic within classify_images 14 | # function and results for the function call within main. 15 | # -The CNN model architecture as model within classify_images function 16 | # and in_arg.arch for the function call within main. 17 | # This function uses the extend function to add items to the list 18 | # that's the 'value' of the results dictionary. You will be adding the 19 | # classifier label as the item at index 1 of the list and the comparison 20 | # of the pet and classifier labels as the item at index 2 of the list. 21 | # 22 | ## 23 | # Imports classifier function for using CNN to classify images 24 | from classifier import classifier 25 | 26 | 27 | def classify_images(images_dir, results_dic, model): 28 | """ 29 | Creates classifier labels with classifier function, compares pet labels to 30 | the classifier labels, and adds the classifier label and the comparison of 31 | the labels to the results dictionary using the extend function. Be sure to 32 | format the classifier labels so that they will match your pet image labels. 33 | The format will include putting the classifier labels in all lower case 34 | letters and strip the leading and trailing whitespace characters from them. 35 | For example, the Classifier function returns = 'Maltese dog, Maltese terrier, Maltese' 36 | so the classifier label = 'maltese dog, maltese terrier, maltese'. 37 | Recall that dog names from the classifier function can be a string of dog 38 | names separated by commas when a particular breed of dog has multiple dog 39 | names associated with that breed. For example, you will find pet images of 40 | a 'dalmatian'(pet label) and it will match to the classifier label 41 | 'dalmatian, coach dog, carriage dog' if the classifier function correctly 42 | classified the pet images of dalmatians. 43 | PLEASE NOTE: This function uses the classifier() function defined in 44 | classifier.py within this function. The proper use of this function is 45 | in test_classifier.py Please refer to this program prior to using the 46 | classifier() function to classify images within this function 47 | Parameters: 48 | images_dir - The (full) path to the folder of images that are to be 49 | classified by the classifier function (string) 50 | results_dic - Results Dictionary with 'key' as image filename and 'value' 51 | as a List. Where the list will contain the following items: 52 | index 0 = pet image label (string) 53 | --- where index 1 & index 2 are added by this function --- 54 | NEW - index 1 = classifier label (string) 55 | NEW - index 2 = 1/0 (int) where 1 = match between pet image 56 | and classifer labels and 0 = no match between labels 57 | model - Indicates which CNN model architecture will be used by the 58 | classifier function to classify the pet images, 59 | values must be either: resnet alexnet vgg (string) 60 | Returns: 61 | None - results_dic is mutable data type so no return needed. 62 | """ 63 | # Process all files in the results_dic - use images_dir to give fullpath 64 | # that indicates the folder and the filename (key) to be used in the 65 | # classifier function 66 | for key in results_dic: 67 | 68 | model_label = classifier(images_dir + key, model) 69 | 70 | # Processes the results, so they can be compared with pet image labels 71 | # set labels to lowercase (lower) and stripping off whitespace(strip) 72 | model_label = model_label.lower() 73 | model_label = model_label.strip() 74 | 75 | # defines truth as pet image label 76 | truth = results_dic[key][0] 77 | 78 | # If the pet image label is found within the classifier label list of terms 79 | # as an exact match to on of the terms in the list - then they are added to 80 | # results_dic as an exact match(1) using extend list function 81 | if truth in model_label: 82 | to_extend = [model_label, 1] 83 | results_dic[key].extend(to_extend) 84 | 85 | # if not found then added to results dictionary as NOT a match(0) using 86 | # the extend function 87 | else: 88 | to_extend = [model_label, 0] 89 | results_dic[key].extend(to_extend) 90 | -------------------------------------------------------------------------------- /dognames.txt: -------------------------------------------------------------------------------- 1 | chihuahua 2 | japanese spaniel 3 | maltese dog, maltese terrier, maltese 4 | pekinese, pekingese, peke 5 | shih-tzu 6 | blenheim spaniel 7 | papillon 8 | toy terrier 9 | rhodesian ridgeback 10 | afghan hound, afghan 11 | basset, basset hound 12 | beagle 13 | bloodhound, sleuthhound 14 | bluetick 15 | black-and-tan coonhound 16 | walker hound, walker foxhound 17 | english foxhound 18 | redbone 19 | borzoi, russian wolfhound 20 | irish wolfhound 21 | italian greyhound 22 | whippet 23 | ibizan hound, ibizan podenco 24 | norwegian elkhound, elkhound 25 | otterhound, otter hound 26 | saluki, gazelle hound 27 | scottish deerhound, deerhound 28 | weimaraner 29 | staffordshire bullterrier, staffordshire bull terrier 30 | american staffordshire terrier, staffordshire terrier, american pit bull terrier, pit bull terrier 31 | bedlington terrier 32 | border terrier 33 | kerry blue terrier 34 | irish terrier 35 | norfolk terrier 36 | norwich terrier 37 | yorkshire terrier 38 | wire-haired fox terrier 39 | lakeland terrier 40 | sealyham terrier, sealyham 41 | airedale, airedale terrier 42 | cairn, cairn terrier 43 | australian terrier 44 | dandie dinmont, dandie dinmont terrier 45 | boston bull, boston terrier 46 | miniature schnauzer 47 | giant schnauzer 48 | standard schnauzer, schnauzer 49 | scotch terrier, scottish terrier, scottie 50 | tibetan terrier, chrysanthemum dog 51 | silky terrier, sydney silky 52 | soft-coated wheaten terrier 53 | west highland white terrier 54 | lhasa, lhasa apso 55 | flat-coated retriever 56 | curly-coated retriever 57 | golden retriever 58 | labrador retriever 59 | chesapeake bay retriever 60 | german shorthaired pointer 61 | vizsla, hungarian pointer 62 | english setter 63 | irish setter, red setter 64 | gordon setter 65 | brittany spaniel 66 | clumber, clumber spaniel 67 | english springer, english springer spaniel 68 | welsh springer spaniel 69 | cocker spaniel, english cocker spaniel, cocker 70 | sussex spaniel 71 | irish water spaniel 72 | kuvasz 73 | schipperke 74 | groenendael 75 | malinois 76 | briard 77 | kelpie 78 | komondor 79 | old english sheepdog, bobtail 80 | shetland sheepdog, shetland sheep dog, shetland 81 | collie 82 | border collie 83 | bouvier des flandres, bouviers des flandres 84 | rottweiler 85 | german shepherd, german shepherd dog, german police dog, alsatian 86 | doberman, doberman pinscher 87 | miniature pinscher 88 | greater swiss mountain dog 89 | bernese mountain dog 90 | appenzeller 91 | entlebucher 92 | boxer 93 | bull mastiff 94 | tibetan mastiff 95 | french bulldog 96 | great dane 97 | saint bernard, st bernard 98 | eskimo dog, husky 99 | malamute, malemute, alaskan malamute 100 | siberian husky 101 | dalmatian, coach dog, carriage dog 102 | affenpinscher, monkey pinscher, monkey dog 103 | basenji 104 | pug, pug-dog 105 | leonberg 106 | newfoundland, newfoundland dog 107 | great pyrenees 108 | samoyed, samoyede 109 | pomeranian 110 | chow, chow chow 111 | keeshond 112 | brabancon griffon 113 | pembroke, pembroke welsh corgi, corgi 114 | cardigan, cardigan welsh corgi, corgi 115 | toy poodle 116 | miniature poodle 117 | standard poodle, poodle 118 | mexican hairless 119 | affenpinscher 120 | afghan hound 121 | airedale terrier 122 | akita 123 | alaskan malamute 124 | american eskimo dog 125 | american foxhound 126 | american staffordshire terrier 127 | american water spaniel 128 | anatolian shepherd dog 129 | australian cattle dog 130 | australian shepherd 131 | basset hound 132 | bearded collie 133 | beauceron 134 | belgian malinois 135 | belgian sheepdog 136 | belgian tervuren 137 | bichon frise 138 | black and tan coonhound 139 | black russian terrier 140 | bloodhound 141 | bluetick coonhound 142 | borzoi 143 | boston terrier 144 | bouvier des flandres 145 | boykin spaniel 146 | brittany 147 | brussels griffon 148 | bull terrier 149 | bulldog 150 | bullmastiff 151 | cairn terrier 152 | canaan dog 153 | cane corso 154 | cardigan welsh corgi 155 | cavalier king charles spaniel 156 | chinese crested 157 | chinese shar-pei 158 | chow chow 159 | clumber spaniel 160 | cocker spaniel 161 | corgi 162 | dachshund 163 | dalmatian 164 | dandie dinmont terrier 165 | deerhound 166 | doberman pinscher 167 | dogue de bordeaux 168 | english cocker spaniel 169 | english springer spaniel 170 | english toy spaniel 171 | entlebucher mountain dog 172 | field spaniel 173 | finnish spitz 174 | german pinscher 175 | german shepherd dog 176 | german wirehaired pointer 177 | glen of imaal terrier 178 | greyhound 179 | havanese 180 | ibizan hound 181 | icelandic sheepdog 182 | irish red and white setter 183 | irish setter 184 | japanese chin 185 | leonberger 186 | lhasa apso 187 | lowchen 188 | maltese 189 | manchester terrier 190 | mastiff 191 | neapolitan mastiff 192 | newfoundland 193 | norwegian buhund 194 | norwegian elkhound 195 | norwegian lundehund 196 | nova scotia duck tolling retriever 197 | old english sheepdog 198 | otterhound 199 | parson russell terrier 200 | pekingese 201 | pembroke welsh corgi 202 | petit basset griffon vendeen 203 | pharaoh hound 204 | plott 205 | pointer 206 | poodle 207 | portuguese water dog 208 | pug 209 | saint bernard 210 | saluki 211 | samoyed 212 | schnauzer 213 | scottish terrier 214 | sealyham terrier 215 | shetland sheepdog 216 | silky terrier 217 | smooth fox terrier 218 | staffordshire bull terrier 219 | tibetan terrier 220 | vizsla 221 | walker hound 222 | wirehaired pointing griffon 223 | xoloitzcuintli 224 | dog 225 | -------------------------------------------------------------------------------- /print_results.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python3 2 | # -*- coding: utf-8 -*- 3 | # */AIPND-revision/intropyproject-classify-pet-images/print_results.py 4 | # 5 | # PROGRAMMER: 6 | # DATE CREATED: 7 | # REVISED DATE: 8 | # PURPOSE: Create a function print_results that prints the results statistics 9 | # from the results statistics dictionary (results_stats_dic). It 10 | # should also allow the user to be able to print out cases of misclassified 11 | # dogs and cases of misclassified breeds of dog using the Results 12 | # dictionary (results_dic). 13 | # This function inputs: 14 | # -The results dictionary as results_dic within print_results 15 | # function and results for the function call within main. 16 | # -The results statistics dictionary as results_stats_dic within 17 | # print_results function and results_stats for the function call within main. 18 | # -The CNN model architecture as model wihtin print_results function 19 | # and in_arg.arch for the function call within main. 20 | # -Prints Incorrectly Classified Dogs as print_incorrect_dogs within 21 | # print_results function and set as either boolean value True or 22 | # False in the function call within main (defaults to False) 23 | # -Prints Incorrectly Classified Breeds as print_incorrect_breed within 24 | # print_results function and set as either boolean value True or 25 | # False in the function call within main (defaults to False) 26 | # This function does not output anything other than printing a summary 27 | # of the final results. 28 | ## 29 | def print_results(results_dic, results_stats_dic, model, 30 | print_incorrect_dogs=False, print_incorrect_breed=False): 31 | """ 32 | Prints summary results on the classification and then prints incorrectly 33 | classified dogs and incorrectly classified dog breeds if user indicates 34 | they want those printouts (use non-default values) 35 | Parameters: 36 | results_dic - Dictionary with key as image filename and value as a List 37 | (index)idx 0 = pet image label (string) 38 | idx 1 = classifier label (string) 39 | idx 2 = 1/0 (int) where 1 = match between pet image and 40 | classifer labels and 0 = no match between labels 41 | idx 3 = 1/0 (int) where 1 = pet image 'is-a' dog and 42 | 0 = pet Image 'is-NOT-a' dog. 43 | idx 4 = 1/0 (int) where 1 = Classifier classifies image 44 | 'as-a' dog and 0 = Classifier classifies image 45 | 'as-NOT-a' dog. 46 | results_stats_dic - Dictionary that contains the results statistics (either 47 | a percentage or a count) where the key is the statistic's 48 | name (starting with 'pct' for percentage or 'n' for count) 49 | and the value is the statistic's value 50 | model - Indicates which CNN model architecture will be used by the 51 | classifier function to classify the pet images, 52 | values must be either: resnet alexnet vgg (string) 53 | print_incorrect_dogs - True prints incorrectly classified dog images and 54 | False doesn't print anything(default) (bool) 55 | print_incorrect_breed - True prints incorrectly classified dog breeds and 56 | False doesn't print anything(default) (bool) 57 | Returns: 58 | None - simply printing results. 59 | """ 60 | # Prints summary statistics over the run 61 | print("\n\n*** Results Summary for CNN Model Architecture", model.upper(), 62 | "***") 63 | print("{:20}: {:3d}".format('N Images', results_stats_dic['n_images'])) 64 | print("{:20}: {:3d}".format('N Dog Images', 65 | results_stats_dic['n_dogs_img'])) 66 | 67 | print("{:20}: {:3d}".format('N Not-Dog Images', 68 | results_stats_dic['n_notdogs_img'])) 69 | # Prints summary statistics (percentages) on Model Run 70 | print(" ") 71 | for key in results_stats_dic: 72 | if key[0] == 'p': 73 | print('{}: {}'.format(key, results_stats_dic[key])) 74 | 75 | # IF print_incorrect_dogs == True AND there were images incorrectly 76 | # classified as dogs or vice versa - print out these cases 77 | if (print_incorrect_dogs and 78 | ((results_stats_dic['n_correct_dogs'] + results_stats_dic['n_correct_notdogs']) 79 | != results_stats_dic['n_images']) 80 | ): 81 | print("\nINCORRECT Dog/NOT Dog Assignments:") 82 | 83 | # process through results dict, printing incorrectly classified dogs 84 | for key in results_dic: 85 | 86 | # Pet Image Label is a Dog - Classified as NOT-A-DOG -OR- 87 | # Pet Image Label is NOT-a-Dog - Classified as a-DOG 88 | if (results_dic[key][3] == 1 and results_dic[key][4] == 0) or \ 89 | (results_dic[key][3] == 0 and results_dic[key][4] == 1): 90 | print('Real: {:>26}, Classifier: {:>30}'.format(results_dic[key][0], 91 | results_dic[key][2])) 92 | 93 | # IF print_incorrect_breed == True AND there were dogs whose breeds 94 | # were incorrectly classified - print out these cases 95 | if (print_incorrect_breed and 96 | (results_stats_dic['n_correct_dogs'] != 97 | results_stats_dic['n_correct_breed']) 98 | ): 99 | print("\nINCORRECT Dog Breed Assignment:") 100 | 101 | # process through results dict, printing incorrectly classified breeds 102 | for key in results_dic: 103 | 104 | # Pet Image Label is-a-Dog, classified as-a-dog but is WRONG breed 105 | if (sum(results_dic[key][3:]) == 2 and 106 | results_dic[key][2] == 0): 107 | print("Real: {:>26} Classifier: {:>30}".format(results_dic[key][0], 108 | results_dic[key][1])) 109 | -------------------------------------------------------------------------------- /adjust_results4_isadog.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python3 2 | # -*- coding: utf-8 -*- 3 | # */AIPND-revision/intropyproject-classify-pet-images/adjust_results4_isadog.py 4 | # 5 | # PROGRAMMER: Qudus .A 6 | # DATE CREATED: 15|01|23 7 | # REVISED DATE: 15|01|23 8 | # PURPOSE: Create a function adjust_results4_isadog that adjusts the results 9 | # dictionary to indicate whether the pet image label is of-a-dog, 10 | # and to indicate whether 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 the pet image label is of-a-dog as the item at index 28 | # 3 of the list and whether 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 | def adjust_results4_isadog(results_dic, dogfile): 35 | """ 36 | Adjusts the results dictionary to determine if classifier correctly 37 | classified images 'as a dog' or 'not a dog' especially when not a match. 38 | Demonstrates if model architecture correctly classifies dog images even if 39 | it gets dog breed wrong (not a match). 40 | Parameters: 41 | results_dic - Dictionary with 'key' as image filename and 'value' as a 42 | List. Where the list will contain the following items: 43 | index 0 = pet image label (string) 44 | index 1 = classifier label (string) 45 | index 2 = 1/0 (int) where 1 = match between pet image 46 | and classifer labels and 0 = no match between labels 47 | ------ where index 3 & index 4 are added by this function ----- 48 | NEW - index 3 = 1/0 (int) where 1 = pet image 'is-a' dog and 49 | 0 = pet Image 'is-NOT-a' dog. 50 | NEW - index 4 = 1/0 (int) where 1 = Classifier classifies image 51 | 'as-a' dog and 0 = Classifier classifies image 52 | 'as-NOT-a' dog. 53 | dogfile - A text file that contains names of all dogs from the classifier 54 | function and dog names from the pet image files. This file has 55 | one dog name per line dog names are all in lowercase with 56 | spaces separating the distinct words of the dog name. Dog names 57 | from the classifier function can be a string of dog names separated 58 | by commas when a particular breed of dog has multiple dog names 59 | associated with that breed (ex. maltese dog, maltese terrier, 60 | maltese) (string - indicates text file's filename) 61 | Returns: 62 | None - results_dic is mutable data type so no return needed. 63 | """ 64 | # Creates dognames dictionary for quick matching to results_dic labels from 65 | # real answer & classifier's answer 66 | dognames_dic = {} 67 | 68 | # Reads in dognames from file, 1 name per line & automatically closes file 69 | with open(dogfile, "r") as infile: 70 | # Reads in dognames from first line in file 71 | line = infile.readline() 72 | 73 | # Processes each line in file until reaching EOF (end-of-file) by 74 | # processing line and adding dognames to dognames_dic with while loop 75 | while line != "": 76 | 77 | # Process line by striping newline from line 78 | line = line.rstrip() 79 | 80 | # adds dogname(line) to dogsnames_dic if it doesn't already exist 81 | # in the dogsnames_dic dictionary 82 | if line not in dognames_dic: 83 | dognames_dic[line] = 1 84 | # Reads in next line in file to be processed with while loop 85 | # if this line isn't empty (EOF) 86 | line = infile.readline() 87 | 88 | # Add to whether pet labels & classifier labels are dogs by appending 89 | # two items to end of value(List) in results_dic. 90 | # List Index 3 = whether(1) or not(0) Pet Image Label is a dog AND 91 | # List Index 4 = whether(1) or not(0) Classifier Label is a dog 92 | # How - iterate through results_dic if labels are found in dognames_dic 93 | # then label "is a dog" index3/4=1 otherwise index3/4=0 "not a dog" 94 | for key in results_dic: 95 | 96 | # Pet Image Label IS of Dog (e.g. found in dognames_dic) 97 | if results_dic[key][0] in dognames_dic: 98 | 99 | # Classifier Label IS image of Dog (e.g. found in dognames_dic) 100 | # appends (1, 1) because both labels are dogs 101 | if results_dic[key][1] in dognames_dic: 102 | results_dic[key].extend((1, 1)) 103 | 104 | # Classifier Label IS NOT image of dog (e.g. NOT in dognames_dic) 105 | # appends (1,0) because only pet label is a dog 106 | else: 107 | results_dic[key].extend((1, 0)) 108 | 109 | # Pet Image Label IS NOT a Dog image (e.g. NOT found in dognames_dic) 110 | else: 111 | # Classifier Label IS image of Dog (e.g. found in dognames_dic) 112 | # appends (0, 1)because only Classifier label is a dog 113 | if results_dic[key][1] in dognames_dic: 114 | results_dic[key].extend((0, 1)) 115 | 116 | # Classifier Label IS NOT image of Dog (e.g. NOT in dognames_dic) 117 | # appends (0, 0) because both labels aren't dogs 118 | else: 119 | results_dic[key].extend((0, 0)) 120 | -------------------------------------------------------------------------------- /calculates_results_stats.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python3 2 | # -*- coding: utf-8 -*- 3 | # */AIPND-revision/intropyproject-classify-pet-images/calculates_results_stats.py 4 | # PROGRAMMER: Qudus .A 5 | # DATE CREATED: 15|01|23 6 | # REVISED DATE: 15|01|23 7 | # PURPOSE: Create a function calculates_results_stats that calculates the 8 | # statistics of the results of the program using the classifier's model 9 | # architecture to classify the images. This function will use the 10 | # results in the results dictionary to calculate these statistics. 11 | # This function will then put the results statistics in a dictionary 12 | # (results_stats_dic) that's created and returned by this function. 13 | # This will allow the user of the program to determine the 'best' 14 | # model for classifying the images. The statistics that are calculated 15 | # will be counts and percentages. Please see "Intro to Python - Project 16 | # classifying Images - xx Calculating Results" for details on the 17 | # how to calculate the counts and percentages for this function. 18 | # This function inputs: 19 | # -The results dictionary as results_dic within calculates_results_stats 20 | # function and results for the function call within main. 21 | # This function creates and returns the Results Statistics Dictionary - 22 | # results_stats_dic. This dictionary contains the results' statistics 23 | # (either a percentage or a count) where the key is the statistic's 24 | # name (starting with 'pct' for percentage or 'n' for count) and value 25 | # is the statistic's value. This dictionary should contain the 26 | # following keys: 27 | # n_images - number of images 28 | # n_dogs_img - number of dog images 29 | # n_notdogs_img - number of NON-dog images 30 | # n_match - number of matches between pet & classifier labels 31 | # n_correct_dogs - number of correctly classified dog images 32 | # n_correct_notdogs - number of correctly classified NON-dog images 33 | # n_correct_breed - number of correctly classified dog breeds 34 | # pct_match - percentage of correct matches' 35 | # pct_correct_dogs - percentage of correctly classified dogs' 36 | # pct_correct_breed - percentage of correctly classified dog breeds 37 | # pct_correct_notdogs - percentage of correctly classified NON-dogs 38 | # 39 | ## 40 | 41 | 42 | def calculates_results_stats(results_dic): 43 | """ 44 | Calculates statistics of the results of the program run using classifier's model 45 | architecture to classifying pet images. Then puts the results statistics in a 46 | dictionary (results_stats_dic) so that it's returned for printing as to help 47 | the user to determine the 'best' model for classifying images. Note that 48 | the statistics calculated as the results are either percentages or counts. 49 | Parameters: 50 | results_dic - Dictionary with key as image filename and value as a List 51 | (index)idx 0 = pet image label (string) 52 | idx 1 = classifier label (string) 53 | idx 2 = 1/0 (int) where 1 = match between pet image and 54 | classifier labels and 0 = no match between labels 55 | idx 3 = 1/0 (int) where 1 = pet image 'is-a' dog and 56 | 0 = pet Image 'is-NOT-a' dog. 57 | idx 4 = 1/0 (int) where 1 = Classifier classifies image 58 | 'as-a' dog and 0 = Classifier classifies image 59 | 'as-NOT-a' dog. 60 | Returns: 61 | results_stats_dic - Dictionary that contains the results' statistics (either 62 | a percentage or a count) where the key is the statistic's 63 | name (starting with 'pct' for percentage or 'n' for count) 64 | and the value is the statistic's value. See comments above 65 | and the classroom Item XX Calculating Results for details 66 | on how to calculate the counts and statistics. 67 | """ 68 | # Creates empty dictionary for results_stats_dic 69 | results_stats_dic = {'n_dogs_img': 0, 'n_match': 0, 'n_correct_dogs': 0, 'n_correct_notdogs': 0, 70 | 'n_correct_breed': 0} 71 | 72 | # Sets all counters to initial values of zero so that they can 73 | # be incremented while processing through the images in results_dic 74 | 75 | # process through the results dictionary 76 | for key in results_dic: 77 | 78 | # Labels Match Exactly 79 | if results_dic[key][2] == 1: 80 | results_stats_dic['n_match'] += 1 81 | 82 | # Pet Image Label is a Dog AND Labels match-counts Correct Breed 83 | if results_dic[key][3] == 1 and results_dic[key][2] == 1: 84 | results_stats_dic['n_correct_breed'] += 1 85 | 86 | # Pet Image Label is a Dog - counts number of dog images 87 | if results_dic[key][3] == 1: 88 | results_stats_dic['n_dogs_img'] += 1 89 | 90 | # Classifier classifies image as Dog (& pet image is a dog) 91 | # counts number of correct dog classifications 92 | if results_dic[key][4] == 1: 93 | results_stats_dic['n_correct_dogs'] += 1 94 | 95 | # Pet Image Label is NOT a Dog 96 | else: 97 | # Classifier classifies image as NOT a Dog(& pet image isn't a dog) 98 | # counts number of correct NOT dog classifications. 99 | results_stats_dic['n_correct_notdogs'] += 1 100 | 101 | # Calculates run statistics (counts & percentages) below that are calculated 102 | # using the counters from above. 103 | 104 | # calculates number of total images 105 | results_stats_dic['n_images'] = len(results_dic) 106 | 107 | # calculates number of not-a-dog images using - images & dog images counts 108 | results_stats_dic['n_notdogs_img'] = (results_stats_dic['n_images'] - 109 | results_stats_dic['n_dogs_img']) 110 | 111 | # Calculates % correct for matches 112 | results_stats_dic['pct_match'] = (results_stats_dic['n_match'] / 113 | results_stats_dic['n_images']) * 100 114 | 115 | # Calculates % correct dogs 116 | results_stats_dic['pct_correct_dogs'] = (results_stats_dic['n_correct_dogs'] / 117 | results_stats_dic['n_dogs_img']) * 100 118 | 119 | # Calculates % correct breed of dog 120 | results_stats_dic['pct_correct_breed'] = (results_stats_dic['n_correct_breed'] / 121 | results_stats_dic['n_dogs_img']) * 100 122 | # Calculates % correct not-a-dog images 123 | # Uses conditional statement for when no 'not a dog' images were submitted 124 | if results_stats_dic['n_notdogs_img'] > 0: 125 | results_stats_dic['pct_correct_notdogs'] = (results_stats_dic['n_correct_notdogs'] / 126 | results_stats_dic['n_notdogs_img'])*100.0 127 | else: 128 | results_stats_dic['pct_correct_notdogs'] = 0.0 129 | 130 | return results_stats_dic 131 | -------------------------------------------------------------------------------- /vgg_pet-images.txt: -------------------------------------------------------------------------------- 1 | Command Line Arguments: 2 | dir = pet_images/ 3 | arch = vgg 4 | dogfile = dognames.txt 5 | 6 | Pet Image Label Dictionary has 40 key-value pairs. 7 | Below are 10 of them: 8 | 1 key: cat_01.jpg label: cat 9 | 2 key: Poodle_07927.jpg label: poodle 10 | 3 key: cat_02.jpg label: cat 11 | 4 key: Great_dane_05320.jpg label: great dane 12 | 5 key: Dalmatian_04068.jpg label: dalmatian 13 | 6 key: gecko_02.jpg label: gecko 14 | 7 key: cat_07.jpg label: cat 15 | 8 key: Great_pyrenees_05435.jpg label: great pyrenees 16 | 9 key: German_shepherd_dog_04931.jpg label: german shepherd dog 17 | 10 key: German_shepherd_dog_04890.jpg label: german shepherd dog 18 | 19 | MATCH: 20 | 21 | Poodle_07927.jpg: 22 | Real: poodle Classifier: standard poodle, poodle 23 | 24 | cat_02.jpg: 25 | Real: cat Classifier: tabby, tabby cat, cat 26 | 27 | Great_dane_05320.jpg: 28 | Real: great dane Classifier: great dane 29 | 30 | Dalmatian_04068.jpg: 31 | Real: dalmatian Classifier: dalmatian, coach dog, carriage dog 32 | 33 | gecko_02.jpg: 34 | Real: gecko Classifier: banded gecko, gecko 35 | 36 | cat_07.jpg: 37 | Real: cat Classifier: egyptian cat, cat 38 | 39 | Great_pyrenees_05435.jpg: 40 | Real: great pyrenees Classifier: great pyrenees 41 | 42 | German_shepherd_dog_04931.jpg: 43 | Real: german shepherd dog Classifier: german shepherd, german shepherd dog, german police dog, alsatian 44 | 45 | German_shepherd_dog_04890.jpg: 46 | Real: german shepherd dog Classifier: german shepherd, german shepherd dog, german police dog, alsatian 47 | 48 | Collie_03797.jpg: 49 | Real: collie Classifier: collie 50 | 51 | Saint_bernard_08010.jpg: 52 | Real: saint bernard Classifier: saint bernard, st bernard 53 | 54 | Dalmatian_04037.jpg: 55 | Real: dalmatian Classifier: dalmatian, coach dog, carriage dog 56 | 57 | Rabbit_002.jpg: 58 | Real: rabbit Classifier: wood rabbit, cottontail, cottontail rabbit, rabbit 59 | 60 | polar_bear_04.jpg: 61 | Real: polar bear Classifier: ice bear, polar bear, ursus maritimus, thalarctos maritimus 62 | 63 | Poodle_07956.jpg: 64 | Real: poodle Classifier: standard poodle, poodle 65 | 66 | fox_squirrel_01.jpg: 67 | Real: fox squirrel Classifier: fox squirrel, eastern fox squirrel, sciurus niger 68 | 69 | Boston_terrier_02285.jpg: 70 | Real: boston terrier Classifier: boston bull, boston terrier 71 | 72 | skunk_029.jpg: 73 | Real: skunk Classifier: skunk, polecat, wood pussy 74 | 75 | Boston_terrier_02303.jpg: 76 | Real: boston terrier Classifier: boston bull, boston terrier 77 | 78 | Miniature_schnauzer_06884.jpg: 79 | Real: miniature schnauzer Classifier: miniature schnauzer 80 | 81 | Beagle_01141.jpg: 82 | Real: beagle Classifier: beagle 83 | 84 | Basenji_00974.jpg: 85 | Real: basenji Classifier: basenji 86 | 87 | Dalmatian_04017.jpg: 88 | Real: dalmatian Classifier: dalmatian, coach dog, carriage dog 89 | 90 | Boxer_02426.jpg: 91 | Real: boxer Classifier: boxer 92 | 93 | Basenji_00963.jpg: 94 | Real: basenji Classifier: basenji 95 | 96 | Boston_terrier_02259.jpg: 97 | Real: boston terrier Classifier: boston bull, boston terrier 98 | 99 | Golden_retriever_05182.jpg: 100 | Real: golden retriever Classifier: golden retriever 101 | 102 | Golden_retriever_05223.jpg: 103 | Real: golden retriever Classifier: golden retriever 104 | 105 | Saint_bernard_08036.jpg: 106 | Real: saint bernard Classifier: saint bernard, st bernard 107 | 108 | Golden_retriever_05195.jpg: 109 | Real: golden retriever Classifier: golden retriever 110 | 111 | Beagle_01125.jpg: 112 | Real: beagle Classifier: beagle 113 | 114 | German_shorthaired_pointer_04986.jpg: 115 | Real: german shorthaired pointer Classifier: german shorthaired pointer 116 | 117 | Cocker_spaniel_03750.jpg: 118 | Real: cocker spaniel Classifier: cocker spaniel, english cocker spaniel, cocker 119 | 120 | Golden_retriever_05257.jpg: 121 | Real: golden retriever Classifier: golden retriever 122 | 123 | Basset_hound_01034.jpg: 124 | Real: basset hound Classifier: basset, basset hound 125 | 126 | NOT A MATCH: 127 | 128 | cat_01.jpg: 129 | Real: cat Classifier: lynx 130 | 131 | Beagle_01170.jpg: 132 | Real: beagle Classifier: walker hound, walker foxhound 133 | 134 | gecko_80.jpg: 135 | Real: gecko Classifier: tailed frog, bell toad, ribbed toad, tailed toad, ascaphus trui 136 | 137 | great_horned_owl_02.jpg: 138 | Real: great horned owl Classifier: ruffed grouse, partridge, bonasa umbellus 139 | 140 | Great_pyrenees_05367.jpg: 141 | Real: great pyrenees Classifier: kuvasz 142 | 143 | # Total Images 40 # Matches: 35 # NOT Matches: 5 144 | 145 | MATCH: 146 | 147 | Poodle_07927.jpg: 148 | Real: poodle Classifier: standard poodle, poodle 149 | PetLabelDog: 1 ClassLabelDog: 1 150 | 151 | cat_02.jpg: 152 | Real: cat Classifier: tabby, tabby cat, cat 153 | PetLabelDog: 0 ClassLabelDog: 0 154 | 155 | Great_dane_05320.jpg: 156 | Real: great dane Classifier: great dane 157 | PetLabelDog: 1 ClassLabelDog: 1 158 | 159 | Dalmatian_04068.jpg: 160 | Real: dalmatian Classifier: dalmatian, coach dog, carriage dog 161 | PetLabelDog: 1 ClassLabelDog: 1 162 | 163 | gecko_02.jpg: 164 | Real: gecko Classifier: banded gecko, gecko 165 | PetLabelDog: 0 ClassLabelDog: 0 166 | 167 | cat_07.jpg: 168 | Real: cat Classifier: egyptian cat, cat 169 | PetLabelDog: 0 ClassLabelDog: 0 170 | 171 | Great_pyrenees_05435.jpg: 172 | Real: great pyrenees Classifier: great pyrenees 173 | PetLabelDog: 1 ClassLabelDog: 1 174 | 175 | German_shepherd_dog_04931.jpg: 176 | Real: german shepherd dog Classifier: german shepherd, german shepherd dog, german police dog, alsatian 177 | PetLabelDog: 1 ClassLabelDog: 1 178 | 179 | German_shepherd_dog_04890.jpg: 180 | Real: german shepherd dog Classifier: german shepherd, german shepherd dog, german police dog, alsatian 181 | PetLabelDog: 1 ClassLabelDog: 1 182 | 183 | Collie_03797.jpg: 184 | Real: collie Classifier: collie 185 | PetLabelDog: 1 ClassLabelDog: 1 186 | 187 | Saint_bernard_08010.jpg: 188 | Real: saint bernard Classifier: saint bernard, st bernard 189 | PetLabelDog: 1 ClassLabelDog: 1 190 | 191 | Dalmatian_04037.jpg: 192 | Real: dalmatian Classifier: dalmatian, coach dog, carriage dog 193 | PetLabelDog: 1 ClassLabelDog: 1 194 | 195 | Rabbit_002.jpg: 196 | Real: rabbit Classifier: wood rabbit, cottontail, cottontail rabbit, rabbit 197 | PetLabelDog: 0 ClassLabelDog: 0 198 | 199 | polar_bear_04.jpg: 200 | Real: polar bear Classifier: ice bear, polar bear, ursus maritimus, thalarctos maritimus 201 | PetLabelDog: 0 ClassLabelDog: 0 202 | 203 | Poodle_07956.jpg: 204 | Real: poodle Classifier: standard poodle, poodle 205 | PetLabelDog: 1 ClassLabelDog: 1 206 | 207 | fox_squirrel_01.jpg: 208 | Real: fox squirrel Classifier: fox squirrel, eastern fox squirrel, sciurus niger 209 | PetLabelDog: 0 ClassLabelDog: 0 210 | 211 | Boston_terrier_02285.jpg: 212 | Real: boston terrier Classifier: boston bull, boston terrier 213 | PetLabelDog: 1 ClassLabelDog: 1 214 | 215 | skunk_029.jpg: 216 | Real: skunk Classifier: skunk, polecat, wood pussy 217 | PetLabelDog: 0 ClassLabelDog: 0 218 | 219 | Boston_terrier_02303.jpg: 220 | Real: boston terrier Classifier: boston bull, boston terrier 221 | PetLabelDog: 1 ClassLabelDog: 1 222 | 223 | Miniature_schnauzer_06884.jpg: 224 | Real: miniature schnauzer Classifier: miniature schnauzer 225 | PetLabelDog: 1 ClassLabelDog: 1 226 | 227 | Beagle_01141.jpg: 228 | Real: beagle Classifier: beagle 229 | PetLabelDog: 1 ClassLabelDog: 1 230 | 231 | Basenji_00974.jpg: 232 | Real: basenji Classifier: basenji 233 | PetLabelDog: 1 ClassLabelDog: 1 234 | 235 | Dalmatian_04017.jpg: 236 | Real: dalmatian Classifier: dalmatian, coach dog, carriage dog 237 | PetLabelDog: 1 ClassLabelDog: 1 238 | 239 | Boxer_02426.jpg: 240 | Real: boxer Classifier: boxer 241 | PetLabelDog: 1 ClassLabelDog: 1 242 | 243 | Basenji_00963.jpg: 244 | Real: basenji Classifier: basenji 245 | PetLabelDog: 1 ClassLabelDog: 1 246 | 247 | Boston_terrier_02259.jpg: 248 | Real: boston terrier Classifier: boston bull, boston terrier 249 | PetLabelDog: 1 ClassLabelDog: 1 250 | 251 | Golden_retriever_05182.jpg: 252 | Real: golden retriever Classifier: golden retriever 253 | PetLabelDog: 1 ClassLabelDog: 1 254 | 255 | Golden_retriever_05223.jpg: 256 | Real: golden retriever Classifier: golden retriever 257 | PetLabelDog: 1 ClassLabelDog: 1 258 | 259 | Saint_bernard_08036.jpg: 260 | Real: saint bernard Classifier: saint bernard, st bernard 261 | PetLabelDog: 1 ClassLabelDog: 1 262 | 263 | Golden_retriever_05195.jpg: 264 | Real: golden retriever Classifier: golden retriever 265 | PetLabelDog: 1 ClassLabelDog: 1 266 | 267 | Beagle_01125.jpg: 268 | Real: beagle Classifier: beagle 269 | PetLabelDog: 1 ClassLabelDog: 1 270 | 271 | German_shorthaired_pointer_04986.jpg: 272 | Real: german shorthaired pointer Classifier: german shorthaired pointer 273 | PetLabelDog: 1 ClassLabelDog: 1 274 | 275 | Cocker_spaniel_03750.jpg: 276 | Real: cocker spaniel Classifier: cocker spaniel, english cocker spaniel, cocker 277 | PetLabelDog: 1 ClassLabelDog: 1 278 | 279 | Golden_retriever_05257.jpg: 280 | Real: golden retriever Classifier: golden retriever 281 | PetLabelDog: 1 ClassLabelDog: 1 282 | 283 | Basset_hound_01034.jpg: 284 | Real: basset hound Classifier: basset, basset hound 285 | PetLabelDog: 1 ClassLabelDog: 1 286 | 287 | NOT A MATCH: 288 | 289 | cat_01.jpg: 290 | Real: cat Classifier: lynx 291 | PetLabelDog: 0 ClassLabelDog: 0 292 | 293 | Beagle_01170.jpg: 294 | Real: beagle Classifier: walker hound, walker foxhound 295 | PetLabelDog: 1 ClassLabelDog: 1 296 | 297 | gecko_80.jpg: 298 | Real: gecko Classifier: tailed frog, bell toad, ribbed toad, tailed toad, ascaphus trui 299 | PetLabelDog: 0 ClassLabelDog: 0 300 | 301 | great_horned_owl_02.jpg: 302 | Real: great horned owl Classifier: ruffed grouse, partridge, bonasa umbellus 303 | PetLabelDog: 0 ClassLabelDog: 0 304 | 305 | Great_pyrenees_05367.jpg: 306 | Real: great pyrenees Classifier: kuvasz 307 | PetLabelDog: 1 ClassLabelDog: 1 308 | 309 | # Total Images 40 # Matches: 35 # NOT Matches: 5 310 | 311 | ** Statistics from calculates_results_stats() function: 312 | N Images: 40 N Dog Images: 30 N NotDog Images: 10 313 | Pct Corr dog: 100.0 Pct Corr NOTdog: 100.0 Pct Corr Breed: 93.3 314 | 315 | ** Check Statistics - calculated from this function as a check: 316 | N Images: 40 N Dog Images: 30 N NotDog Images: 10 317 | Pct Corr dog: 100.0 Pct Corr NOTdog: 100.0 Pct Corr Breed: 93.3 318 | 319 | 320 | *** Results Summary for CNN Model Architecture VGG *** 321 | N Images : 40 322 | N Dog Images : 30 323 | N Not-Dog Images : 10 324 | 325 | pct_match: 87.5 326 | pct_correct_dogs: 100.0 327 | pct_correct_breed: 93.33333333333333 328 | pct_correct_notdogs: 100.0 329 | 330 | INCORRECT Dog Breed Assignment: 331 | Real: beagle Classifier: walker hound, walker foxhound 332 | Real: great pyrenees Classifier: kuvasz 333 | 334 | ** Total Elapsed Runtime: 0:0:23 335 | -------------------------------------------------------------------------------- /resnet_pet-images.txt: -------------------------------------------------------------------------------- 1 | Command Line Arguments: 2 | dir = pet_images/ 3 | arch = resnet 4 | dogfile = dognames.txt 5 | 6 | Pet Image Label Dictionary has 40 key-value pairs. 7 | Below are 10 of them: 8 | 1 key: cat_01.jpg label: cat 9 | 2 key: Poodle_07927.jpg label: poodle 10 | 3 key: cat_02.jpg label: cat 11 | 4 key: Great_dane_05320.jpg label: great dane 12 | 5 key: Dalmatian_04068.jpg label: dalmatian 13 | 6 key: gecko_02.jpg label: gecko 14 | 7 key: cat_07.jpg label: cat 15 | 8 key: Great_pyrenees_05435.jpg label: great pyrenees 16 | 9 key: German_shepherd_dog_04931.jpg label: german shepherd dog 17 | 10 key: German_shepherd_dog_04890.jpg label: german shepherd dog 18 | 19 | MATCH: 20 | 21 | Poodle_07927.jpg: 22 | Real: poodle Classifier: standard poodle, poodle 23 | 24 | cat_02.jpg: 25 | Real: cat Classifier: tabby, tabby cat, cat 26 | 27 | Great_dane_05320.jpg: 28 | Real: great dane Classifier: great dane 29 | 30 | Dalmatian_04068.jpg: 31 | Real: dalmatian Classifier: dalmatian, coach dog, carriage dog 32 | 33 | cat_07.jpg: 34 | Real: cat Classifier: egyptian cat, cat 35 | 36 | Great_pyrenees_05435.jpg: 37 | Real: great pyrenees Classifier: great pyrenees 38 | 39 | German_shepherd_dog_04931.jpg: 40 | Real: german shepherd dog Classifier: german shepherd, german shepherd dog, german police dog, alsatian 41 | 42 | German_shepherd_dog_04890.jpg: 43 | Real: german shepherd dog Classifier: german shepherd, german shepherd dog, german police dog, alsatian 44 | 45 | Collie_03797.jpg: 46 | Real: collie Classifier: collie 47 | 48 | Saint_bernard_08010.jpg: 49 | Real: saint bernard Classifier: saint bernard, st bernard 50 | 51 | Dalmatian_04037.jpg: 52 | Real: dalmatian Classifier: dalmatian, coach dog, carriage dog 53 | 54 | Rabbit_002.jpg: 55 | Real: rabbit Classifier: wood rabbit, cottontail, cottontail rabbit, rabbit 56 | 57 | polar_bear_04.jpg: 58 | Real: polar bear Classifier: ice bear, polar bear, ursus maritimus, thalarctos maritimus 59 | 60 | Poodle_07956.jpg: 61 | Real: poodle Classifier: standard poodle, poodle 62 | 63 | fox_squirrel_01.jpg: 64 | Real: fox squirrel Classifier: fox squirrel, eastern fox squirrel, sciurus niger 65 | 66 | Boston_terrier_02285.jpg: 67 | Real: boston terrier Classifier: boston bull, boston terrier 68 | 69 | skunk_029.jpg: 70 | Real: skunk Classifier: skunk, polecat, wood pussy 71 | 72 | Boston_terrier_02303.jpg: 73 | Real: boston terrier Classifier: boston bull, boston terrier 74 | 75 | Miniature_schnauzer_06884.jpg: 76 | Real: miniature schnauzer Classifier: miniature schnauzer 77 | 78 | Beagle_01141.jpg: 79 | Real: beagle Classifier: beagle 80 | 81 | Basenji_00974.jpg: 82 | Real: basenji Classifier: basenji 83 | 84 | Dalmatian_04017.jpg: 85 | Real: dalmatian Classifier: dalmatian, coach dog, carriage dog 86 | 87 | Boxer_02426.jpg: 88 | Real: boxer Classifier: boxer 89 | 90 | Basenji_00963.jpg: 91 | Real: basenji Classifier: basenji 92 | 93 | Boston_terrier_02259.jpg: 94 | Real: boston terrier Classifier: boston bull, boston terrier 95 | 96 | Golden_retriever_05223.jpg: 97 | Real: golden retriever Classifier: golden retriever 98 | 99 | Saint_bernard_08036.jpg: 100 | Real: saint bernard Classifier: saint bernard, st bernard 101 | 102 | Golden_retriever_05195.jpg: 103 | Real: golden retriever Classifier: golden retriever 104 | 105 | Beagle_01125.jpg: 106 | Real: beagle Classifier: beagle 107 | 108 | German_shorthaired_pointer_04986.jpg: 109 | Real: german shorthaired pointer Classifier: german shorthaired pointer 110 | 111 | Cocker_spaniel_03750.jpg: 112 | Real: cocker spaniel Classifier: cocker spaniel, english cocker spaniel, cocker 113 | 114 | Golden_retriever_05257.jpg: 115 | Real: golden retriever Classifier: golden retriever 116 | 117 | Basset_hound_01034.jpg: 118 | Real: basset hound Classifier: basset, basset hound 119 | 120 | NOT A MATCH: 121 | 122 | cat_01.jpg: 123 | Real: cat Classifier: norwegian elkhound, elkhound 124 | 125 | gecko_02.jpg: 126 | Real: gecko Classifier: african chameleon, chamaeleo chamaeleon 127 | 128 | Beagle_01170.jpg: 129 | Real: beagle Classifier: walker hound, walker foxhound 130 | 131 | gecko_80.jpg: 132 | Real: gecko Classifier: tailed frog, bell toad, ribbed toad, tailed toad, ascaphus trui 133 | 134 | Golden_retriever_05182.jpg: 135 | Real: golden retriever Classifier: leonberg 136 | 137 | great_horned_owl_02.jpg: 138 | Real: great horned owl Classifier: great grey owl, great gray owl, strix nebulosa 139 | 140 | Great_pyrenees_05367.jpg: 141 | Real: great pyrenees Classifier: kuvasz 142 | 143 | # Total Images 40 # Matches: 33 # NOT Matches: 7 144 | 145 | MATCH: 146 | 147 | Poodle_07927.jpg: 148 | Real: poodle Classifier: standard poodle, poodle 149 | PetLabelDog: 1 ClassLabelDog: 1 150 | 151 | cat_02.jpg: 152 | Real: cat Classifier: tabby, tabby cat, cat 153 | PetLabelDog: 0 ClassLabelDog: 0 154 | 155 | Great_dane_05320.jpg: 156 | Real: great dane Classifier: great dane 157 | PetLabelDog: 1 ClassLabelDog: 1 158 | 159 | Dalmatian_04068.jpg: 160 | Real: dalmatian Classifier: dalmatian, coach dog, carriage dog 161 | PetLabelDog: 1 ClassLabelDog: 1 162 | 163 | cat_07.jpg: 164 | Real: cat Classifier: egyptian cat, cat 165 | PetLabelDog: 0 ClassLabelDog: 0 166 | 167 | Great_pyrenees_05435.jpg: 168 | Real: great pyrenees Classifier: great pyrenees 169 | PetLabelDog: 1 ClassLabelDog: 1 170 | 171 | German_shepherd_dog_04931.jpg: 172 | Real: german shepherd dog Classifier: german shepherd, german shepherd dog, german police dog, alsatian 173 | PetLabelDog: 1 ClassLabelDog: 1 174 | 175 | German_shepherd_dog_04890.jpg: 176 | Real: german shepherd dog Classifier: german shepherd, german shepherd dog, german police dog, alsatian 177 | PetLabelDog: 1 ClassLabelDog: 1 178 | 179 | Collie_03797.jpg: 180 | Real: collie Classifier: collie 181 | PetLabelDog: 1 ClassLabelDog: 1 182 | 183 | Saint_bernard_08010.jpg: 184 | Real: saint bernard Classifier: saint bernard, st bernard 185 | PetLabelDog: 1 ClassLabelDog: 1 186 | 187 | Dalmatian_04037.jpg: 188 | Real: dalmatian Classifier: dalmatian, coach dog, carriage dog 189 | PetLabelDog: 1 ClassLabelDog: 1 190 | 191 | Rabbit_002.jpg: 192 | Real: rabbit Classifier: wood rabbit, cottontail, cottontail rabbit, rabbit 193 | PetLabelDog: 0 ClassLabelDog: 0 194 | 195 | polar_bear_04.jpg: 196 | Real: polar bear Classifier: ice bear, polar bear, ursus maritimus, thalarctos maritimus 197 | PetLabelDog: 0 ClassLabelDog: 0 198 | 199 | Poodle_07956.jpg: 200 | Real: poodle Classifier: standard poodle, poodle 201 | PetLabelDog: 1 ClassLabelDog: 1 202 | 203 | fox_squirrel_01.jpg: 204 | Real: fox squirrel Classifier: fox squirrel, eastern fox squirrel, sciurus niger 205 | PetLabelDog: 0 ClassLabelDog: 0 206 | 207 | Boston_terrier_02285.jpg: 208 | Real: boston terrier Classifier: boston bull, boston terrier 209 | PetLabelDog: 1 ClassLabelDog: 1 210 | 211 | skunk_029.jpg: 212 | Real: skunk Classifier: skunk, polecat, wood pussy 213 | PetLabelDog: 0 ClassLabelDog: 0 214 | 215 | Boston_terrier_02303.jpg: 216 | Real: boston terrier Classifier: boston bull, boston terrier 217 | PetLabelDog: 1 ClassLabelDog: 1 218 | 219 | Miniature_schnauzer_06884.jpg: 220 | Real: miniature schnauzer Classifier: miniature schnauzer 221 | PetLabelDog: 1 ClassLabelDog: 1 222 | 223 | Beagle_01141.jpg: 224 | Real: beagle Classifier: beagle 225 | PetLabelDog: 1 ClassLabelDog: 1 226 | 227 | Basenji_00974.jpg: 228 | Real: basenji Classifier: basenji 229 | PetLabelDog: 1 ClassLabelDog: 1 230 | 231 | Dalmatian_04017.jpg: 232 | Real: dalmatian Classifier: dalmatian, coach dog, carriage dog 233 | PetLabelDog: 1 ClassLabelDog: 1 234 | 235 | Boxer_02426.jpg: 236 | Real: boxer Classifier: boxer 237 | PetLabelDog: 1 ClassLabelDog: 1 238 | 239 | Basenji_00963.jpg: 240 | Real: basenji Classifier: basenji 241 | PetLabelDog: 1 ClassLabelDog: 1 242 | 243 | Boston_terrier_02259.jpg: 244 | Real: boston terrier Classifier: boston bull, boston terrier 245 | PetLabelDog: 1 ClassLabelDog: 1 246 | 247 | Golden_retriever_05223.jpg: 248 | Real: golden retriever Classifier: golden retriever 249 | PetLabelDog: 1 ClassLabelDog: 1 250 | 251 | Saint_bernard_08036.jpg: 252 | Real: saint bernard Classifier: saint bernard, st bernard 253 | PetLabelDog: 1 ClassLabelDog: 1 254 | 255 | Golden_retriever_05195.jpg: 256 | Real: golden retriever Classifier: golden retriever 257 | PetLabelDog: 1 ClassLabelDog: 1 258 | 259 | Beagle_01125.jpg: 260 | Real: beagle Classifier: beagle 261 | PetLabelDog: 1 ClassLabelDog: 1 262 | 263 | German_shorthaired_pointer_04986.jpg: 264 | Real: german shorthaired pointer Classifier: german shorthaired pointer 265 | PetLabelDog: 1 ClassLabelDog: 1 266 | 267 | Cocker_spaniel_03750.jpg: 268 | Real: cocker spaniel Classifier: cocker spaniel, english cocker spaniel, cocker 269 | PetLabelDog: 1 ClassLabelDog: 1 270 | 271 | Golden_retriever_05257.jpg: 272 | Real: golden retriever Classifier: golden retriever 273 | PetLabelDog: 1 ClassLabelDog: 1 274 | 275 | Basset_hound_01034.jpg: 276 | Real: basset hound Classifier: basset, basset hound 277 | PetLabelDog: 1 ClassLabelDog: 1 278 | 279 | NOT A MATCH: 280 | 281 | cat_01.jpg: 282 | Real: cat Classifier: norwegian elkhound, elkhound 283 | PetLabelDog: 0 ClassLabelDog: 1 284 | 285 | gecko_02.jpg: 286 | Real: gecko Classifier: african chameleon, chamaeleo chamaeleon 287 | PetLabelDog: 0 ClassLabelDog: 0 288 | 289 | Beagle_01170.jpg: 290 | Real: beagle Classifier: walker hound, walker foxhound 291 | PetLabelDog: 1 ClassLabelDog: 1 292 | 293 | gecko_80.jpg: 294 | Real: gecko Classifier: tailed frog, bell toad, ribbed toad, tailed toad, ascaphus trui 295 | PetLabelDog: 0 ClassLabelDog: 0 296 | 297 | Golden_retriever_05182.jpg: 298 | Real: golden retriever Classifier: leonberg 299 | PetLabelDog: 1 ClassLabelDog: 1 300 | 301 | great_horned_owl_02.jpg: 302 | Real: great horned owl Classifier: great grey owl, great gray owl, strix nebulosa 303 | PetLabelDog: 0 ClassLabelDog: 0 304 | 305 | Great_pyrenees_05367.jpg: 306 | Real: great pyrenees Classifier: kuvasz 307 | PetLabelDog: 1 ClassLabelDog: 1 308 | 309 | # Total Images 40 # Matches: 33 # NOT Matches: 7 310 | 311 | ** Statistics from calculates_results_stats() function: 312 | N Images: 40 N Dog Images: 30 N NotDog Images: 10 313 | Pct Corr dog: 100.0 Pct Corr NOTdog: 100.0 Pct Corr Breed: 90.0 314 | 315 | ** Check Statistics - calculated from this function as a check: 316 | N Images: 40 N Dog Images: 30 N NotDog Images: 10 317 | Pct Corr dog: 100.0 Pct Corr NOTdog: 90.0 Pct Corr Breed: 90.0 318 | 319 | 320 | *** Results Summary for CNN Model Architecture RESNET *** 321 | N Images : 40 322 | N Dog Images : 30 323 | N Not-Dog Images : 10 324 | 325 | pct_match: 82.5 326 | pct_correct_dogs: 100.0 327 | pct_correct_breed: 90.0 328 | pct_correct_notdogs: 100.0 329 | 330 | INCORRECT Dog Breed Assignment: 331 | Real: beagle Classifier: walker hound, walker foxhound 332 | Real: golden retriever Classifier: leonberg 333 | Real: great pyrenees Classifier: kuvasz 334 | 335 | ** Total Elapsed Runtime: 0:0:4 336 | -------------------------------------------------------------------------------- /alexnet_pet-images.txt: -------------------------------------------------------------------------------- 1 | Command Line Arguments: 2 | dir = pet_images/ 3 | arch = alexnet 4 | dogfile = dognames.txt 5 | 6 | Pet Image Label Dictionary has 40 key-value pairs. 7 | Below are 10 of them: 8 | 1 key: cat_01.jpg label: cat 9 | 2 key: Poodle_07927.jpg label: poodle 10 | 3 key: cat_02.jpg label: cat 11 | 4 key: Great_dane_05320.jpg label: great dane 12 | 5 key: Dalmatian_04068.jpg label: dalmatian 13 | 6 key: gecko_02.jpg label: gecko 14 | 7 key: cat_07.jpg label: cat 15 | 8 key: Great_pyrenees_05435.jpg label: great pyrenees 16 | 9 key: German_shepherd_dog_04931.jpg label: german shepherd dog 17 | 10 key: German_shepherd_dog_04890.jpg label: german shepherd dog 18 | 19 | MATCH: 20 | 21 | Poodle_07927.jpg: 22 | Real: poodle Classifier: standard poodle, poodle 23 | 24 | cat_02.jpg: 25 | Real: cat Classifier: tiger cat, cat 26 | 27 | Great_dane_05320.jpg: 28 | Real: great dane Classifier: great dane 29 | 30 | Dalmatian_04068.jpg: 31 | Real: dalmatian Classifier: dalmatian, coach dog, carriage dog 32 | 33 | cat_07.jpg: 34 | Real: cat Classifier: egyptian cat, cat 35 | 36 | Great_pyrenees_05435.jpg: 37 | Real: great pyrenees Classifier: great pyrenees 38 | 39 | German_shepherd_dog_04931.jpg: 40 | Real: german shepherd dog Classifier: german shepherd, german shepherd dog, german police dog, alsatian 41 | 42 | German_shepherd_dog_04890.jpg: 43 | Real: german shepherd dog Classifier: german shepherd, german shepherd dog, german police dog, alsatian 44 | 45 | Collie_03797.jpg: 46 | Real: collie Classifier: collie 47 | 48 | Saint_bernard_08010.jpg: 49 | Real: saint bernard Classifier: saint bernard, st bernard 50 | 51 | Dalmatian_04037.jpg: 52 | Real: dalmatian Classifier: dalmatian, coach dog, carriage dog 53 | 54 | Rabbit_002.jpg: 55 | Real: rabbit Classifier: wood rabbit, cottontail, cottontail rabbit, rabbit 56 | 57 | polar_bear_04.jpg: 58 | Real: polar bear Classifier: ice bear, polar bear, ursus maritimus, thalarctos maritimus 59 | 60 | Poodle_07956.jpg: 61 | Real: poodle Classifier: standard poodle, poodle 62 | 63 | fox_squirrel_01.jpg: 64 | Real: fox squirrel Classifier: fox squirrel, eastern fox squirrel, sciurus niger 65 | 66 | skunk_029.jpg: 67 | Real: skunk Classifier: skunk, polecat, wood pussy 68 | 69 | Boston_terrier_02303.jpg: 70 | Real: boston terrier Classifier: boston bull, boston terrier 71 | 72 | Miniature_schnauzer_06884.jpg: 73 | Real: miniature schnauzer Classifier: miniature schnauzer 74 | 75 | Basenji_00974.jpg: 76 | Real: basenji Classifier: basenji 77 | 78 | Dalmatian_04017.jpg: 79 | Real: dalmatian Classifier: dalmatian, coach dog, carriage dog 80 | 81 | Boxer_02426.jpg: 82 | Real: boxer Classifier: boxer 83 | 84 | Basenji_00963.jpg: 85 | Real: basenji Classifier: basenji 86 | 87 | Boston_terrier_02259.jpg: 88 | Real: boston terrier Classifier: boston bull, boston terrier 89 | 90 | Golden_retriever_05223.jpg: 91 | Real: golden retriever Classifier: golden retriever 92 | 93 | Saint_bernard_08036.jpg: 94 | Real: saint bernard Classifier: saint bernard, st bernard 95 | 96 | Golden_retriever_05195.jpg: 97 | Real: golden retriever Classifier: golden retriever 98 | 99 | Beagle_01125.jpg: 100 | Real: beagle Classifier: beagle 101 | 102 | German_shorthaired_pointer_04986.jpg: 103 | Real: german shorthaired pointer Classifier: german shorthaired pointer 104 | 105 | Cocker_spaniel_03750.jpg: 106 | Real: cocker spaniel Classifier: cocker spaniel, english cocker spaniel, cocker 107 | 108 | Basset_hound_01034.jpg: 109 | Real: basset hound Classifier: basset, basset hound 110 | 111 | NOT A MATCH: 112 | 113 | cat_01.jpg: 114 | Real: cat Classifier: african hunting dog, hyena dog, cape hunting dog, lycaon pictus 115 | 116 | gecko_02.jpg: 117 | Real: gecko Classifier: alligator lizard 118 | 119 | Beagle_01170.jpg: 120 | Real: beagle Classifier: walker hound, walker foxhound 121 | 122 | Boston_terrier_02285.jpg: 123 | Real: boston terrier Classifier: basenji 124 | 125 | Beagle_01141.jpg: 126 | Real: beagle Classifier: english foxhound 127 | 128 | gecko_80.jpg: 129 | Real: gecko Classifier: tree frog, tree-frog 130 | 131 | Golden_retriever_05182.jpg: 132 | Real: golden retriever Classifier: tibetan mastiff 133 | 134 | great_horned_owl_02.jpg: 135 | Real: great horned owl Classifier: ruffed grouse, partridge, bonasa umbellus 136 | 137 | Great_pyrenees_05367.jpg: 138 | Real: great pyrenees Classifier: kuvasz 139 | 140 | Golden_retriever_05257.jpg: 141 | Real: golden retriever Classifier: afghan hound, afghan 142 | 143 | # Total Images 40 # Matches: 30 # NOT Matches: 10 144 | 145 | MATCH: 146 | 147 | Poodle_07927.jpg: 148 | Real: poodle Classifier: standard poodle, poodle 149 | PetLabelDog: 1 ClassLabelDog: 1 150 | 151 | cat_02.jpg: 152 | Real: cat Classifier: tiger cat, cat 153 | PetLabelDog: 0 ClassLabelDog: 0 154 | 155 | Great_dane_05320.jpg: 156 | Real: great dane Classifier: great dane 157 | PetLabelDog: 1 ClassLabelDog: 1 158 | 159 | Dalmatian_04068.jpg: 160 | Real: dalmatian Classifier: dalmatian, coach dog, carriage dog 161 | PetLabelDog: 1 ClassLabelDog: 1 162 | 163 | cat_07.jpg: 164 | Real: cat Classifier: egyptian cat, cat 165 | PetLabelDog: 0 ClassLabelDog: 0 166 | 167 | Great_pyrenees_05435.jpg: 168 | Real: great pyrenees Classifier: great pyrenees 169 | PetLabelDog: 1 ClassLabelDog: 1 170 | 171 | German_shepherd_dog_04931.jpg: 172 | Real: german shepherd dog Classifier: german shepherd, german shepherd dog, german police dog, alsatian 173 | PetLabelDog: 1 ClassLabelDog: 1 174 | 175 | German_shepherd_dog_04890.jpg: 176 | Real: german shepherd dog Classifier: german shepherd, german shepherd dog, german police dog, alsatian 177 | PetLabelDog: 1 ClassLabelDog: 1 178 | 179 | Collie_03797.jpg: 180 | Real: collie Classifier: collie 181 | PetLabelDog: 1 ClassLabelDog: 1 182 | 183 | Saint_bernard_08010.jpg: 184 | Real: saint bernard Classifier: saint bernard, st bernard 185 | PetLabelDog: 1 ClassLabelDog: 1 186 | 187 | Dalmatian_04037.jpg: 188 | Real: dalmatian Classifier: dalmatian, coach dog, carriage dog 189 | PetLabelDog: 1 ClassLabelDog: 1 190 | 191 | Rabbit_002.jpg: 192 | Real: rabbit Classifier: wood rabbit, cottontail, cottontail rabbit, rabbit 193 | PetLabelDog: 0 ClassLabelDog: 0 194 | 195 | polar_bear_04.jpg: 196 | Real: polar bear Classifier: ice bear, polar bear, ursus maritimus, thalarctos maritimus 197 | PetLabelDog: 0 ClassLabelDog: 0 198 | 199 | Poodle_07956.jpg: 200 | Real: poodle Classifier: standard poodle, poodle 201 | PetLabelDog: 1 ClassLabelDog: 1 202 | 203 | fox_squirrel_01.jpg: 204 | Real: fox squirrel Classifier: fox squirrel, eastern fox squirrel, sciurus niger 205 | PetLabelDog: 0 ClassLabelDog: 0 206 | 207 | skunk_029.jpg: 208 | Real: skunk Classifier: skunk, polecat, wood pussy 209 | PetLabelDog: 0 ClassLabelDog: 0 210 | 211 | Boston_terrier_02303.jpg: 212 | Real: boston terrier Classifier: boston bull, boston terrier 213 | PetLabelDog: 1 ClassLabelDog: 1 214 | 215 | Miniature_schnauzer_06884.jpg: 216 | Real: miniature schnauzer Classifier: miniature schnauzer 217 | PetLabelDog: 1 ClassLabelDog: 1 218 | 219 | Basenji_00974.jpg: 220 | Real: basenji Classifier: basenji 221 | PetLabelDog: 1 ClassLabelDog: 1 222 | 223 | Dalmatian_04017.jpg: 224 | Real: dalmatian Classifier: dalmatian, coach dog, carriage dog 225 | PetLabelDog: 1 ClassLabelDog: 1 226 | 227 | Boxer_02426.jpg: 228 | Real: boxer Classifier: boxer 229 | PetLabelDog: 1 ClassLabelDog: 1 230 | 231 | Basenji_00963.jpg: 232 | Real: basenji Classifier: basenji 233 | PetLabelDog: 1 ClassLabelDog: 1 234 | 235 | Boston_terrier_02259.jpg: 236 | Real: boston terrier Classifier: boston bull, boston terrier 237 | PetLabelDog: 1 ClassLabelDog: 1 238 | 239 | Golden_retriever_05223.jpg: 240 | Real: golden retriever Classifier: golden retriever 241 | PetLabelDog: 1 ClassLabelDog: 1 242 | 243 | Saint_bernard_08036.jpg: 244 | Real: saint bernard Classifier: saint bernard, st bernard 245 | PetLabelDog: 1 ClassLabelDog: 1 246 | 247 | Golden_retriever_05195.jpg: 248 | Real: golden retriever Classifier: golden retriever 249 | PetLabelDog: 1 ClassLabelDog: 1 250 | 251 | Beagle_01125.jpg: 252 | Real: beagle Classifier: beagle 253 | PetLabelDog: 1 ClassLabelDog: 1 254 | 255 | German_shorthaired_pointer_04986.jpg: 256 | Real: german shorthaired pointer Classifier: german shorthaired pointer 257 | PetLabelDog: 1 ClassLabelDog: 1 258 | 259 | Cocker_spaniel_03750.jpg: 260 | Real: cocker spaniel Classifier: cocker spaniel, english cocker spaniel, cocker 261 | PetLabelDog: 1 ClassLabelDog: 1 262 | 263 | Basset_hound_01034.jpg: 264 | Real: basset hound Classifier: basset, basset hound 265 | PetLabelDog: 1 ClassLabelDog: 1 266 | 267 | NOT A MATCH: 268 | 269 | cat_01.jpg: 270 | Real: cat Classifier: african hunting dog, hyena dog, cape hunting dog, lycaon pictus 271 | PetLabelDog: 0 ClassLabelDog: 0 272 | 273 | gecko_02.jpg: 274 | Real: gecko Classifier: alligator lizard 275 | PetLabelDog: 0 ClassLabelDog: 0 276 | 277 | Beagle_01170.jpg: 278 | Real: beagle Classifier: walker hound, walker foxhound 279 | PetLabelDog: 1 ClassLabelDog: 1 280 | 281 | Boston_terrier_02285.jpg: 282 | Real: boston terrier Classifier: basenji 283 | PetLabelDog: 1 ClassLabelDog: 1 284 | 285 | Beagle_01141.jpg: 286 | Real: beagle Classifier: english foxhound 287 | PetLabelDog: 1 ClassLabelDog: 1 288 | 289 | gecko_80.jpg: 290 | Real: gecko Classifier: tree frog, tree-frog 291 | PetLabelDog: 0 ClassLabelDog: 0 292 | 293 | Golden_retriever_05182.jpg: 294 | Real: golden retriever Classifier: tibetan mastiff 295 | PetLabelDog: 1 ClassLabelDog: 1 296 | 297 | great_horned_owl_02.jpg: 298 | Real: great horned owl Classifier: ruffed grouse, partridge, bonasa umbellus 299 | PetLabelDog: 0 ClassLabelDog: 0 300 | 301 | Great_pyrenees_05367.jpg: 302 | Real: great pyrenees Classifier: kuvasz 303 | PetLabelDog: 1 ClassLabelDog: 1 304 | 305 | Golden_retriever_05257.jpg: 306 | Real: golden retriever Classifier: afghan hound, afghan 307 | PetLabelDog: 1 ClassLabelDog: 1 308 | 309 | # Total Images 40 # Matches: 30 # NOT Matches: 10 310 | 311 | ** Statistics from calculates_results_stats() function: 312 | N Images: 40 N Dog Images: 30 N NotDog Images: 10 313 | Pct Corr dog: 100.0 Pct Corr NOTdog: 100.0 Pct Corr Breed: 80.0 314 | 315 | ** Check Statistics - calculated from this function as a check: 316 | N Images: 40 N Dog Images: 30 N NotDog Images: 10 317 | Pct Corr dog: 100.0 Pct Corr NOTdog: 100.0 Pct Corr Breed: 80.0 318 | 319 | 320 | *** Results Summary for CNN Model Architecture ALEXNET *** 321 | N Images : 40 322 | N Dog Images : 30 323 | N Not-Dog Images : 10 324 | 325 | pct_match: 75.0 326 | pct_correct_dogs: 100.0 327 | pct_correct_breed: 80.0 328 | pct_correct_notdogs: 100.0 329 | 330 | INCORRECT Dog Breed Assignment: 331 | Real: beagle Classifier: walker hound, walker foxhound 332 | Real: boston terrier Classifier: basenji 333 | Real: beagle Classifier: english foxhound 334 | Real: golden retriever Classifier: tibetan mastiff 335 | Real: great pyrenees Classifier: kuvasz 336 | Real: golden retriever Classifier: afghan hound, afghan 337 | 338 | ** Total Elapsed Runtime: 0:0:1 339 | -------------------------------------------------------------------------------- /print_functions_for_lab_checks.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python3 2 | # -*- coding: utf-8 -*- 3 | # */AIPND/intropylab-classifying-images/print_functions_for_lab_checks.py 4 | # 5 | # PROGRAMMER: Jennifer S. 6 | # DATE CREATED: 05/14/2018 7 | # REVISED DATE: <=(Date Revised - if any) 8 | # PURPOSE: This set of functions can be used to check your code after programming 9 | # each function. The top section of each part of the lab contains 10 | # the section labeled 'Checking your code'. When directed within this 11 | # section of the lab one can use these functions to more easily check 12 | # your code. See the docstrings below each function for details on how 13 | # to use the function within your code. 14 | # 15 | ## 16 | 17 | # Functions below defined to help with "Checking your code", specifically 18 | # running these functions with the appropriate input arguments within the 19 | # main() funtion will print out what's needed for "Checking your code" 20 | # 21 | def check_command_line_arguments(in_arg): 22 | """ 23 | For Lab: Classifying Images - 7. Command Line Arguments 24 | Prints each of the command line arguments passed in as parameter in_arg, 25 | assumes you defined all three command line arguments as outlined in 26 | '7. Command Line Arguments' 27 | Parameters: 28 | in_arg -data structure that stores the command line arguments object 29 | Returns: 30 | Nothing - just prints to console 31 | """ 32 | if in_arg is None: 33 | print("* Doesn't Check the Command Line Arguments because 'get_input_args' hasn't been defined.") 34 | else: 35 | # prints command line agrs 36 | print("Command Line Arguments:\n dir =", in_arg.dir, 37 | "\n arch =", in_arg.arch, "\n dogfile =", in_arg.dogfile) 38 | 39 | 40 | def check_creating_pet_image_labels(results_dic): 41 | """ For Lab: Classifying Images - 9/10. Creating Pet Image Labels 42 | Prints first 10 key-value pairs and makes sure there are 40 key-value 43 | pairs in your results_dic dictionary. Assumes you defined the results_dic 44 | dictionary as was outlined in 45 | '9/10. Creating Pet Image Labels' 46 | Parameters: 47 | results_dic - Dictionary with key as image filename and value as a List 48 | (index)idx 0 = pet image label (string) 49 | Returns: 50 | Nothing - just prints to console 51 | """ 52 | if results_dic is None: 53 | print("* Doesn't Check the Results Dictionary because 'get_pet_labels' hasn't been defined.") 54 | else: 55 | # Code to print 10 key-value pairs (or fewer if less than 10 images) 56 | # & makes sure there are 40 pairs, one for each file in pet_images/ 57 | stop_point = len(results_dic) 58 | if stop_point > 10: 59 | stop_point = 10 60 | print("\nPet Image Label Dictionary has", len(results_dic), 61 | "key-value pairs.\nBelow are", stop_point, "of them:") 62 | 63 | # counter - to count how many labels have been printed 64 | n = 0 65 | 66 | # for loop to iterate through the dictionary 67 | for key in results_dic: 68 | 69 | # prints only first 10 labels 70 | if n < stop_point: 71 | print("{:2d} key: {:>30} label: {:>26}".format(n+1, key, 72 | results_dic[key][0])) 73 | 74 | # Increments counter 75 | n += 1 76 | 77 | # If past first 10 (or fewer) labels the breaks out of loop 78 | else: 79 | break 80 | 81 | 82 | def check_classifying_images(results_dic): 83 | """ For Lab: Classifying Images - 11/12. Classifying Images 84 | Prints Pet Image Label and Classifier Label for ALL Matches followed by ALL 85 | NOT matches. Next prints out the total number of images followed by how 86 | many were matches and how many were not-matches to check all 40 images are 87 | processed. Assumes you defined the results_dic dictionary as was 88 | outlined in '11/12. Classifying Images' 89 | Parameters: 90 | results_dic - Dictionary with key as image filename and value as a List 91 | (index)idx 0 = pet image label (string) 92 | idx 1 = classifier label (string) 93 | idx 2 = 1/0 (int) where 1 = match between pet image and 94 | classifer labels and 0 = no match between labels 95 | Returns: 96 | Nothing - just prints to console 97 | 98 | """ 99 | if results_dic is None: 100 | print("* Doesn't Check the Results Dictionary because 'classify_images' hasn't been defined.") 101 | elif len(results_dic[next(iter(results_dic))]) < 2: 102 | print("* Doesn't Check the Results Dictionary because 'classify_images' hasn't been defined.") 103 | else: 104 | # Code for checking classify_images - 105 | # Checks matches and not matches are classified correctly 106 | # Checks that all 40 images are classified as a Match or Not-a Match 107 | 108 | # Sets counters for matches & NOT-matches 109 | n_match = 0 110 | n_notmatch = 0 111 | 112 | # Prints all Matches first 113 | print("\n MATCH:") 114 | for key in results_dic: 115 | 116 | # Prints only if a Match Index 2 == 1 117 | if results_dic[key][2] == 1: 118 | 119 | # Increments Match counter 120 | n_match += 1 121 | print("\n{:>30}: \nReal: {:>26} Classifier: {:>30}".format(key, 122 | results_dic[key][0], results_dic[key][1])) 123 | 124 | # Prints all NOT-Matches next 125 | print("\n NOT A MATCH:") 126 | for key in results_dic: 127 | 128 | # Prints only if NOT-a-Match Index 2 == 0 129 | if results_dic[key][2] == 0: 130 | 131 | # Increments Not-a-Match counter 132 | n_notmatch += 1 133 | print("\n{:>30}: \nReal: {:>26} Classifier: {:>30}".format(key, 134 | results_dic[key][0], results_dic[key][1])) 135 | 136 | # Prints Total Number of Images - expects 40 from pet_images folder 137 | print("\n# Total Images", n_match + n_notmatch, "# Matches:", n_match, 138 | "# NOT Matches:", n_notmatch) 139 | 140 | 141 | def check_classifying_labels_as_dogs(results_dic): 142 | """ For Lab: Classifying Images - 13. Classifying Labels as Dogs 143 | Prints Pet Image Label, Classifier Label, whether Pet Label is-a-dog(1=Yes, 144 | 0=No), and whether Classifier Label is-a-dog(1=Yes, 0=No) for ALL Matches 145 | followed by ALL NOT matches. Next prints out the total number of images 146 | followed by how many were matches and how many were not-matches to check 147 | all 40 images are processed. Assumes you defined the results_dic dictionary 148 | as was outlined in '13. Classifying Labels as Dogs' 149 | Parameters: 150 | results_dic - Dictionary with key as image filename and value as a List 151 | (index)idx 0 = pet image label (string) 152 | idx 1 = classifier label (string) 153 | idx 2 = 1/0 (int) where 1 = match between pet image and 154 | classifer labels and 0 = no match between labels 155 | idx 3 = 1/0 (int) where 1 = pet image 'is-a' dog and 156 | 0 = pet Image 'is-NOT-a' dog. 157 | idx 4 = 1/0 (int) where 1 = Classifier classifies image 158 | 'as-a' dog and 0 = Classifier classifies image 159 | 'as-NOT-a' dog. 160 | Returns: 161 | Nothing - just prints to console 162 | 163 | """ 164 | if results_dic is None: 165 | print("* Doesn't Check the Results Dictionary because 'adjust_results4_isadog' hasn't been defined.") 166 | elif len(results_dic[next(iter(results_dic))]) < 4: 167 | print("* Doesn't Check the Results Dictionary because 'adjust_results4_isadog' hasn't been defined.") 168 | 169 | else: 170 | # Code for checking adjust_results4_isadog - 171 | # Checks matches and not matches are classified correctly as "dogs" and 172 | # "not-dogs" Checks that all 40 images are classified as a Match or Not-a 173 | # Match 174 | 175 | # Sets counters for matches & NOT-matches 176 | n_match = 0 177 | n_notmatch = 0 178 | 179 | # Prints all Matches first 180 | print("\n MATCH:") 181 | for key in results_dic: 182 | 183 | # Prints only if a Match Index 2 == 1 184 | if results_dic[key][2] == 1: 185 | 186 | # Increments Match counter 187 | n_match += 1 188 | print("\n{:>30}: \nReal: {:>26} Classifier: {:>30} \nPetLabelDog: {:1d} ClassLabelDog: {:1d}".format(key, 189 | results_dic[key][0], results_dic[key][1], results_dic[key][3], 190 | results_dic[key][4])) 191 | 192 | # Prints all NOT-Matches next 193 | print("\n NOT A MATCH:") 194 | for key in results_dic: 195 | 196 | # Prints only if NOT-a-Match Index 2 == 0 197 | if results_dic[key][2] == 0: 198 | 199 | # Increments Not-a-Match counter 200 | n_notmatch += 1 201 | print("\n{:>30}: \nReal: {:>26} Classifier: {:>30} \nPetLabelDog: {:1d} ClassLabelDog: {:1d}".format(key, 202 | results_dic[key][0], results_dic[key][1], results_dic[key][3], 203 | results_dic[key][4])) 204 | 205 | # Prints Total Number of Images - expects 40 from pet_images folder 206 | print("\n# Total Images", n_match + n_notmatch, "# Matches:", n_match, 207 | "# NOT Matches:", n_notmatch) 208 | 209 | 210 | def check_calculating_results(results_dic, results_stats_dic): 211 | """ For Lab: Classifying Images - 14. Calculating Results 212 | Prints First statistics from the results stats dictionary (that was created 213 | by the calculates_results_stats() function), then prints the same statistics 214 | that were calculated in this function using the results dictionary. 215 | Assumes you defined the results_stats dictionary and the statistics 216 | as was outlined in '14. Calculating Results ' 217 | Parameters: 218 | results_dic - Dictionary with key as image filename and value as a List 219 | (index)idx 0 = pet image label (string) 220 | idx 1 = classifier label (string) 221 | idx 2 = 1/0 (int) where 1 = match between pet image and 222 | classifer labels and 0 = no match between labels 223 | idx 3 = 1/0 (int) where 1 = pet image 'is-a' dog and 224 | 0 = pet Image 'is-NOT-a' dog. 225 | idx 4 = 1/0 (int) where 1 = Classifier classifies image 226 | 'as-a' dog and 0 = Classifier classifies image 227 | 'as-NOT-a' dog. 228 | results_stats_dic - Dictionary that contains the results statistics (either 229 | a percentage or a count) where the key is the statistic's 230 | name (starting with 'pct' for percentage or 'n' for count) 231 | and the value is the statistic's value 232 | Returns: 233 | Nothing - just prints to console 234 | 235 | """ 236 | if results_stats_dic is None: 237 | print("* Doesn't Check the Results Dictionary because 'calculates_results_stats' hasn't been defined.") 238 | else: 239 | # Code for checking results_stats_dic - 240 | # Checks calculations of counts & percentages BY using results_dic 241 | # to re-calculate the values and then compare to the values 242 | # in results_stats_dic 243 | 244 | # Initialize counters to zero and number of images total 245 | n_images = len(results_dic) 246 | n_pet_dog = 0 247 | n_class_cdog = 0 248 | n_class_cnotd = 0 249 | n_match_breed = 0 250 | 251 | # Interates through results_dic dictionary to recompute the statistics 252 | # outside of the calculates_results_stats() function 253 | for key in results_dic: 254 | 255 | # match (if dog then breed match) 256 | if results_dic[key][2] == 1: 257 | 258 | # isa dog (pet label) & breed match 259 | if results_dic[key][3] == 1: 260 | n_pet_dog += 1 261 | 262 | # isa dog (classifier label) & breed match 263 | if results_dic[key][4] == 1: 264 | n_class_cdog += 1 265 | n_match_breed += 1 266 | 267 | # NOT dog (pet_label) 268 | else: 269 | 270 | # NOT dog (classifier label) 271 | if results_dic[key][4] == 0: 272 | n_class_cnotd += 1 273 | 274 | # NOT - match (not a breed match if a dog) 275 | else: 276 | 277 | # NOT - match 278 | # isa dog (pet label) 279 | if results_dic[key][3] == 1: 280 | n_pet_dog += 1 281 | 282 | # isa dog (classifier label) 283 | if results_dic[key][4] == 1: 284 | n_class_cdog += 1 285 | 286 | # NOT dog (pet_label) 287 | else: 288 | 289 | # NOT dog (classifier label) 290 | if results_dic[key][4] == 0: 291 | n_class_cnotd += 1 292 | 293 | # calculates statistics based upon counters from above 294 | n_pet_notd = n_images - n_pet_dog 295 | pct_corr_dog = (n_class_cdog / n_pet_dog)*100 296 | pct_corr_notdog = (n_class_cnotd / n_pet_notd)*100 297 | pct_corr_breed = (n_match_breed / n_pet_dog)*100 298 | 299 | # prints calculated statistics 300 | print("\n ** Statistics from calculates_results_stats() function:") 301 | print("N Images: {:2d} N Dog Images: {:2d} N NotDog Images: {:2d} \nPct Corr dog: {:5.1f} Pct Corr NOTdog: {:5.1f} Pct Corr Breed: {:5.1f}".format( 302 | results_stats_dic['n_images'], results_stats_dic['n_dogs_img'], 303 | results_stats_dic['n_notdogs_img'], results_stats_dic['pct_correct_dogs'], 304 | results_stats_dic['pct_correct_notdogs'], 305 | results_stats_dic['pct_correct_breed'])) 306 | print("\n ** Check Statistics - calculated from this function as a check:") 307 | print("N Images: {:2d} N Dog Images: {:2d} N NotDog Images: {:2d} \nPct Corr dog: {:5.1f} Pct Corr NOTdog: {:5.1f} Pct Corr Breed: {:5.1f}".format( 308 | n_images, n_pet_dog, n_pet_notd, pct_corr_dog, pct_corr_notdog, 309 | pct_corr_breed)) 310 | -------------------------------------------------------------------------------- /imagenet1000_clsid_to_human.txt: -------------------------------------------------------------------------------- 1 | {0: 'tench, Tinca tinca', 2 | 1: 'goldfish, Carassius auratus', 3 | 2: 'great white shark, white shark, man-eater, man-eating shark, Carcharodon carcharias', 4 | 3: 'tiger shark, Galeocerdo cuvieri', 5 | 4: 'hammerhead, hammerhead shark', 6 | 5: 'electric ray, crampfish, numbfish, torpedo', 7 | 6: 'stingray', 8 | 7: 'cock', 9 | 8: 'hen', 10 | 9: 'ostrich, Struthio camelus', 11 | 10: 'brambling, Fringilla montifringilla', 12 | 11: 'goldfinch, Carduelis carduelis', 13 | 12: 'house finch, linnet, Carpodacus mexicanus', 14 | 13: 'junco, snowbird', 15 | 14: 'indigo bunting, indigo finch, indigo bird, Passerina cyanea', 16 | 15: 'robin, American robin, Turdus migratorius', 17 | 16: 'bulbul', 18 | 17: 'jay', 19 | 18: 'magpie', 20 | 19: 'chickadee', 21 | 20: 'water ouzel, dipper', 22 | 21: 'kite', 23 | 22: 'bald eagle, American eagle, Haliaeetus leucocephalus', 24 | 23: 'vulture', 25 | 24: 'great grey owl, great gray owl, Strix nebulosa', 26 | 25: 'European fire salamander, Salamandra salamandra', 27 | 26: 'common newt, Triturus vulgaris', 28 | 27: 'eft', 29 | 28: 'spotted salamander, Ambystoma maculatum', 30 | 29: 'axolotl, mud puppy, Ambystoma mexicanum', 31 | 30: 'bullfrog, Rana catesbeiana', 32 | 31: 'tree frog, tree-frog', 33 | 32: 'tailed frog, bell toad, ribbed toad, tailed toad, Ascaphus trui', 34 | 33: 'loggerhead, loggerhead turtle, Caretta caretta', 35 | 34: 'leatherback turtle, leatherback, leathery turtle, Dermochelys coriacea', 36 | 35: 'mud turtle', 37 | 36: 'terrapin', 38 | 37: 'box turtle, box tortoise', 39 | 38: 'banded gecko, gecko', 40 | 39: 'common iguana, iguana, Iguana iguana', 41 | 40: 'American chameleon, anole, Anolis carolinensis', 42 | 41: 'whiptail, whiptail lizard', 43 | 42: 'agama', 44 | 43: 'frilled lizard, Chlamydosaurus kingi', 45 | 44: 'alligator lizard', 46 | 45: 'Gila monster, Heloderma suspectum', 47 | 46: 'green lizard, Lacerta viridis', 48 | 47: 'African chameleon, Chamaeleo chamaeleon', 49 | 48: 'Komodo dragon, Komodo lizard, dragon lizard, giant lizard, Varanus komodoensis', 50 | 49: 'African crocodile, Nile crocodile, Crocodylus niloticus', 51 | 50: 'American alligator, Alligator mississipiensis', 52 | 51: 'triceratops', 53 | 52: 'thunder snake, worm snake, Carphophis amoenus', 54 | 53: 'ringneck snake, ring-necked snake, ring snake', 55 | 54: 'hognose snake, puff adder, sand viper', 56 | 55: 'green snake, grass snake', 57 | 56: 'king snake, kingsnake', 58 | 57: 'garter snake, grass snake', 59 | 58: 'water snake', 60 | 59: 'vine snake', 61 | 60: 'night snake, Hypsiglena torquata', 62 | 61: 'boa constrictor, Constrictor constrictor', 63 | 62: 'rock python, rock snake, Python sebae', 64 | 63: 'Indian cobra, Naja naja', 65 | 64: 'green mamba', 66 | 65: 'sea snake', 67 | 66: 'horned viper, cerastes, sand viper, horned asp, Cerastes cornutus', 68 | 67: 'diamondback, diamondback rattlesnake, Crotalus adamanteus', 69 | 68: 'sidewinder, horned rattlesnake, Crotalus cerastes', 70 | 69: 'trilobite', 71 | 70: 'harvestman, daddy longlegs, Phalangium opilio', 72 | 71: 'scorpion', 73 | 72: 'black and gold garden spider, Argiope aurantia', 74 | 73: 'barn spider, Araneus cavaticus', 75 | 74: 'garden spider, Aranea diademata', 76 | 75: 'black widow, Latrodectus mactans', 77 | 76: 'tarantula', 78 | 77: 'wolf spider, hunting spider', 79 | 78: 'tick', 80 | 79: 'centipede', 81 | 80: 'black grouse', 82 | 81: 'ptarmigan', 83 | 82: 'ruffed grouse, partridge, Bonasa umbellus', 84 | 83: 'prairie chicken, prairie grouse, prairie fowl', 85 | 84: 'peacock', 86 | 85: 'quail', 87 | 86: 'partridge', 88 | 87: 'African grey, African gray, Psittacus erithacus', 89 | 88: 'macaw', 90 | 89: 'sulphur-crested cockatoo, Kakatoe galerita, Cacatua galerita', 91 | 90: 'lorikeet', 92 | 91: 'coucal', 93 | 92: 'bee eater', 94 | 93: 'hornbill', 95 | 94: 'hummingbird', 96 | 95: 'jacamar', 97 | 96: 'toucan', 98 | 97: 'drake', 99 | 98: 'red-breasted merganser, Mergus serrator', 100 | 99: 'goose', 101 | 100: 'black swan, Cygnus atratus', 102 | 101: 'tusker', 103 | 102: 'echidna, spiny anteater, anteater', 104 | 103: 'platypus, duckbill, duckbilled platypus, duck-billed platypus, Ornithorhynchus anatinus', 105 | 104: 'wallaby, brush kangaroo', 106 | 105: 'koala, koala bear, kangaroo bear, native bear, Phascolarctos cinereus', 107 | 106: 'wombat', 108 | 107: 'jellyfish', 109 | 108: 'sea anemone, anemone', 110 | 109: 'brain coral', 111 | 110: 'flatworm, platyhelminth', 112 | 111: 'nematode, nematode worm, roundworm', 113 | 112: 'conch', 114 | 113: 'snail', 115 | 114: 'slug', 116 | 115: 'sea slug, nudibranch', 117 | 116: 'chiton, coat-of-mail shell, sea cradle, polyplacophore', 118 | 117: 'chambered nautilus, pearly nautilus, nautilus', 119 | 118: 'Dungeness crab, Cancer magister', 120 | 119: 'rock crab, Cancer irroratus', 121 | 120: 'fiddler crab', 122 | 121: 'king crab, Alaska crab, Alaskan king crab, Alaska king crab, Paralithodes camtschatica', 123 | 122: 'American lobster, Northern lobster, Maine lobster, Homarus americanus', 124 | 123: 'spiny lobster, langouste, rock lobster, crawfish, crayfish, sea crawfish', 125 | 124: 'crayfish, crawfish, crawdad, crawdaddy', 126 | 125: 'hermit crab', 127 | 126: 'isopod', 128 | 127: 'white stork, Ciconia ciconia', 129 | 128: 'black stork, Ciconia nigra', 130 | 129: 'spoonbill', 131 | 130: 'flamingo', 132 | 131: 'little blue heron, Egretta caerulea', 133 | 132: 'American egret, great white heron, Egretta albus', 134 | 133: 'bittern', 135 | 134: 'crane', 136 | 135: 'limpkin, Aramus pictus', 137 | 136: 'European gallinule, Porphyrio porphyrio', 138 | 137: 'American coot, marsh hen, mud hen, water hen, Fulica americana', 139 | 138: 'bustard', 140 | 139: 'ruddy turnstone, Arenaria interpres', 141 | 140: 'red-backed sandpiper, dunlin, Erolia alpina', 142 | 141: 'redshank, Tringa totanus', 143 | 142: 'dowitcher', 144 | 143: 'oystercatcher, oyster catcher', 145 | 144: 'pelican', 146 | 145: 'king penguin, Aptenodytes patagonica', 147 | 146: 'albatross, mollymawk', 148 | 147: 'grey whale, gray whale, devilfish, Eschrichtius gibbosus, Eschrichtius robustus', 149 | 148: 'killer whale, killer, orca, grampus, sea wolf, Orcinus orca', 150 | 149: 'dugong, Dugong dugon', 151 | 150: 'sea lion', 152 | 151: 'Chihuahua', 153 | 152: 'Japanese spaniel', 154 | 153: 'Maltese dog, Maltese terrier, Maltese', 155 | 154: 'Pekinese, Pekingese, Peke', 156 | 155: 'Shih-Tzu', 157 | 156: 'Blenheim spaniel', 158 | 157: 'papillon', 159 | 158: 'toy terrier', 160 | 159: 'Rhodesian ridgeback', 161 | 160: 'Afghan hound, Afghan', 162 | 161: 'basset, basset hound', 163 | 162: 'beagle', 164 | 163: 'bloodhound, sleuthhound', 165 | 164: 'bluetick', 166 | 165: 'black-and-tan coonhound', 167 | 166: 'Walker hound, Walker foxhound', 168 | 167: 'English foxhound', 169 | 168: 'redbone', 170 | 169: 'borzoi, Russian wolfhound', 171 | 170: 'Irish wolfhound', 172 | 171: 'Italian greyhound', 173 | 172: 'whippet', 174 | 173: 'Ibizan hound, Ibizan Podenco', 175 | 174: 'Norwegian elkhound, elkhound', 176 | 175: 'otterhound, otter hound', 177 | 176: 'Saluki, gazelle hound', 178 | 177: 'Scottish deerhound, deerhound', 179 | 178: 'Weimaraner', 180 | 179: 'Staffordshire bullterrier, Staffordshire bull terrier', 181 | 180: 'American Staffordshire terrier, Staffordshire terrier, American pit bull terrier, pit bull terrier', 182 | 181: 'Bedlington terrier', 183 | 182: 'Border terrier', 184 | 183: 'Kerry blue terrier', 185 | 184: 'Irish terrier', 186 | 185: 'Norfolk terrier', 187 | 186: 'Norwich terrier', 188 | 187: 'Yorkshire terrier', 189 | 188: 'wire-haired fox terrier', 190 | 189: 'Lakeland terrier', 191 | 190: 'Sealyham terrier, Sealyham', 192 | 191: 'Airedale, Airedale terrier', 193 | 192: 'cairn, cairn terrier', 194 | 193: 'Australian terrier', 195 | 194: 'Dandie Dinmont, Dandie Dinmont terrier', 196 | 195: 'Boston bull, Boston terrier', 197 | 196: 'miniature schnauzer', 198 | 197: 'giant schnauzer', 199 | 198: 'standard schnauzer, schnauzer', 200 | 199: 'Scotch terrier, Scottish terrier, Scottie', 201 | 200: 'Tibetan terrier, chrysanthemum dog', 202 | 201: 'silky terrier, Sydney silky', 203 | 202: 'soft-coated wheaten terrier', 204 | 203: 'West Highland white terrier', 205 | 204: 'Lhasa, Lhasa apso', 206 | 205: 'flat-coated retriever', 207 | 206: 'curly-coated retriever', 208 | 207: 'golden retriever', 209 | 208: 'Labrador retriever', 210 | 209: 'Chesapeake Bay retriever', 211 | 210: 'German shorthaired pointer', 212 | 211: 'vizsla, Hungarian pointer', 213 | 212: 'English setter', 214 | 213: 'Irish setter, red setter', 215 | 214: 'Gordon setter', 216 | 215: 'Brittany spaniel', 217 | 216: 'clumber, clumber spaniel', 218 | 217: 'English springer, English springer spaniel', 219 | 218: 'Welsh springer spaniel', 220 | 219: 'cocker spaniel, English cocker spaniel, cocker', 221 | 220: 'Sussex spaniel', 222 | 221: 'Irish water spaniel', 223 | 222: 'kuvasz', 224 | 223: 'schipperke', 225 | 224: 'groenendael', 226 | 225: 'malinois', 227 | 226: 'briard', 228 | 227: 'kelpie', 229 | 228: 'komondor', 230 | 229: 'Old English sheepdog, bobtail', 231 | 230: 'Shetland sheepdog, Shetland sheep dog, Shetland', 232 | 231: 'collie', 233 | 232: 'Border collie', 234 | 233: 'Bouvier des Flandres, Bouviers des Flandres', 235 | 234: 'Rottweiler', 236 | 235: 'German shepherd, German shepherd dog, German police dog, alsatian', 237 | 236: 'Doberman, Doberman pinscher', 238 | 237: 'miniature pinscher', 239 | 238: 'Greater Swiss Mountain dog', 240 | 239: 'Bernese mountain dog', 241 | 240: 'Appenzeller', 242 | 241: 'EntleBucher', 243 | 242: 'boxer', 244 | 243: 'bull mastiff', 245 | 244: 'Tibetan mastiff', 246 | 245: 'French bulldog', 247 | 246: 'Great Dane', 248 | 247: 'Saint Bernard, St Bernard', 249 | 248: 'Eskimo dog, husky', 250 | 249: 'malamute, malemute, Alaskan malamute', 251 | 250: 'Siberian husky', 252 | 251: 'dalmatian, coach dog, carriage dog', 253 | 252: 'affenpinscher, monkey pinscher, monkey dog', 254 | 253: 'basenji', 255 | 254: 'pug, pug-dog', 256 | 255: 'Leonberg', 257 | 256: 'Newfoundland, Newfoundland dog', 258 | 257: 'Great Pyrenees', 259 | 258: 'Samoyed, Samoyede', 260 | 259: 'Pomeranian', 261 | 260: 'chow, chow chow', 262 | 261: 'keeshond', 263 | 262: 'Brabancon griffon', 264 | 263: 'Pembroke, Pembroke Welsh corgi, corgi', 265 | 264: 'Cardigan, Cardigan Welsh corgi, corgi', 266 | 265: 'toy poodle', 267 | 266: 'miniature poodle', 268 | 267: 'standard poodle, poodle', 269 | 268: 'Mexican hairless', 270 | 269: 'timber wolf, grey wolf, gray wolf, Canis lupus', 271 | 270: 'white wolf, Arctic wolf, Canis lupus tundrarum', 272 | 271: 'red wolf, maned wolf, Canis rufus, Canis niger', 273 | 272: 'coyote, prairie wolf, brush wolf, Canis latrans', 274 | 273: 'dingo, warrigal, warragal, Canis dingo', 275 | 274: 'dhole, Cuon alpinus', 276 | 275: 'African hunting dog, hyena dog, Cape hunting dog, Lycaon pictus', 277 | 276: 'hyena, hyaena', 278 | 277: 'red fox, Vulpes vulpes', 279 | 278: 'kit fox, Vulpes macrotis', 280 | 279: 'Arctic fox, white fox, Alopex lagopus', 281 | 280: 'grey fox, gray fox, Urocyon cinereoargenteus', 282 | 281: 'tabby, tabby cat, cat', 283 | 282: 'tiger cat, cat', 284 | 283: 'Persian cat, cat', 285 | 284: 'Siamese cat, Siamese, cat', 286 | 285: 'Egyptian cat, cat', 287 | 286: 'cougar, puma, mountain lion, painter, panther, Felis concolor', 288 | 287: 'lynx', 289 | 288: 'leopard, Panthera pardus', 290 | 289: 'snow leopard, ounce, Panthera uncia', 291 | 290: 'jaguar, panther, Panthera onca, Felis onca', 292 | 291: 'lion, king of beasts, Panthera leo', 293 | 292: 'tiger, Panthera tigris', 294 | 293: 'cheetah, chetah, Acinonyx jubatus', 295 | 294: 'brown bear, bruin, Ursus arctos', 296 | 295: 'American black bear, black bear, Ursus americanus, Euarctos americanus', 297 | 296: 'ice bear, polar bear, Ursus Maritimus, Thalarctos maritimus', 298 | 297: 'sloth bear, Melursus ursinus, Ursus ursinus', 299 | 298: 'mongoose', 300 | 299: 'meerkat, mierkat', 301 | 300: 'tiger beetle', 302 | 301: 'ladybug, ladybeetle, lady beetle, ladybird, ladybird beetle', 303 | 302: 'ground beetle, carabid beetle', 304 | 303: 'long-horned beetle, longicorn, longicorn beetle', 305 | 304: 'leaf beetle, chrysomelid', 306 | 305: 'dung beetle', 307 | 306: 'rhinoceros beetle', 308 | 307: 'weevil', 309 | 308: 'fly', 310 | 309: 'bee', 311 | 310: 'ant, emmet, pismire', 312 | 311: 'grasshopper, hopper', 313 | 312: 'cricket', 314 | 313: 'walking stick, walkingstick, stick insect', 315 | 314: 'cockroach, roach', 316 | 315: 'mantis, mantid', 317 | 316: 'cicada, cicala', 318 | 317: 'leafhopper', 319 | 318: 'lacewing, lacewing fly', 320 | 319: "dragonfly, darning needle, devil's darning needle, sewing needle, snake feeder, snake doctor, mosquito hawk, skeeter hawk", 321 | 320: 'damselfly', 322 | 321: 'admiral', 323 | 322: 'ringlet, ringlet butterfly', 324 | 323: 'monarch, monarch butterfly, milkweed butterfly, Danaus plexippus', 325 | 324: 'cabbage butterfly', 326 | 325: 'sulphur butterfly, sulfur butterfly', 327 | 326: 'lycaenid, lycaenid butterfly', 328 | 327: 'starfish, sea star', 329 | 328: 'sea urchin', 330 | 329: 'sea cucumber, holothurian', 331 | 330: 'wood rabbit, cottontail, cottontail rabbit, rabbit', 332 | 331: 'hare', 333 | 332: 'Angora, Angora rabbit', 334 | 333: 'hamster', 335 | 334: 'porcupine, hedgehog', 336 | 335: 'fox squirrel, eastern fox squirrel, Sciurus niger', 337 | 336: 'marmot', 338 | 337: 'beaver', 339 | 338: 'guinea pig, Cavia cobaya', 340 | 339: 'sorrel', 341 | 340: 'zebra', 342 | 341: 'hog, pig, grunter, squealer, Sus scrofa', 343 | 342: 'wild boar, boar, Sus scrofa', 344 | 343: 'warthog', 345 | 344: 'hippopotamus, hippo, river horse, Hippopotamus amphibius', 346 | 345: 'ox', 347 | 346: 'water buffalo, water ox, Asiatic buffalo, Bubalus bubalis', 348 | 347: 'bison', 349 | 348: 'ram, tup', 350 | 349: 'bighorn, bighorn sheep, cimarron, Rocky Mountain bighorn, Rocky Mountain sheep, Ovis canadensis', 351 | 350: 'ibex, Capra ibex', 352 | 351: 'hartebeest', 353 | 352: 'impala, Aepyceros melampus', 354 | 353: 'gazelle', 355 | 354: 'Arabian camel, dromedary, Camelus dromedarius', 356 | 355: 'llama', 357 | 356: 'weasel', 358 | 357: 'mink', 359 | 358: 'polecat, fitch, foulmart, foumart, Mustela putorius', 360 | 359: 'black-footed ferret, ferret, Mustela nigripes', 361 | 360: 'otter', 362 | 361: 'skunk, polecat, wood pussy', 363 | 362: 'badger', 364 | 363: 'armadillo', 365 | 364: 'three-toed sloth, ai, Bradypus tridactylus', 366 | 365: 'orangutan, orang, orangutang, Pongo pygmaeus', 367 | 366: 'gorilla, Gorilla gorilla', 368 | 367: 'chimpanzee, chimp, Pan troglodytes', 369 | 368: 'gibbon, Hylobates lar', 370 | 369: 'siamang, Hylobates syndactylus, Symphalangus syndactylus', 371 | 370: 'guenon, guenon monkey', 372 | 371: 'patas, hussar monkey, Erythrocebus patas', 373 | 372: 'baboon', 374 | 373: 'macaque', 375 | 374: 'langur', 376 | 375: 'colobus, colobus monkey', 377 | 376: 'proboscis monkey, Nasalis larvatus', 378 | 377: 'marmoset', 379 | 378: 'capuchin, ringtail, Cebus capucinus', 380 | 379: 'howler monkey, howler', 381 | 380: 'titi, titi monkey', 382 | 381: 'spider monkey, Ateles geoffroyi', 383 | 382: 'squirrel monkey, Saimiri sciureus', 384 | 383: 'Madagascar cat, ring-tailed lemur, Lemur catta', 385 | 384: 'indri, indris, Indri indri, Indri brevicaudatus', 386 | 385: 'Indian elephant, Elephas maximus', 387 | 386: 'African elephant, Loxodonta africana', 388 | 387: 'lesser panda, red panda, panda, bear cat, cat bear, Ailurus fulgens', 389 | 388: 'giant panda, panda, panda bear, coon bear, Ailuropoda melanoleuca', 390 | 389: 'barracouta, snoek', 391 | 390: 'eel', 392 | 391: 'coho, cohoe, coho salmon, blue jack, silver salmon, Oncorhynchus kisutch', 393 | 392: 'rock beauty, Holocanthus tricolor', 394 | 393: 'anemone fish', 395 | 394: 'sturgeon', 396 | 395: 'gar, garfish, garpike, billfish, Lepisosteus osseus', 397 | 396: 'lionfish', 398 | 397: 'puffer, pufferfish, blowfish, globefish', 399 | 398: 'abacus', 400 | 399: 'abaya', 401 | 400: "academic gown, academic robe, judge's robe", 402 | 401: 'accordion, piano accordion, squeeze box', 403 | 402: 'acoustic guitar', 404 | 403: 'aircraft carrier, carrier, flattop, attack aircraft carrier', 405 | 404: 'airliner', 406 | 405: 'airship, dirigible', 407 | 406: 'altar', 408 | 407: 'ambulance', 409 | 408: 'amphibian, amphibious vehicle', 410 | 409: 'analog clock', 411 | 410: 'apiary, bee house', 412 | 411: 'apron', 413 | 412: 'ashcan, trash can, garbage can, wastebin, ash bin, ash-bin, ashbin, dustbin, trash barrel, trash bin', 414 | 413: 'assault rifle, assault gun', 415 | 414: 'backpack, back pack, knapsack, packsack, rucksack, haversack', 416 | 415: 'bakery, bakeshop, bakehouse', 417 | 416: 'balance beam, beam', 418 | 417: 'balloon', 419 | 418: 'ballpoint, ballpoint pen, ballpen, Biro', 420 | 419: 'Band Aid', 421 | 420: 'banjo', 422 | 421: 'bannister, banister, balustrade, balusters, handrail', 423 | 422: 'barbell', 424 | 423: 'barber chair', 425 | 424: 'barbershop', 426 | 425: 'barn', 427 | 426: 'barometer', 428 | 427: 'barrel, cask', 429 | 428: 'barrow, garden cart, lawn cart, wheelbarrow', 430 | 429: 'baseball', 431 | 430: 'basketball', 432 | 431: 'bassinet', 433 | 432: 'bassoon', 434 | 433: 'bathing cap, swimming cap', 435 | 434: 'bath towel', 436 | 435: 'bathtub, bathing tub, bath, tub', 437 | 436: 'beach wagon, station wagon, wagon, estate car, beach waggon, station waggon, waggon', 438 | 437: 'beacon, lighthouse, beacon light, pharos', 439 | 438: 'beaker', 440 | 439: 'bearskin, busby, shako', 441 | 440: 'beer bottle', 442 | 441: 'beer glass', 443 | 442: 'bell cote, bell cot', 444 | 443: 'bib', 445 | 444: 'bicycle-built-for-two, tandem bicycle, tandem', 446 | 445: 'bikini, two-piece', 447 | 446: 'binder, ring-binder', 448 | 447: 'binoculars, field glasses, opera glasses', 449 | 448: 'birdhouse', 450 | 449: 'boathouse', 451 | 450: 'bobsled, bobsleigh, bob', 452 | 451: 'bolo tie, bolo, bola tie, bola', 453 | 452: 'bonnet, poke bonnet', 454 | 453: 'bookcase', 455 | 454: 'bookshop, bookstore, bookstall', 456 | 455: 'bottlecap', 457 | 456: 'bow', 458 | 457: 'bow tie, bow-tie, bowtie', 459 | 458: 'brass, memorial tablet, plaque', 460 | 459: 'brassiere, bra, bandeau', 461 | 460: 'breakwater, groin, groyne, mole, bulwark, seawall, jetty', 462 | 461: 'breastplate, aegis, egis', 463 | 462: 'broom', 464 | 463: 'bucket, pail', 465 | 464: 'buckle', 466 | 465: 'bulletproof vest', 467 | 466: 'bullet train, bullet', 468 | 467: 'butcher shop, meat market', 469 | 468: 'cab, hack, taxi, taxicab', 470 | 469: 'caldron, cauldron', 471 | 470: 'candle, taper, wax light', 472 | 471: 'cannon', 473 | 472: 'canoe', 474 | 473: 'can opener, tin opener', 475 | 474: 'cardigan', 476 | 475: 'car mirror', 477 | 476: 'carousel, carrousel, merry-go-round, roundabout, whirligig', 478 | 477: "carpenter's kit, tool kit", 479 | 478: 'carton', 480 | 479: 'car wheel', 481 | 480: 'cash machine, cash dispenser, automated teller machine, automatic teller machine, automated teller, automatic teller, ATM', 482 | 481: 'cassette', 483 | 482: 'cassette player', 484 | 483: 'castle', 485 | 484: 'catamaran', 486 | 485: 'CD player', 487 | 486: 'cello, violoncello', 488 | 487: 'cellular telephone, cellular phone, cellphone, cell, mobile phone', 489 | 488: 'chain', 490 | 489: 'chainlink fence', 491 | 490: 'chain mail, ring mail, mail, chain armor, chain armour, ring armor, ring armour', 492 | 491: 'chain saw, chainsaw', 493 | 492: 'chest', 494 | 493: 'chiffonier, commode', 495 | 494: 'chime, bell, gong', 496 | 495: 'china cabinet, china closet', 497 | 496: 'Christmas stocking', 498 | 497: 'church, church building', 499 | 498: 'cinema, movie theater, movie theatre, movie house, picture palace', 500 | 499: 'cleaver, meat cleaver, chopper', 501 | 500: 'cliff dwelling', 502 | 501: 'cloak', 503 | 502: 'clog, geta, patten, sabot', 504 | 503: 'cocktail shaker', 505 | 504: 'coffee mug', 506 | 505: 'coffeepot', 507 | 506: 'coil, spiral, volute, whorl, helix', 508 | 507: 'combination lock', 509 | 508: 'computer keyboard, keypad', 510 | 509: 'confectionery, confectionary, candy store', 511 | 510: 'container ship, containership, container vessel', 512 | 511: 'convertible', 513 | 512: 'corkscrew, bottle screw', 514 | 513: 'cornet, horn, trumpet, trump', 515 | 514: 'cowboy boot', 516 | 515: 'cowboy hat, ten-gallon hat', 517 | 516: 'cradle', 518 | 517: 'crane', 519 | 518: 'crash helmet', 520 | 519: 'crate', 521 | 520: 'crib, cot', 522 | 521: 'Crock Pot', 523 | 522: 'croquet ball', 524 | 523: 'crutch', 525 | 524: 'cuirass', 526 | 525: 'dam, dike, dyke', 527 | 526: 'desk', 528 | 527: 'desktop computer', 529 | 528: 'dial telephone, dial phone', 530 | 529: 'diaper, nappy, napkin', 531 | 530: 'digital clock', 532 | 531: 'digital watch', 533 | 532: 'dining table, board', 534 | 533: 'dishrag, dishcloth', 535 | 534: 'dishwasher, dish washer, dishwashing machine', 536 | 535: 'disk brake, disc brake', 537 | 536: 'dock, dockage, docking facility', 538 | 537: 'dogsled, dog sled, dog sleigh', 539 | 538: 'dome', 540 | 539: 'doormat, welcome mat', 541 | 540: 'drilling platform, offshore rig', 542 | 541: 'drum, membranophone, tympan', 543 | 542: 'drumstick', 544 | 543: 'dumbbell', 545 | 544: 'Dutch oven', 546 | 545: 'electric fan, blower', 547 | 546: 'electric guitar', 548 | 547: 'electric locomotive', 549 | 548: 'entertainment center', 550 | 549: 'envelope', 551 | 550: 'espresso maker', 552 | 551: 'face powder', 553 | 552: 'feather boa, boa', 554 | 553: 'file, file cabinet, filing cabinet', 555 | 554: 'fireboat', 556 | 555: 'fire engine, fire truck', 557 | 556: 'fire screen, fireguard', 558 | 557: 'flagpole, flagstaff', 559 | 558: 'flute, transverse flute', 560 | 559: 'folding chair', 561 | 560: 'football helmet', 562 | 561: 'forklift', 563 | 562: 'fountain', 564 | 563: 'fountain pen', 565 | 564: 'four-poster', 566 | 565: 'freight car', 567 | 566: 'French horn, horn', 568 | 567: 'frying pan, frypan, skillet', 569 | 568: 'fur coat', 570 | 569: 'garbage truck, dustcart', 571 | 570: 'gasmask, respirator, gas helmet', 572 | 571: 'gas pump, gasoline pump, petrol pump, island dispenser', 573 | 572: 'goblet', 574 | 573: 'go-kart', 575 | 574: 'golf ball', 576 | 575: 'golfcart, golf cart', 577 | 576: 'gondola', 578 | 577: 'gong, tam-tam', 579 | 578: 'gown', 580 | 579: 'grand piano, grand', 581 | 580: 'greenhouse, nursery, glasshouse', 582 | 581: 'grille, radiator grille', 583 | 582: 'grocery store, grocery, food market, market', 584 | 583: 'guillotine', 585 | 584: 'hair slide', 586 | 585: 'hair spray', 587 | 586: 'half track', 588 | 587: 'hammer', 589 | 588: 'hamper', 590 | 589: 'hand blower, blow dryer, blow drier, hair dryer, hair drier', 591 | 590: 'hand-held computer, hand-held microcomputer', 592 | 591: 'handkerchief, hankie, hanky, hankey', 593 | 592: 'hard disc, hard disk, fixed disk', 594 | 593: 'harmonica, mouth organ, harp, mouth harp', 595 | 594: 'harp', 596 | 595: 'harvester, reaper', 597 | 596: 'hatchet', 598 | 597: 'holster', 599 | 598: 'home theater, home theatre', 600 | 599: 'honeycomb', 601 | 600: 'hook, claw', 602 | 601: 'hoopskirt, crinoline', 603 | 602: 'horizontal bar, high bar', 604 | 603: 'horse cart, horse-cart', 605 | 604: 'hourglass', 606 | 605: 'iPod', 607 | 606: 'iron, smoothing iron', 608 | 607: "jack-o'-lantern", 609 | 608: 'jean, blue jean, denim', 610 | 609: 'jeep, landrover', 611 | 610: 'jersey, T-shirt, tee shirt', 612 | 611: 'jigsaw puzzle', 613 | 612: 'jinrikisha, ricksha, rickshaw', 614 | 613: 'joystick', 615 | 614: 'kimono', 616 | 615: 'knee pad', 617 | 616: 'knot', 618 | 617: 'lab coat, laboratory coat', 619 | 618: 'ladle', 620 | 619: 'lampshade, lamp shade', 621 | 620: 'laptop, laptop computer', 622 | 621: 'lawn mower, mower', 623 | 622: 'lens cap, lens cover', 624 | 623: 'letter opener, paper knife, paperknife', 625 | 624: 'library', 626 | 625: 'lifeboat', 627 | 626: 'lighter, light, igniter, ignitor', 628 | 627: 'limousine, limo', 629 | 628: 'liner, ocean liner', 630 | 629: 'lipstick, lip rouge', 631 | 630: 'Loafer', 632 | 631: 'lotion', 633 | 632: 'loudspeaker, speaker, speaker unit, loudspeaker system, speaker system', 634 | 633: "loupe, jeweler's loupe", 635 | 634: 'lumbermill, sawmill', 636 | 635: 'magnetic compass', 637 | 636: 'mailbag, postbag', 638 | 637: 'mailbox, letter box', 639 | 638: 'maillot', 640 | 639: 'maillot, tank suit', 641 | 640: 'manhole cover', 642 | 641: 'maraca', 643 | 642: 'marimba, xylophone', 644 | 643: 'mask', 645 | 644: 'matchstick', 646 | 645: 'maypole', 647 | 646: 'maze, labyrinth', 648 | 647: 'measuring cup', 649 | 648: 'medicine chest, medicine cabinet', 650 | 649: 'megalith, megalithic structure', 651 | 650: 'microphone, mike', 652 | 651: 'microwave, microwave oven', 653 | 652: 'military uniform', 654 | 653: 'milk can', 655 | 654: 'minibus', 656 | 655: 'miniskirt, mini', 657 | 656: 'minivan', 658 | 657: 'missile', 659 | 658: 'mitten', 660 | 659: 'mixing bowl', 661 | 660: 'mobile home, manufactured home', 662 | 661: 'Model T', 663 | 662: 'modem', 664 | 663: 'monastery', 665 | 664: 'monitor', 666 | 665: 'moped', 667 | 666: 'mortar', 668 | 667: 'mortarboard', 669 | 668: 'mosque', 670 | 669: 'mosquito net', 671 | 670: 'motor scooter, scooter', 672 | 671: 'mountain bike, all-terrain bike, off-roader', 673 | 672: 'mountain tent', 674 | 673: 'mouse, computer mouse', 675 | 674: 'mousetrap', 676 | 675: 'moving van', 677 | 676: 'muzzle', 678 | 677: 'nail', 679 | 678: 'neck brace', 680 | 679: 'necklace', 681 | 680: 'nipple', 682 | 681: 'notebook, notebook computer', 683 | 682: 'obelisk', 684 | 683: 'oboe, hautboy, hautbois', 685 | 684: 'ocarina, sweet potato', 686 | 685: 'odometer, hodometer, mileometer, milometer', 687 | 686: 'oil filter', 688 | 687: 'organ, pipe organ', 689 | 688: 'oscilloscope, scope, cathode-ray oscilloscope, CRO', 690 | 689: 'overskirt', 691 | 690: 'oxcart', 692 | 691: 'oxygen mask', 693 | 692: 'packet', 694 | 693: 'paddle, boat paddle', 695 | 694: 'paddlewheel, paddle wheel', 696 | 695: 'padlock', 697 | 696: 'paintbrush', 698 | 697: "pajama, pyjama, pj's, jammies", 699 | 698: 'palace', 700 | 699: 'panpipe, pandean pipe, syrinx', 701 | 700: 'paper towel', 702 | 701: 'parachute, chute', 703 | 702: 'parallel bars, bars', 704 | 703: 'park bench', 705 | 704: 'parking meter', 706 | 705: 'passenger car, coach, carriage', 707 | 706: 'patio, terrace', 708 | 707: 'pay-phone, pay-station', 709 | 708: 'pedestal, plinth, footstall', 710 | 709: 'pencil box, pencil case', 711 | 710: 'pencil sharpener', 712 | 711: 'perfume, essence', 713 | 712: 'Petri dish', 714 | 713: 'photocopier', 715 | 714: 'pick, plectrum, plectron', 716 | 715: 'pickelhaube', 717 | 716: 'picket fence, paling', 718 | 717: 'pickup, pickup truck', 719 | 718: 'pier', 720 | 719: 'piggy bank, penny bank', 721 | 720: 'pill bottle', 722 | 721: 'pillow', 723 | 722: 'ping-pong ball', 724 | 723: 'pinwheel', 725 | 724: 'pirate, pirate ship', 726 | 725: 'pitcher, ewer', 727 | 726: "plane, carpenter's plane, woodworking plane", 728 | 727: 'planetarium', 729 | 728: 'plastic bag', 730 | 729: 'plate rack', 731 | 730: 'plow, plough', 732 | 731: "plunger, plumber's helper", 733 | 732: 'Polaroid camera, Polaroid Land camera', 734 | 733: 'pole', 735 | 734: 'police van, police wagon, paddy wagon, patrol wagon, wagon, black Maria', 736 | 735: 'poncho', 737 | 736: 'pool table, billiard table, snooker table', 738 | 737: 'pop bottle, soda bottle', 739 | 738: 'pot, flowerpot', 740 | 739: "potter's wheel", 741 | 740: 'power drill', 742 | 741: 'prayer rug, prayer mat', 743 | 742: 'printer', 744 | 743: 'prison, prison house', 745 | 744: 'projectile, missile', 746 | 745: 'projector', 747 | 746: 'puck, hockey puck', 748 | 747: 'punching bag, punch bag, punching ball, punchball', 749 | 748: 'purse', 750 | 749: 'quill, quill pen', 751 | 750: 'quilt, comforter, comfort, puff', 752 | 751: 'racer, race car, racing car', 753 | 752: 'racket, racquet', 754 | 753: 'radiator', 755 | 754: 'radio, wireless', 756 | 755: 'radio telescope, radio reflector', 757 | 756: 'rain barrel', 758 | 757: 'recreational vehicle, RV, R.V.', 759 | 758: 'reel', 760 | 759: 'reflex camera', 761 | 760: 'refrigerator, icebox', 762 | 761: 'remote control, remote', 763 | 762: 'restaurant, eating house, eating place, eatery', 764 | 763: 'revolver, six-gun, six-shooter', 765 | 764: 'rifle', 766 | 765: 'rocking chair, rocker', 767 | 766: 'rotisserie', 768 | 767: 'rubber eraser, rubber, pencil eraser', 769 | 768: 'rugby ball', 770 | 769: 'rule, ruler', 771 | 770: 'running shoe', 772 | 771: 'safe', 773 | 772: 'safety pin', 774 | 773: 'saltshaker, salt shaker', 775 | 774: 'sandal', 776 | 775: 'sarong', 777 | 776: 'sax, saxophone', 778 | 777: 'scabbard', 779 | 778: 'scale, weighing machine', 780 | 779: 'school bus', 781 | 780: 'schooner', 782 | 781: 'scoreboard', 783 | 782: 'screen, CRT screen', 784 | 783: 'screw', 785 | 784: 'screwdriver', 786 | 785: 'seat belt, seatbelt', 787 | 786: 'sewing machine', 788 | 787: 'shield, buckler', 789 | 788: 'shoe shop, shoe-shop, shoe store', 790 | 789: 'shoji', 791 | 790: 'shopping basket', 792 | 791: 'shopping cart', 793 | 792: 'shovel', 794 | 793: 'shower cap', 795 | 794: 'shower curtain', 796 | 795: 'ski', 797 | 796: 'ski mask', 798 | 797: 'sleeping bag', 799 | 798: 'slide rule, slipstick', 800 | 799: 'sliding door', 801 | 800: 'slot, one-armed bandit', 802 | 801: 'snorkel', 803 | 802: 'snowmobile', 804 | 803: 'snowplow, snowplough', 805 | 804: 'soap dispenser', 806 | 805: 'soccer ball', 807 | 806: 'sock', 808 | 807: 'solar dish, solar collector, solar furnace', 809 | 808: 'sombrero', 810 | 809: 'soup bowl', 811 | 810: 'space bar', 812 | 811: 'space heater', 813 | 812: 'space shuttle', 814 | 813: 'spatula', 815 | 814: 'speedboat', 816 | 815: "spider web, spider's web", 817 | 816: 'spindle', 818 | 817: 'sports car, sport car', 819 | 818: 'spotlight, spot', 820 | 819: 'stage', 821 | 820: 'steam locomotive', 822 | 821: 'steel arch bridge', 823 | 822: 'steel drum', 824 | 823: 'stethoscope', 825 | 824: 'stole', 826 | 825: 'stone wall', 827 | 826: 'stopwatch, stop watch', 828 | 827: 'stove', 829 | 828: 'strainer', 830 | 829: 'streetcar, tram, tramcar, trolley, trolley car', 831 | 830: 'stretcher', 832 | 831: 'studio couch, day bed', 833 | 832: 'stupa, tope', 834 | 833: 'submarine, pigboat, sub, U-boat', 835 | 834: 'suit, suit of clothes', 836 | 835: 'sundial', 837 | 836: 'sunglass', 838 | 837: 'sunglasses, dark glasses, shades', 839 | 838: 'sunscreen, sunblock, sun blocker', 840 | 839: 'suspension bridge', 841 | 840: 'swab, swob, mop', 842 | 841: 'sweatshirt', 843 | 842: 'swimming trunks, bathing trunks', 844 | 843: 'swing', 845 | 844: 'switch, electric switch, electrical switch', 846 | 845: 'syringe', 847 | 846: 'table lamp', 848 | 847: 'tank, army tank, armored combat vehicle, armoured combat vehicle', 849 | 848: 'tape player', 850 | 849: 'teapot', 851 | 850: 'teddy, teddy bear', 852 | 851: 'television, television system', 853 | 852: 'tennis ball', 854 | 853: 'thatch, thatched roof', 855 | 854: 'theater curtain, theatre curtain', 856 | 855: 'thimble', 857 | 856: 'thresher, thrasher, threshing machine', 858 | 857: 'throne', 859 | 858: 'tile roof', 860 | 859: 'toaster', 861 | 860: 'tobacco shop, tobacconist shop, tobacconist', 862 | 861: 'toilet seat', 863 | 862: 'torch', 864 | 863: 'totem pole', 865 | 864: 'tow truck, tow car, wrecker', 866 | 865: 'toyshop', 867 | 866: 'tractor', 868 | 867: 'trailer truck, tractor trailer, trucking rig, rig, articulated lorry, semi', 869 | 868: 'tray', 870 | 869: 'trench coat', 871 | 870: 'tricycle, trike, velocipede', 872 | 871: 'trimaran', 873 | 872: 'tripod', 874 | 873: 'triumphal arch', 875 | 874: 'trolleybus, trolley coach, trackless trolley', 876 | 875: 'trombone', 877 | 876: 'tub, vat', 878 | 877: 'turnstile', 879 | 878: 'typewriter keyboard', 880 | 879: 'umbrella', 881 | 880: 'unicycle, monocycle', 882 | 881: 'upright, upright piano', 883 | 882: 'vacuum, vacuum cleaner', 884 | 883: 'vase', 885 | 884: 'vault', 886 | 885: 'velvet', 887 | 886: 'vending machine', 888 | 887: 'vestment', 889 | 888: 'viaduct', 890 | 889: 'violin, fiddle', 891 | 890: 'volleyball', 892 | 891: 'waffle iron', 893 | 892: 'wall clock', 894 | 893: 'wallet, billfold, notecase, pocketbook', 895 | 894: 'wardrobe, closet, press', 896 | 895: 'warplane, military plane', 897 | 896: 'washbasin, handbasin, washbowl, lavabo, wash-hand basin', 898 | 897: 'washer, automatic washer, washing machine', 899 | 898: 'water bottle', 900 | 899: 'water jug', 901 | 900: 'water tower', 902 | 901: 'whiskey jug', 903 | 902: 'whistle', 904 | 903: 'wig', 905 | 904: 'window screen', 906 | 905: 'window shade', 907 | 906: 'Windsor tie', 908 | 907: 'wine bottle', 909 | 908: 'wing', 910 | 909: 'wok', 911 | 910: 'wooden spoon', 912 | 911: 'wool, woolen, woollen', 913 | 912: 'worm fence, snake fence, snake-rail fence, Virginia fence', 914 | 913: 'wreck', 915 | 914: 'yawl', 916 | 915: 'yurt', 917 | 916: 'web site, website, internet site, site', 918 | 917: 'comic book', 919 | 918: 'crossword puzzle, crossword', 920 | 919: 'street sign', 921 | 920: 'traffic light, traffic signal, stoplight', 922 | 921: 'book jacket, dust cover, dust jacket, dust wrapper', 923 | 922: 'menu', 924 | 923: 'plate', 925 | 924: 'guacamole', 926 | 925: 'consomme', 927 | 926: 'hot pot, hotpot', 928 | 927: 'trifle', 929 | 928: 'ice cream, icecream', 930 | 929: 'ice lolly, lolly, lollipop, popsicle', 931 | 930: 'French loaf', 932 | 931: 'bagel, beigel', 933 | 932: 'pretzel', 934 | 933: 'cheeseburger', 935 | 934: 'hotdog, hot dog, red hot', 936 | 935: 'mashed potato', 937 | 936: 'head cabbage', 938 | 937: 'broccoli', 939 | 938: 'cauliflower', 940 | 939: 'zucchini, courgette', 941 | 940: 'spaghetti squash', 942 | 941: 'acorn squash', 943 | 942: 'butternut squash', 944 | 943: 'cucumber, cuke', 945 | 944: 'artichoke, globe artichoke', 946 | 945: 'bell pepper', 947 | 946: 'cardoon', 948 | 947: 'mushroom', 949 | 948: 'Granny Smith', 950 | 949: 'strawberry', 951 | 950: 'orange', 952 | 951: 'lemon', 953 | 952: 'fig', 954 | 953: 'pineapple, ananas', 955 | 954: 'banana', 956 | 955: 'jackfruit, jak, jack', 957 | 956: 'custard apple', 958 | 957: 'pomegranate', 959 | 958: 'hay', 960 | 959: 'carbonara', 961 | 960: 'chocolate sauce, chocolate syrup', 962 | 961: 'dough', 963 | 962: 'meat loaf, meatloaf', 964 | 963: 'pizza, pizza pie', 965 | 964: 'potpie', 966 | 965: 'burrito', 967 | 966: 'red wine', 968 | 967: 'espresso', 969 | 968: 'cup', 970 | 969: 'eggnog', 971 | 970: 'alp', 972 | 971: 'bubble', 973 | 972: 'cliff, drop, drop-off', 974 | 973: 'coral reef', 975 | 974: 'geyser', 976 | 975: 'lakeside, lakeshore', 977 | 976: 'promontory, headland, head, foreland', 978 | 977: 'sandbar, sand bar', 979 | 978: 'seashore, coast, seacoast, sea-coast', 980 | 979: 'valley, vale', 981 | 980: 'volcano', 982 | 981: 'ballplayer, baseball player', 983 | 982: 'groom, bridegroom', 984 | 983: 'scuba diver', 985 | 984: 'rapeseed', 986 | 985: 'daisy', 987 | 986: "yellow lady's slipper, yellow lady-slipper, Cypripedium calceolus, Cypripedium parviflorum", 988 | 987: 'corn', 989 | 988: 'acorn', 990 | 989: 'hip, rose hip, rosehip', 991 | 990: 'buckeye, horse chestnut, conker', 992 | 991: 'coral fungus', 993 | 992: 'agaric', 994 | 993: 'gyromitra', 995 | 994: 'stinkhorn, carrion fungus', 996 | 995: 'earthstar', 997 | 996: 'hen-of-the-woods, hen of the woods, Polyporus frondosus, Grifola frondosa', 998 | 997: 'bolete', 999 | 998: 'ear, spike, capitulum', 1000 | 999: 'toilet tissue, toilet paper, bathroom tissue'} 1001 | --------------------------------------------------------------------------------