Git Product home page Git Product logo

cnn-image-dog-classifier's Introduction

Pet Image Classification using Pretrained CNN Models

This repository contains a Python program for classifying pet images using pretrained CNN (Convolutional Neural Network) models. The program compares the classifications with the true identity of the pets in the images and summarizes the CNN's performance on the classification task. It evaluates three different CNN model architectures to determine the most effective one for classification.

Program Overview

The main program, check_images.py, orchestrates the entire classification process. It involves several modules and functions:

  • get_input_args.py: Retrieves command-line arguments from the user, such as the directory with images, the chosen model architecture, and the file containing dog names.
  • get_pet_labels.py: Extracts pet image labels from filenames and creates a results dictionary.
  • classify_images.py: Utilizes the pretrained CNN model to classify images and updates the results dictionary with classifier labels.
  • adjust_results4_isadog.py: Adjusts the results to identify if the classifier correctly identified images as 'a dog' or 'not a dog'.
  • calculates_results_stats.py: Computes result statistics, including counts and percentages, and generates a summary in a results statistics dictionary.
  • print_results.py: Prints a summary of results, including incorrectly classified dogs and breeds if requested.

Usage

To execute the program, use the following command-line arguments:

python check_images.py --dir <directory with images> --arch <model> --dogfile <file that contains dog names>
  • --dir: Specifies the directory containing pet images.
  • --arch: Chooses the CNN model architecture among the available options.
  • --dogfile: Provides the file containing a list of dog names.

Example:

python check_images.py --dir pet_images/ --arch vgg --dogfile dognames.txt

Instructions for Running

  1. Ensure you have Python 3 installed on your system.
  2. Clone this repository.
  3. Install the necessary dependencies (if any) by referring to the requirements.txt file.
  4. Run the program by executing check_images.py with appropriate command-line arguments as described above.

Additional Notes

  • The program measures and displays the total elapsed runtime upon completion.
  • Feel free to modify or extend the code to suit your specific needs.

cnn-image-dog-classifier's People

Contributors

luizamfsantos avatar

Stargazers

 avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.