-
-
Notifications
You must be signed in to change notification settings - Fork 259
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1107 from Knighthawk-Leo/main
Dog Breed Identification
- Loading branch information
Showing
128 changed files
with
14,630 additions
and
0 deletions.
There are no files selected for viewing
Empty file.
Binary file added
BIN
+155 Bytes
...ProcessingScripts/Dog-Breed-Identification/ImgUpload/__pycache__/__init__.cpython-310.pyc
Binary file not shown.
Binary file added
BIN
+153 Bytes
...eProcessingScripts/Dog-Breed-Identification/ImgUpload/__pycache__/__init__.cpython-39.pyc
Binary file not shown.
Binary file added
BIN
+196 Bytes
ImageProcessingScripts/Dog-Breed-Identification/ImgUpload/__pycache__/admin.cpython-310.pyc
Binary file not shown.
Binary file added
BIN
+194 Bytes
ImageProcessingScripts/Dog-Breed-Identification/ImgUpload/__pycache__/admin.cpython-39.pyc
Binary file not shown.
Binary file added
BIN
+440 Bytes
ImageProcessingScripts/Dog-Breed-Identification/ImgUpload/__pycache__/apps.cpython-310.pyc
Binary file not shown.
Binary file added
BIN
+436 Bytes
ImageProcessingScripts/Dog-Breed-Identification/ImgUpload/__pycache__/apps.cpython-39.pyc
Binary file not shown.
Binary file added
BIN
+393 Bytes
ImageProcessingScripts/Dog-Breed-Identification/ImgUpload/__pycache__/form.cpython-310.pyc
Binary file not shown.
Binary file added
BIN
+389 Bytes
ImageProcessingScripts/Dog-Breed-Identification/ImgUpload/__pycache__/form.cpython-39.pyc
Binary file not shown.
Binary file added
BIN
+193 Bytes
ImageProcessingScripts/Dog-Breed-Identification/ImgUpload/__pycache__/models.cpython-310.pyc
Binary file not shown.
Binary file added
BIN
+191 Bytes
ImageProcessingScripts/Dog-Breed-Identification/ImgUpload/__pycache__/models.cpython-39.pyc
Binary file not shown.
Binary file added
BIN
+455 Bytes
ImageProcessingScripts/Dog-Breed-Identification/ImgUpload/__pycache__/urls.cpython-310.pyc
Binary file not shown.
Binary file added
BIN
+453 Bytes
ImageProcessingScripts/Dog-Breed-Identification/ImgUpload/__pycache__/urls.cpython-39.pyc
Binary file not shown.
Binary file added
BIN
+1.55 KB
ImageProcessingScripts/Dog-Breed-Identification/ImgUpload/__pycache__/views.cpython-310.pyc
Binary file not shown.
Binary file added
BIN
+1.54 KB
ImageProcessingScripts/Dog-Breed-Identification/ImgUpload/__pycache__/views.cpython-39.pyc
Binary file not shown.
3 changes: 3 additions & 0 deletions
3
ImageProcessingScripts/Dog-Breed-Identification/ImgUpload/admin.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
from django.contrib import admin | ||
|
||
# Register your models here. |
6 changes: 6 additions & 0 deletions
6
ImageProcessingScripts/Dog-Breed-Identification/ImgUpload/apps.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
from django.apps import AppConfig | ||
|
||
|
||
class ImguploadConfig(AppConfig): | ||
default_auto_field = 'django.db.models.BigAutoField' | ||
name = 'ImgUpload' |
7 changes: 7 additions & 0 deletions
7
ImageProcessingScripts/Dog-Breed-Identification/ImgUpload/form.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
from django import forms | ||
class ImageUploadForm(forms.Form): | ||
image=forms.ImageField() | ||
|
||
|
||
|
||
|
Empty file.
Binary file added
BIN
+164 Bytes
...Scripts/Dog-Breed-Identification/ImgUpload/migrations/__pycache__/__init__.cpython-39.pyc
Binary file not shown.
3 changes: 3 additions & 0 deletions
3
ImageProcessingScripts/Dog-Breed-Identification/ImgUpload/models.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
from django.db import models | ||
|
||
# Create your models here. |
3 changes: 3 additions & 0 deletions
3
ImageProcessingScripts/Dog-Breed-Identification/ImgUpload/tests.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
from django.test import TestCase | ||
|
||
# Create your tests here. |
11 changes: 11 additions & 0 deletions
11
ImageProcessingScripts/Dog-Breed-Identification/ImgUpload/urls.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
from django.conf.urls import url | ||
from django.contrib import admin | ||
from django.urls import path | ||
from django.urls.conf import include | ||
from . import views | ||
|
||
urlpatterns = [ | ||
|
||
url(r'^$', views.home, name='home'), | ||
url(r'imageprocess', views.imageprocess , name='imageprocess') | ||
] |
46 changes: 46 additions & 0 deletions
46
ImageProcessingScripts/Dog-Breed-Identification/ImgUpload/views.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
from numpy.lib.function_base import append | ||
from myWebApp.ImgUpload.form import ImageUploadForm | ||
from django import forms | ||
from django.shortcuts import render | ||
from .form import ImageUploadForm | ||
|
||
from keras.applications.resnet import ResNet50 | ||
from keras.preprocessing import image | ||
from keras.applications.resnet import preprocess_input, decode_predictions | ||
import numpy as np | ||
|
||
def home(request): | ||
return render(request,'home.html') | ||
|
||
def imageprocess(request): | ||
form=ImageUploadForm(request.POST, request.FILES ) | ||
if form.is_valid(): | ||
handle_uploaded_file(request.FILES['image']) | ||
model= ResNet50(weights='imagenet') | ||
img_path = 'img.jpg' | ||
imge=image.load_img(img_path, target_size=(224,224)) | ||
x=image.img_to_array(imge) | ||
x=np.expand_dims(x,axis=0) | ||
x=preprocess_input(x) | ||
preds=model.predict(x) | ||
print('Pridicted',decode_predictions(preds,top=3)[0]) | ||
|
||
html=decode_predictions(preds,top=3,)[0] | ||
|
||
res=[] | ||
for e in html: | ||
res.append((e[1],np.round(e[2]*100,2))) | ||
return render(request,'result.html' , {'res':res}) | ||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
def handle_uploaded_file(f): | ||
with open('img.jpg','wb+') as destination: | ||
for chunk in f.chunks(): | ||
destination.write(chunk) | ||
|
||
# Create your views here. |
113 changes: 113 additions & 0 deletions
113
ImageProcessingScripts/Dog-Breed-Identification/README.md
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,113 @@ | ||
# ML-Based-Dog-Breed-Identifier | ||
|
||
## Aim | ||
To identify the breed of Dog | ||
|
||
## Purpose | ||
This is a Django Based Web Site To Identify the Breed of which your DOG belogs All You Need To Do is to Follow These Steps | ||
|
||
## Workflow of the Project | ||
From the Home user can find the tab to upload the Image and on result can be viewed on the result page. | ||
|
||
## you need to install following libraries to run this python program in cmd | ||
``` | ||
pip install tensorflow | ||
pip install keras | ||
pip install django | ||
pip install numpy | ||
``` | ||
## Compilation Steps | ||
|
||
#### Step 1: Forking the repository : | ||
|
||
To work on this project, you will first need to make your copy of the repository. To do this, you should fork the repository and then clone it so that you have a local working copy. | ||
|
||
Get your own Fork/Copy of repository by clicking `Fork` button right upper corner.<br><br> | ||
|
||
#### Step 2: Clone the Forked Repository | ||
|
||
After the repository is forked, you can now clone it so that you have a local working copy of the codebase. | ||
|
||
To make your local copy of the repository follow the steps: | ||
- Open the Command Prompt | ||
- Type this command: | ||
|
||
```bash | ||
$ git clone https://github.com/<your-github-username>/ML-Based-Dog-Breed-Identifier | ||
``` | ||
|
||
|
||
#### Step 3: Creating a new branch (IMP) | ||
This is one of the very important step that you should follow to contribute. A branch helps to manage the workflow, isolate your code and does not creates a mess. To create a new branch: | ||
|
||
```bash | ||
$ git branch <name_of_branch> | ||
$ git checkout -b <name_of_branch> | ||
``` | ||
|
||
Keep your cloned repo upto date by pulling from upstream (this will also avoid any merge conflicts while committing new changes) | ||
```bash | ||
git pull origin main | ||
``` | ||
|
||
#### Step 4: Setting up Project | ||
|
||
##### For Django: | ||
**1. Create a Virtual Environment** | ||
|
||
- *On macOS and Linux:* | ||
```bash | ||
python3 -m venv env | ||
``` | ||
- *Windows* | ||
```bash | ||
py -m venv env | ||
```` | ||
|
||
**2. Activate the Virtual Environment** | ||
- *On Windows* | ||
```bash | ||
.\env\Scripts\activate | ||
``` | ||
- *On macOS and Linux:* | ||
```bash | ||
source env/bin/activate | ||
``` | ||
|
||
**4. Make Migrations** | ||
|
||
```bash | ||
python manage.py makemigrations | ||
python manage.py migrate | ||
``` | ||
**5. Run Server** | ||
|
||
```bash | ||
python manage.py runserver | ||
``` | ||
|
||
|
||
**5.** Go to ` http://127.0.0.1:8000/` and enjoy the application | ||
|
||
|
||
|
||
## Outputs | ||
|
||
### Home Page | ||
<img src="https://github.com/Knighthawk-Leo/ML-Based-Dog-Breed-Identifier/blob/main/Images/home.png"> | ||
|
||
### Result Page | ||
<img src="https://github.com/Knighthawk-Leo/ML-Based-Dog-Breed-Identifier/blob/main/Images/Result.png"> | ||
|
||
## Author | ||
|
||
<a href='https://github.com/Knighthawk-Leo'>Sanskar Dwivedi</a> | ||
|
||
## Conclusion | ||
Identified the Dog's Breed and results are significantly great . | ||
## | ||
[![forthebadge](https://forthebadge.com/images/badges/built-with-love.svg)](https://forthebadge.com) [![forthebadge](https://forthebadge.com/images/badges/built-by-developers.svg)](https://forthebadge.com) [![forthebadge](https://forthebadge.com/images/badges/built-with-swag.svg)](https://forthebadge.com) [![forthebadge](https://forthebadge.com/images/badges/made-with-python.svg)](https://forthebadge.com) | ||
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
#!/usr/bin/env python | ||
"""Django's command-line utility for administrative tasks.""" | ||
import os | ||
import sys | ||
|
||
|
||
def main(): | ||
"""Run administrative tasks.""" | ||
os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'myWebApp.settings') | ||
try: | ||
from django.core.management import execute_from_command_line | ||
except ImportError as exc: | ||
raise ImportError( | ||
"Couldn't import Django. Are you sure it's installed and " | ||
"available on your PYTHONPATH environment variable? Did you " | ||
"forget to activate a virtual environment?" | ||
) from exc | ||
execute_from_command_line(sys.argv) | ||
|
||
|
||
if __name__ == '__main__': | ||
main() |
Empty file.
Binary file added
BIN
+164 Bytes
...gScripts/Dog-Breed-Identification/myWebApp/ImgUpload/__pycache__/__init__.cpython-310.pyc
Binary file not shown.
Binary file added
BIN
+153 Bytes
...ngScripts/Dog-Breed-Identification/myWebApp/ImgUpload/__pycache__/__init__.cpython-39.pyc
Binary file not shown.
Binary file added
BIN
+194 Bytes
...ssingScripts/Dog-Breed-Identification/myWebApp/ImgUpload/__pycache__/admin.cpython-39.pyc
Binary file not shown.
Binary file added
BIN
+436 Bytes
...essingScripts/Dog-Breed-Identification/myWebApp/ImgUpload/__pycache__/apps.cpython-39.pyc
Binary file not shown.
Binary file added
BIN
+402 Bytes
...ssingScripts/Dog-Breed-Identification/myWebApp/ImgUpload/__pycache__/form.cpython-310.pyc
Binary file not shown.
Binary file added
BIN
+389 Bytes
...essingScripts/Dog-Breed-Identification/myWebApp/ImgUpload/__pycache__/form.cpython-39.pyc
Binary file not shown.
Binary file added
BIN
+191 Bytes
...singScripts/Dog-Breed-Identification/myWebApp/ImgUpload/__pycache__/models.cpython-39.pyc
Binary file not shown.
Binary file added
BIN
+453 Bytes
...essingScripts/Dog-Breed-Identification/myWebApp/ImgUpload/__pycache__/urls.cpython-39.pyc
Binary file not shown.
Binary file added
BIN
+901 Bytes
...ssingScripts/Dog-Breed-Identification/myWebApp/ImgUpload/__pycache__/views.cpython-39.pyc
Binary file not shown.
3 changes: 3 additions & 0 deletions
3
ImageProcessingScripts/Dog-Breed-Identification/myWebApp/ImgUpload/admin.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
from django.contrib import admin | ||
|
||
# Register your models here. |
6 changes: 6 additions & 0 deletions
6
ImageProcessingScripts/Dog-Breed-Identification/myWebApp/ImgUpload/apps.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
from django.apps import AppConfig | ||
|
||
|
||
class ImguploadConfig(AppConfig): | ||
default_auto_field = 'django.db.models.BigAutoField' | ||
name = 'ImgUpload' |
7 changes: 7 additions & 0 deletions
7
ImageProcessingScripts/Dog-Breed-Identification/myWebApp/ImgUpload/form.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
from django import forms | ||
class ImageUploadForm(forms.Form): | ||
image=forms.ImageField() | ||
|
||
|
||
|
||
|
Empty file.
Binary file added
BIN
+164 Bytes
...og-Breed-Identification/myWebApp/ImgUpload/migrations/__pycache__/__init__.cpython-39.pyc
Binary file not shown.
3 changes: 3 additions & 0 deletions
3
ImageProcessingScripts/Dog-Breed-Identification/myWebApp/ImgUpload/models.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
from django.db import models | ||
|
||
# Create your models here. |
3 changes: 3 additions & 0 deletions
3
ImageProcessingScripts/Dog-Breed-Identification/myWebApp/ImgUpload/tests.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
from django.test import TestCase | ||
|
||
# Create your tests here. |
11 changes: 11 additions & 0 deletions
11
ImageProcessingScripts/Dog-Breed-Identification/myWebApp/ImgUpload/urls.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
# from django.conf.urls import url | ||
from django.contrib import admin | ||
from django.urls import include ,re_path | ||
from django.urls.conf import include | ||
from . import views | ||
|
||
urlpatterns = [ | ||
|
||
re_path(r'^$', views.home, name='home'), | ||
re_path(r'imageprocess', views.imageprocess , name='imageprocess') | ||
] |
20 changes: 20 additions & 0 deletions
20
ImageProcessingScripts/Dog-Breed-Identification/myWebApp/ImgUpload/views.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
from myWebApp.ImgUpload.form import ImageUploadForm | ||
from django import forms | ||
from django.shortcuts import render | ||
from .form import ImageUploadForm | ||
|
||
def home(request): | ||
return render(request,'home.html') | ||
|
||
def imageprocess(request): | ||
form=ImageUploadForm(request.POST, request.FILES ) | ||
if form.is_valid(): | ||
handel_uploaded_file(request.FILES['image']) | ||
return render(request,'result.html') | ||
|
||
def handel_uploaded_file(f): | ||
with open('img.jpg','wb+')as destination: | ||
for chunk in f.chunks(): | ||
destination.write(chunk) | ||
|
||
# Create your views here. |
Empty file.
Binary file added
BIN
+154 Bytes
...eProcessingScripts/Dog-Breed-Identification/myWebApp/__pycache__/__init__.cpython-310.pyc
Binary file not shown.
Binary file added
BIN
+152 Bytes
ImageProcessingScripts/Dog-Breed-Identification/myWebApp/__pycache__/__init__.cpython-39.pyc
Binary file not shown.
Binary file added
BIN
+2.41 KB
...eProcessingScripts/Dog-Breed-Identification/myWebApp/__pycache__/settings.cpython-310.pyc
Binary file not shown.
Binary file added
BIN
+2.4 KB
ImageProcessingScripts/Dog-Breed-Identification/myWebApp/__pycache__/settings.cpython-39.pyc
Binary file not shown.
Binary file added
BIN
+1.04 KB
ImageProcessingScripts/Dog-Breed-Identification/myWebApp/__pycache__/urls.cpython-310.pyc
Binary file not shown.
Binary file added
BIN
+1.02 KB
ImageProcessingScripts/Dog-Breed-Identification/myWebApp/__pycache__/urls.cpython-39.pyc
Binary file not shown.
Binary file added
BIN
+557 Bytes
ImageProcessingScripts/Dog-Breed-Identification/myWebApp/__pycache__/wsgi.cpython-39.pyc
Binary file not shown.
16 changes: 16 additions & 0 deletions
16
ImageProcessingScripts/Dog-Breed-Identification/myWebApp/asgi.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
""" | ||
ASGI config for myWebApp project. | ||
It exposes the ASGI callable as a module-level variable named ``application``. | ||
For more information on this file, see | ||
https://docs.djangoproject.com/en/3.2/howto/deployment/asgi/ | ||
""" | ||
|
||
import os | ||
|
||
from django.core.asgi import get_asgi_application | ||
|
||
os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'myWebApp.settings') | ||
|
||
application = get_asgi_application() |
Oops, something went wrong.