{"id":17490268,"url":"https://github.com/mafda/dog_breed_classifier","last_synced_at":"2026-04-27T12:05:03.997Z","repository":{"id":257944189,"uuid":"869069238","full_name":"mafda/dog_breed_classifier","owner":"mafda","description":"Dog breed classifier - Udacity Deep Learning Nanodegree","archived":false,"fork":false,"pushed_at":"2024-10-16T23:34:28.000Z","size":6709,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2024-10-19T11:47:19.514Z","etag":null,"topics":["classification","cnn-classification","jupyter-notebook","resnet-50","streamlit","streamlit-webapp","transfer-learning","vgg16-model","xception-model"],"latest_commit_sha":null,"homepage":"","language":"Jupyter Notebook","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/mafda.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2024-10-07T17:02:48.000Z","updated_at":"2024-10-17T17:54:50.000Z","dependencies_parsed_at":"2024-10-17T03:46:05.124Z","dependency_job_id":"0c9234cb-67fe-47fd-be95-4572eb6209f2","html_url":"https://github.com/mafda/dog_breed_classifier","commit_stats":null,"previous_names":["mafda/dog_breed_classifier"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/mafda/dog_breed_classifier","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mafda%2Fdog_breed_classifier","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mafda%2Fdog_breed_classifier/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mafda%2Fdog_breed_classifier/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mafda%2Fdog_breed_classifier/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/mafda","download_url":"https://codeload.github.com/mafda/dog_breed_classifier/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mafda%2Fdog_breed_classifier/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":32335342,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-04-26T23:26:28.701Z","status":"online","status_checked_at":"2026-04-27T02:00:06.769Z","response_time":128,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["classification","cnn-classification","jupyter-notebook","resnet-50","streamlit","streamlit-webapp","transfer-learning","vgg16-model","xception-model"],"created_at":"2024-10-19T06:06:35.891Z","updated_at":"2026-04-27T12:05:03.978Z","avatar_url":"https://github.com/mafda.png","language":"Jupyter Notebook","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Dog Breed Classifier\n\nIn this project, given an image of a dog, the algorithm will identify an\nestimate of the canine’s breed.  If supplied an image of a human, the code will\nidentify the resembling dog breed.\n\nThe image below displays potential sample output of the finished project:\n\n![Sample Dog Output](images/sample_dog_output.png)\n\n\u003e [See notebook](src/dog_app.ipynb)\n\n## Project Setup\n\n### Clone this repository\n\n```shell\n(base)$: git@github.com:mafda/dog_breed_classifier.git\n(base)$: cd dog_breed_classifier\n```\n\n### Configure environment\n\n- Create the conda environment\n\n    ```shell\n    (base)$: conda env create -f environment.yml\n    ```\n\n- Activate the environment\n\n    ```shell\n    (base)$: conda activate dog_breed\n    ```\n\n- Download the [dog\n  dataset](https://s3-us-west-1.amazonaws.com/udacity-aind/dog-project/dogImages.zip).\n  Unzip the folder and place it in the repo, at location\n  `path/to/dog_breed_classifier/data/dog_images`.\n\n- Download the [human\n  dataset](https://s3-us-west-1.amazonaws.com/udacity-aind/dog-project/lfw.zip).\n  Unzip the folder and place it in the repo, at location\n  `path/to/dog_breed_classifier/data/lfw`.\n\n- Donwload the [VGG-16 bottleneck\n  features](https://s3-us-west-1.amazonaws.com/udacity-aind/dog-project/DogVGG16Data.npz)\n  for the dog dataset.  Place it in the repo, at location\n  `path/to/dog_breed_classifier/data/bottleneck_features`.\n\n- Donwload the [Xception bottleneck\n  features](https://s3-us-west-1.amazonaws.com/udacity-aind/dog-project/DogXceptionData.npz)\n  for the dog dataset.  Place it in the repo, at location\n  `path/to/dog_breed_classifier/data/bottleneck_features`.\n\n- Run it:\n\n    ```\n    (dog_breed)$: streamlit run app/app.py\n    ```\n\nAs soon as you run the script, a local Streamlit server will spin up, and your\napp will open in a new tab in your default web browser.\n\nOr you can navigate to (http://localhost:8501)[http://localhost:8501].\n\n## Project Structure\n\n```shell\n├── README.md\n├── app\n│   └── app.py\n├── data\n│   ├── bottleneck_features\n│   ├── dog_images\n│   ├── haarcascades\n│   ├── lfw\n│   └── test-images\n├── images\n├── environment.yml\n├── saved_models\n└── src\n    └── dog_app.ipynb\n```\n\n## Results\n\n1. **Detect Humans with OpenCV**: We use OpenCV's implementation of [Haar\n   feature-based cascade\n   classifiers](http://docs.opencv.org/trunk/d7/d8b/tutorial_py_face_detection.html)\n   to detect human faces in images.\n\n```\n-\u003e 100% images of the first 100 human_files_short files were detected as human face.\n-\u003e 12% images of the first 100 dog_files_short files were detected as human face.\n```\n\n2. **Detect Dogs with ResNet-50**: We use a pre-trained\n   [ResNet-50](http://ethereon.github.io/netscope/#/gist/db945b393d40bfa26006)\n   model to detect dogs in images.\n\n```\n-\u003e 0% images of the first 100 human_files_short files were detected as dog.\n-\u003e 100% images of the first 100 dog_files_short files were detected as dog.\n```\n\n3. **CNN from Scratch**: `Conv2D-16 ReLU, Conv2D-32 ReLU, Flatten, Dense-32 ReLU, Dense-133 softmax`.\n\n```\nTest accuracy: 1.0817%\n```\n\n4. **Transfer learning with VGG16**: The model uses the the pre-trained VGG-16\n   model as a fixed feature extractor, where the last convolutional output of\n   VGG-16 is fed as input to our model.\n\n![vgg16](images/output_vgg16.png)\n\n\n5. **Transfer learning with Xception**: It is a reliable, efficient and widely\n   used architecture for transfer learning in image classification tasks due to\n   its ability to learn deep features without overfitting.\n\n![Xception](images/output_xception.png)\n![Xception](images/output_xception2.png)\n\n6. **Best model**\n\n| Model        | Test accuracy |\n| ------------ | ------------- |\n| CNN          | 1.3221%       |\n| VGG16        | 73.0861%      |\n| **Xception** | **79.0670%**  |\n\n\n![output_xception_dog](images/output_xception_dog.png)\n![output_xception_human](images/output_xception_human.png)\n![output_neither](images/output_neither.png)\n\n## App\n\nThe web application allows you to select and load an image (dog, human, or\nothers), to later predict the Dog Breed.\n\n![dog_breed_classifier](images/dog_breed_classifier.gif)\n\n## Conclusions\n\nIn this project, we tested three different models: a basic CNN, and transfer\nlearning with VGG16 and **Xception**. The results showed improvements in\naccuracy, as seen in the summary results table. Xception provided the best\nperformance, improving upon VGG16, which already delivered strong results.\nUltimately, we selected Xception as our top-performing model, and it performed\nwell even on challenging images, such as a pencil sketch of a dog.\n\n## References\n\n- [Data Scientist Nanodegree\n  Program](https://www.udacity.com/course/data-scientist-nanodegree--nd025)\n\n---\n\nmade with 💙 by [mafda](https://mafda.github.io/)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmafda%2Fdog_breed_classifier","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmafda%2Fdog_breed_classifier","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmafda%2Fdog_breed_classifier/lists"}