{"id":83688,"date":"2021-08-10T09:00:25","date_gmt":"2021-08-10T03:30:25","guid":{"rendered":"https:\/\/techvidvan.com\/tutorials\/?p=83688"},"modified":"2021-08-10T09:00:25","modified_gmt":"2021-08-10T03:30:25","slug":"dog-breed-classification","status":"publish","type":"post","link":"https:\/\/techvidvan.com\/tutorials\/dog-breed-classification\/","title":{"rendered":"Dog\u2019s Breed Identification using Deep Learning"},"content":{"rendered":"<p>Once I went to a park and came across a very cute dog. I was unaware of its breed and was very curious to know that the dog belongs to which family? Are you also anxious to know about the varieties of dog breeds? Then you are at the right place. Let\u2019s together create a Deep Learning model for the dog\u2019s breed identification just by looking at its image.<\/p>\n<h3>About the Dog\u2019s Breed Identification Project<\/h3>\n<p>In this Python machine learning project, we will build a model for dog\u2019s breed identification. We will convert all Images of Dog\u2019s to number format using \u2018OpenCV\u2019 and then feed them into the Resnet50V2, a special type of neural network under the Transfer Learning technique, which will help us to identify dog\u2019s breed.<\/p>\n<h3>Dataset for Dog\u2019s Breed Identification Project<\/h3>\n<p>You can download the Dataset for this project from here: <a href=\"https:\/\/www.kaggle.com\/c\/dog-breed-identification\"><strong>Dog&#8217;s Breed Identification Dataset<\/strong><\/a><\/p>\n<h3>The Model Architecture<\/h3>\n<h4>What is Transfer Learning?<\/h4>\n<p>In the Transfer Learning process, a pre-trained model\u2019s layer having weights and parameters are used to train another model. Pretrained model layer\u2019s are trained on Millions of datas of different categories. This process is very useful as it decreases neural networks training time and also results in low generalization error.<\/p>\n<p>In this project, we are going to use Residual Network (ResNet) which has a pre-trained network layer. So let\u2019s see what Resnet is.<\/p>\n<h4>What is ResNet?<\/h4>\n<p>Residual Network (ResNet) is a specific type of neural network which is used for many computer vision problems. ResNet contains convolutional, pooling, activation and fully-connected layers stacked one of the other. A convolutional neural network is a type of deep neural network, which is used for image processing and its classification. As the name suggests, Convolutional Network helps for classifying complex images by multiplying pixel value with weights and then summing them.<\/p>\n<p>These layers of ResNet are pre-trained on more than a million of images from the ImageNet database. Due to many layers, ResNet solves complex problems and increases model accuracy and performance.<\/p>\n<p>Every ResNet uses an initial filter or kernel of 3&#215;3 and 7&#215;7 size with a stride of 2. There are many versions of ResNet. In this project, we will be using Resnet50V2 (version 2) which is 50 layers deep and applies Batch Normalization, RELU activation function before the input is multiplied by convolutional operations(weight matrix).<\/p>\n<h3>Prerequisite for this project<\/h3>\n<p>You can install all the modules for this project using the following command:<\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\">pip install numpy, pandas, opencv-python , tensorflow, matplotlib , sklearn\n<\/pre>\n<p>The versions which are used in this project for python and its corresponding modules are as follows:<\/p>\n<p>1) python: 3.8.5 (or 3.x)<br \/>\n2) tensorflow: 2.3.1 <strong>*Note*<\/strong>: TensorFlow version should be 2.2 or higher in order to use keras or else install keras directly<br \/>\n3) opencv: 4.1.2<br \/>\n4) sklearn: 0.24.2<br \/>\n5) numpy: 1.19.5<br \/>\n6) pandas: 1.1.5<br \/>\n7) matplotlib : 3.2.2<\/p>\n<p>I am going to use Google\u2019s Colab Platform for model training as it provides a free GPU utility.<\/p>\n<h3>Download Dog Breed Classification Project Code<\/h3>\n<p>Please download the source code of dog breed classification with deep learning: <a href=\"https:\/\/drive.google.com\/file\/d\/1M1CbfXTzJwnhviVVGmWVvbpM-pMDelN-\/view?usp=sharing\"><strong>Dog Breed Classification Project Code<\/strong><\/a><\/p>\n<h3>Project Structure<\/h3>\n<p>train.csv: This folder contains images that we will use to train our model. There are 10,222.images in this folder.<\/p>\n<p>test.csv: This folder contains images that we will use to test our trained model. There are 10,357 images in this folder.<\/p>\n<p>labels.csv: This file contains images named \u2018id\u2019 column and \u2018breed\u2019 column containing respective breed names.<\/p>\n<p>model\/: This directory contains the optimizer, metrics, and weights of our trained model.<\/p>\n<p>dogbreed_identification.py: This is the file where we will write our code to train our model and for prediction.<\/p>\n<h3>Steps for Dog Breed Identification Project:<\/h3>\n<h4>1) Import the Libraries<\/h4>\n<p>Firstly we will create a file called \u2018dogbreed_identification.py\u2019 and import all the libraries which have been shared in the prerequisites section.<\/p>\n<p><strong>Code:<\/strong><\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\">#TechVidvan\n# load all required libraries for Dog's Breed Identification Project\nimport cv2\nimport numpy as np \nimport pandas as pd \nfrom tensorflow.keras.preprocessing.image import ImageDataGenerator\nfrom sklearn.model_selection import train_test_split\nfrom sklearn.preprocessing import LabelEncoder\nfrom tensorflow.keras.models import load_model, Model\nfrom tensorflow.keras.optimizers import RMSprop\nfrom tensorflow.keras.layers import Dense, GlobalAveragePooling2D, Dropout, BatchNormalization\nfrom tensorflow.keras.applications.resnet_v2 import ResNet50V2, preprocess_input\n\n<\/pre>\n<h4>2) Parse the Dataset file.<\/h4>\n<p>We will traverse the \u2018labels.csv\u2019 and convert it to a Dataframe. Our \u2018train_file\u2019 variable will store the location of the train folder which contains training images and \u2018test_file\u2019 variable will store the location of the test folder containing testing images.<\/p>\n<p><strong>Code:<\/strong><\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\">#read the csv file\ndf_labels = pd.read_csv(\"labels.csv\")\n#store training and testing images folder location\ntrain_file = 'train\/'\ntest_file = 'test\/'\n<\/pre>\n<p><strong>Dataset File :<\/strong><\/p>\n<p><a href=\"https:\/\/techvidvan.com\/tutorials\/wp-content\/uploads\/sites\/2\/2021\/08\/dataset-file.png\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-84263\" src=\"https:\/\/techvidvan.com\/tutorials\/wp-content\/uploads\/sites\/2\/2021\/08\/dataset-file.png\" alt=\"dataset file\" width=\"637\" height=\"464\" \/><\/a><\/p>\n<p>Let\u2019s check how many types of dog breeds are present in our dataset.<\/p>\n<p><strong>Code:<\/strong><\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\"> \n#check the total number of unique breed in our dataset file\nprint(\"Total number of unique Dog Breeds :\",len(df_labels.breed.unique()))\n<\/pre>\n<p><strong>Output<\/strong> :<\/p>\n<p><a href=\"https:\/\/techvidvan.com\/tutorials\/wp-content\/uploads\/sites\/2\/2021\/08\/unique-dog-breeds.png\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-84264\" src=\"https:\/\/techvidvan.com\/tutorials\/wp-content\/uploads\/sites\/2\/2021\/08\/unique-dog-breeds.png\" alt=\"unique dog breeds\" width=\"470\" height=\"55\" \/><\/a><\/p>\n<p>As you can see there are 120 unique types of dog breeds. For this project we will be using 60 types of dog breeds. According to your system specification, you can increase or decrease this value.<\/p>\n<p><strong>Code:<\/strong><\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\">#specify number\nnum_breeds = 60\nim_size = 224\nbatch_size = 64\nencoder = LabelEncoder()\n<\/pre>\n<p><strong>Output<\/strong> :<\/p>\n<p><a href=\"https:\/\/techvidvan.com\/tutorials\/wp-content\/uploads\/sites\/2\/2021\/08\/unique-dog-breeds-names.png\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-84265\" src=\"https:\/\/techvidvan.com\/tutorials\/wp-content\/uploads\/sites\/2\/2021\/08\/unique-dog-breeds-names.png\" alt=\"unique dog breeds names\" width=\"985\" height=\"494\" \/><\/a><\/p>\n<p>&nbsp;<\/p>\n<h4>3) Preprocessing the Data<\/h4>\n<p>As we have discussed earlier we will be using 60 different types of dog breeds. So we will choose those breeds which are more in number and have more images. For this, we will take help from the pandas &#8216;value_counts()&#8217; function. After that, change the data Frame having records of only those 60 breeds.<\/p>\n<p><strong>Code:<\/strong><\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\">#get only 60 unique breeds record \nbreed_dict = list(df_labels['breed'].value_counts().keys()) \nnew_list = sorted(breed_dict,reverse=True)[:num_breeds*2+1:2]\n#change the dataset to have only those 60 unique breed records\ndf_labels = df_labels.query('breed in @new_list')\n<\/pre>\n<p>With the help of the id column, we will create another column \u2018img_file\u2019 which will have an image name with extensions. This will be very helpful, otherwise, we have to append the extension after every iteration.<\/p>\n<p><strong>Code:<\/strong><\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\">#create new column which will contain image name with the image extension\ndf_labels['img_file'] = df_labels['id'].apply(lambda x: x + \".jpg\")\n<\/pre>\n<p><strong>Output<\/strong> :<\/p>\n<p><a href=\"https:\/\/techvidvan.com\/tutorials\/wp-content\/uploads\/sites\/2\/2021\/08\/new-dataframe.png\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-84266\" src=\"https:\/\/techvidvan.com\/tutorials\/wp-content\/uploads\/sites\/2\/2021\/08\/new-dataframe.png\" alt=\"new dataframe\" width=\"1239\" height=\"378\" \/><\/a><\/p>\n<p>As you can see we have a new column \u2018img_file\u2019 which is highlighted.<\/p>\n<h4>4) Encoding and Scaling the Data<\/h4>\n<p>Now our dataset is ready, we will perform operations on records for training and testing purposes.<\/p>\n<p>We humans can see the image and easily tell what&#8217;s inside it, but machine\u2019s require numerical data to recognize everything.<\/p>\n<p><a href=\"https:\/\/techvidvan.com\/tutorials\/wp-content\/uploads\/sites\/2\/2021\/08\/computer-vision.jpg\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-84267\" src=\"https:\/\/techvidvan.com\/tutorials\/wp-content\/uploads\/sites\/2\/2021\/08\/computer-vision.jpg\" alt=\"computer vision\" width=\"628\" height=\"540\" \/><\/a><\/p>\n<p>For this, we will be converting our image into the numerical format. So let\u2019s understand how it is done.<\/p>\n<p>Images are collections of small pixels (or picture elements) which is the smallest information about the image. As you know, all colored images are a combination of three primary colors, that is \u2018RED\u2019, \u2018GREEN\u2019 and \u2018BLUE\u2019. So accordingly, for colored images there are three Matrices or channels.<\/p>\n<p>Every element of this Matrix is called pixels. The size of the matrix depends on the number of pixels. Pixel value denotes the intensity or brightness of the pixel and ranges from 0-255. A smaller pixel value that is closer to zero represents black and a larger value closer to 255 represents white.<\/p>\n<p><a href=\"https:\/\/techvidvan.com\/tutorials\/wp-content\/uploads\/sites\/2\/2021\/08\/dog-breed-classification.jpg\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-84268\" src=\"https:\/\/techvidvan.com\/tutorials\/wp-content\/uploads\/sites\/2\/2021\/08\/dog-breed-classification.jpg\" alt=\"dog breed classification\" width=\"1080\" height=\"407\" \/><\/a><\/p>\n<p>There are various formats like Grayscale, RGB, HSV, CMYK in which images are stored. RGB is one of the most popular and we will use it in our project.<\/p>\n<p>With the help of \u2018opencv\u2019 library we will read our images using the \u2018imread()\u2019 function.<br \/>\nIt will return Numpy Array in Height, Width and Channel format. All images in our dataset are in different shapes, so resize all images to the same width and height i.e. in our case 224&#215;224. Also we will scale all values of our array in the range of -1 and 1 using the \u2018preprocess_input()\u2019 function.<\/p>\n<p><strong>Code:<\/strong><\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\">#create a numpy array of the shape\n#(number of dataset records, image size , image size, 3 for rgb channel ayer)\n#this will be input for model\ntrain_x = np.zeros((len(df_labels), im_size, im_size, 3), dtype='float32')\n \n#iterate over img_file column of our dataset\nfor i, img_id in enumerate(df_labels['img_file']):\n  #read the image file and convert into numeric format\n  #resize all images to one dimension i.e. 224x224\n  #we will get array with the shape of\n  # (224,224,3) where 3 is the RGB channels layers\n  img = cv2.resize(cv2.imread(train_file+img_id,cv2.IMREAD_COLOR),((im_size,im_size)))\n  #scale array into the range of -1 to 1.\n  #preprocess the array and expand its dimension on the axis 0 \n  img_array = preprocess_input(np.expand_dims(np.array(img[...,::-1].astype(np.float32)).copy(), axis=0))\n  #update the train_x variable with new element\n  train_x[i] = img_array\n<\/pre>\n<p>We need to encode our Breed column also because it is in the text format. After encoding, our breed column will have a value from 0 to total number of column length minus 1. These numbers are assigned alphabetically.<\/p>\n<p><strong>Code:<\/strong><\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\">#This will be the target for the model.\n#convert breed names into numerical format\ntrain_y = encoder.fit_transform(df_labels[\"breed\"].values)\n<\/pre>\n<h4>5) Training and Testing Sets<\/h4>\n<p>After our input and target sets are ready, we will split our model into training and testing sets in the ratio of 80:20, where 80% of total data will be used for training and remaining 20% for testing purposes.<\/p>\n<p><strong>Code:<\/strong><\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\">#split the dataset in the ratio of 80:20. \n#80% for training and 20% for testing purpose\nx_train, x_test, y_train, y_test = train_test_split(train_x,train_y,test_size=0.2,random_state=42)\n<\/pre>\n<h4>6) Augmentation<\/h4>\n<p>Augmentation is basically a technique that can be used to artificially expand the size of images in real-time by creating various modified versions. This will help the model to generalize and also it will improve performance.<\/p>\n<p>Some of the most used Augmentation techniques for images are :<\/p>\n<ul>\n<li>\n<div><strong>Position Augmentation :<\/strong> Changes the position of pixels (elements in our matrix) by using Scaling, Translation, Rotation, Flipping, and Cropping techniques.<\/div>\n<\/li>\n<li><strong>Color Augmentation:<\/strong> Changes the value of pixels(elements in our matrix) by changing the Brightness, Contrast, Hue, and Saturation levels.<\/li>\n<\/ul>\n<p><a href=\"https:\/\/techvidvan.com\/tutorials\/wp-content\/uploads\/sites\/2\/2021\/08\/image-augmentation.jpg\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-84269\" src=\"https:\/\/techvidvan.com\/tutorials\/wp-content\/uploads\/sites\/2\/2021\/08\/image-augmentation.jpg\" alt=\"image augmentation\" width=\"1200\" height=\"726\" \/><\/a><\/p>\n<p>We will take the help of \u2018ImageDataGenerator()\u2019 to create different types of training and testing images by modifying the original images.<\/p>\n<p><strong>Code:<\/strong><\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\">#Image augmentation using ImageDataGenerator class\ntrain_datagen = ImageDataGenerator(rotation_range=45,\n                                   width_shift_range=0.2,\n                                   height_shift_range=0.2,\n                                   shear_range=0.2,\n                                   zoom_range=0.25,\n                                   horizontal_flip=True,\n                                   fill_mode='nearest')\n \n#generate images for training sets \ntrain_generator = train_datagen.flow(x_train, \n                                     y_train, \n                                     batch_size=batch_size)\n \n#same process for Testing sets also by declaring the instance\ntest_datagen = ImageDataGenerator()\n \ntest_generator = test_datagen.flow(x_test, \n                                     y_test, \n                                     batch_size=batch_size)\n<\/pre>\n<h4>7) Build the Model<\/h4>\n<p>As we have discussed earlier, we will be using ResNet50V2 having trained parameters from Imagenet Dataset to build our model. We will not include the top layer which is the output of the pretrained network, instead, we will replace it with our input having the shape of mxnx3 dimensions. The layer expects input shape of 224&#215;224.<\/p>\n<p><strong>Code:<\/strong><\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\">#building the model using ResNet50V2 with input shape of our image array\n#weights for our network will be from of imagenet dataset\n#we will not include the first Dense layer\nresnet = ResNet50V2(input_shape = [im_size,im_size,3], weights='imagenet', include_top=False)\n#freeze all trainable layers and train only top layers \nfor layer in resnet.layers:\n    layer.trainable = False\n \n#add global average pooling layer and Batch Normalization layer\nx = resnet.output\nx = BatchNormalization()(x)\nx = GlobalAveragePooling2D()(x)\nx = Dropout(0.5)(x)\n#add fully connected layer\nx = Dense(1024, activation='relu')(x)\nx = Dropout(0.5)(x)\n<\/pre>\n<p>And finally, create a Dense(fully connected) layer for output with the shape equal to the number of breeds and \u2018softmax\u2019 activation function. Then Initialize Model Class with network input and Dense layer as output<\/p>\n<p><strong>Code:<\/strong><\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\">#add output layer having the shape equal to number of breeds\npredictions = Dense(num_breeds, activation='softmax')(x)\n \n#create model class with inputs and outputs\nmodel = Model(inputs=resnet.input, outputs=predictions)\n#model.summary()<\/pre>\n<p><strong>Output:<\/strong><\/p>\n<p>Downloading data from https:\/\/storage.googleapis.com\/tensorflow\/keras-applications\/resnet\/resnet50v2_weights_tf_dim_ordering_tf_kernels_notop.h5<\/p>\n<p>94674944\/94668760 [==============================] &#8211; 1s 0us\/step<\/p>\n<h3>7) Train the Model<\/h3>\n<p>For training the data we will be using an \u2018RMSprop\u2019 optimizer with learning rate of 1e-3(0.001) on a batch size of 64 (group of 64 images for every iteration) for 20 epochs.<\/p>\n<p>Save the model in order for the prediction process.<\/p>\n<p><strong>Code:<\/strong><\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\">#epochs for model training and learning rate for optimizer\nepochs = 20\nlearning_rate = 1e-3\n \n#using RMSprop optimizer to compile or build the model\noptimizer = RMSprop(learning_rate=learning_rate,rho=0.9)\nmodel.compile(optimizer=optimizer,\n              loss='sparse_categorical_crossentropy',\n              metrics=[\"accuracy\"])\n \n#fit the training generator data and train the model\nhist = model.fit(train_generator,\n                 steps_per_epoch= x_train.shape[0] \/\/ batch_size,\n                 epochs= epochs,\n                 validation_data= test_generator,\n                 validation_steps= x_test.shape[0] \/\/ batch_size)\n \n#Save the model for prediction\nmodel.save(\"model\")\n<\/pre>\n<p><strong>Output:<\/strong><\/p>\n<p><a href=\"https:\/\/techvidvan.com\/tutorials\/wp-content\/uploads\/sites\/2\/2021\/08\/ml-model-accuracy.png\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-84270\" src=\"https:\/\/techvidvan.com\/tutorials\/wp-content\/uploads\/sites\/2\/2021\/08\/ml-model-accuracy.png\" alt=\"ml model accuracy\" width=\"1198\" height=\"253\" \/><\/a><\/p>\n<p>As you can see we got an <strong>accuracy of 80.50%<\/strong> which is good as we are taking only 60 breeds of dogs.<\/p>\n<h4>8) Prediction<\/h4>\n<p>Finally, we will predict the breed of our image using the trained model. For prediction, I am using one of my friend&#8217;s Dog Images, a \u2018Rottweiler\u2019 breed which was taken from his phone.<\/p>\n<p><strong>Code:<\/strong><\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\">#load the model\nmodel = load_model(\"model\")\n \n#get the image of the dog for prediction\npred_img_path = 'rottweiler.jpg'\n#read the image file and convert into numeric format\n#resize all images to one dimension i.e. 224x224\npred_img_array = cv2.resize(cv2.imread(pred_img_path,cv2.IMREAD_COLOR),((im_size,im_size)))\n#scale array into the range of -1 to 1.\n#expand the dimension on the axis 0 and normalize the array values\npred_img_array = preprocess_input(np.expand_dims(np.array(pred_img_array[...,::-1].astype(np.float32)).copy(), axis=0))\n \n#feed the model with the image array for prediction\npred_val = model.predict(np.array(pred_img_array,dtype=\"float32\"))\n \n#display the image of dog\ncv2.imshow(\u201cTechVidvan\u201d,cv2.resize(cv2.imread(pred_img_path,cv2.IMREAD_COLOR),((im_size,im_size)))) \n \n#display the predicted breed of dog\npred_breed = sorted(new_list)[np.argmax(pred_val)]\nprint(\"Predicted Breed for this Dog is :\",pred_breed)\n<\/pre>\n<h3>Dog\u2019s Breed Identification Output<\/h3>\n<p><a href=\"https:\/\/techvidvan.com\/tutorials\/wp-content\/uploads\/sites\/2\/2021\/08\/dogs-breed-identification-output.png\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-84271\" src=\"https:\/\/techvidvan.com\/tutorials\/wp-content\/uploads\/sites\/2\/2021\/08\/dogs-breed-identification-output.png\" alt=\"dog's breed identification output\" width=\"819\" height=\"383\" \/><\/a><\/p>\n<h3>Summary<\/h3>\n<p>In this project, we have developed a model which predicts the breed from the Dog\u2019s image using the Pretrained Residual Neural Network, ResNet50V2. We got an accuracy of 80.50% which is good as we have taken only 60 unique classes of breeds for training and testing sets and only 20 epochs. You can increase the number of breed classes and epochs to increase the model accuracy.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Once I went to a park and came across a very cute dog. I was unaware of its breed and was very curious to know that the dog belongs to which family? Are you&#46;&#46;&#46;<\/p>\n","protected":false},"author":1,"featured_media":84272,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[210],"tags":[2598,4042,4043,4044,4045,4046,204],"class_list":["post-83688","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-machine-learning","tag-deep-learning-project","tag-dog-breed-classification","tag-dog-breed-identification","tag-dogs-breed-identification","tag-dogs-breed-identification-project","tag-dogs-breed-identification-source-code","tag-machine-learning-project"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v27.7 - https:\/\/yoast.com\/product\/yoast-seo-wordpress\/ -->\n<title>Dog\u2019s Breed Identification using Deep Learning - TechVidvan<\/title>\n<meta name=\"description\" content=\"Build a model for dog\u2019s breed identification. Create a machine learning model to classify images of Dog using \u2018OpenCV\u2019 &amp; feed them into Resnet50V2.\" \/>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/techvidvan.com\/tutorials\/dog-breed-classification\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Dog\u2019s Breed Identification using Deep Learning - TechVidvan\" \/>\n<meta property=\"og:description\" content=\"Build a model for dog\u2019s breed identification. Create a machine learning model to classify images of Dog using \u2018OpenCV\u2019 &amp; feed them into Resnet50V2.\" \/>\n<meta property=\"og:url\" content=\"https:\/\/techvidvan.com\/tutorials\/dog-breed-classification\/\" \/>\n<meta property=\"og:site_name\" content=\"TechVidvan\" \/>\n<meta property=\"article:publisher\" content=\"https:\/\/www.facebook.com\/TechVidvan\/\" \/>\n<meta property=\"article:published_time\" content=\"2021-08-10T03:30:25+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/techvidvan.com\/tutorials\/wp-content\/uploads\/2021\/08\/dog-breed-identification-deep-learning-project.jpg\" \/>\n\t<meta property=\"og:image:width\" content=\"1200\" \/>\n\t<meta property=\"og:image:height\" content=\"628\" \/>\n\t<meta property=\"og:image:type\" content=\"image\/jpeg\" \/>\n<meta name=\"author\" content=\"TechVidvan Team\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:creator\" content=\"@vidvantech\" \/>\n<meta name=\"twitter:site\" content=\"@vidvantech\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"TechVidvan Team\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"12 minutes\" \/>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"Dog\u2019s Breed Identification using Deep Learning - TechVidvan","description":"Build a model for dog\u2019s breed identification. Create a machine learning model to classify images of Dog using \u2018OpenCV\u2019 & feed them into Resnet50V2.","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/techvidvan.com\/tutorials\/dog-breed-classification\/","og_locale":"en_US","og_type":"article","og_title":"Dog\u2019s Breed Identification using Deep Learning - TechVidvan","og_description":"Build a model for dog\u2019s breed identification. Create a machine learning model to classify images of Dog using \u2018OpenCV\u2019 & feed them into Resnet50V2.","og_url":"https:\/\/techvidvan.com\/tutorials\/dog-breed-classification\/","og_site_name":"TechVidvan","article_publisher":"https:\/\/www.facebook.com\/TechVidvan\/","article_published_time":"2021-08-10T03:30:25+00:00","og_image":[{"width":1200,"height":628,"url":"https:\/\/techvidvan.com\/tutorials\/wp-content\/uploads\/2021\/08\/dog-breed-identification-deep-learning-project.jpg","type":"image\/jpeg"}],"author":"TechVidvan Team","twitter_card":"summary_large_image","twitter_creator":"@vidvantech","twitter_site":"@vidvantech","twitter_misc":{"Written by":"TechVidvan Team","Est. reading time":"12 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/techvidvan.com\/tutorials\/dog-breed-classification\/#article","isPartOf":{"@id":"https:\/\/techvidvan.com\/tutorials\/dog-breed-classification\/"},"author":{"name":"TechVidvan Team","@id":"https:\/\/techvidvan.com\/tutorials\/#\/schema\/person\/e9c26e74dd3d87421f7ada9433b8cd22"},"headline":"Dog\u2019s Breed Identification using Deep Learning","datePublished":"2021-08-10T03:30:25+00:00","mainEntityOfPage":{"@id":"https:\/\/techvidvan.com\/tutorials\/dog-breed-classification\/"},"wordCount":1590,"commentCount":0,"publisher":{"@id":"https:\/\/techvidvan.com\/tutorials\/#organization"},"image":{"@id":"https:\/\/techvidvan.com\/tutorials\/dog-breed-classification\/#primaryimage"},"thumbnailUrl":"https:\/\/techvidvan.com\/tutorials\/wp-content\/uploads\/2021\/08\/dog-breed-identification-deep-learning-project.jpg","keywords":["deep learning project","dog breed classification","Dog Breed Identification","Dog\u2019s Breed Identification","Dog\u2019s Breed Identification project","Dog\u2019s Breed Identification source code","machine learning project"],"articleSection":["Machine Learning Tutorials"],"inLanguage":"en-US","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/techvidvan.com\/tutorials\/dog-breed-classification\/#respond"]}]},{"@type":"WebPage","@id":"https:\/\/techvidvan.com\/tutorials\/dog-breed-classification\/","url":"https:\/\/techvidvan.com\/tutorials\/dog-breed-classification\/","name":"Dog\u2019s Breed Identification using Deep Learning - TechVidvan","isPartOf":{"@id":"https:\/\/techvidvan.com\/tutorials\/#website"},"primaryImageOfPage":{"@id":"https:\/\/techvidvan.com\/tutorials\/dog-breed-classification\/#primaryimage"},"image":{"@id":"https:\/\/techvidvan.com\/tutorials\/dog-breed-classification\/#primaryimage"},"thumbnailUrl":"https:\/\/techvidvan.com\/tutorials\/wp-content\/uploads\/2021\/08\/dog-breed-identification-deep-learning-project.jpg","datePublished":"2021-08-10T03:30:25+00:00","description":"Build a model for dog\u2019s breed identification. Create a machine learning model to classify images of Dog using \u2018OpenCV\u2019 & feed them into Resnet50V2.","breadcrumb":{"@id":"https:\/\/techvidvan.com\/tutorials\/dog-breed-classification\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/techvidvan.com\/tutorials\/dog-breed-classification\/"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/techvidvan.com\/tutorials\/dog-breed-classification\/#primaryimage","url":"https:\/\/techvidvan.com\/tutorials\/wp-content\/uploads\/2021\/08\/dog-breed-identification-deep-learning-project.jpg","contentUrl":"https:\/\/techvidvan.com\/tutorials\/wp-content\/uploads\/2021\/08\/dog-breed-identification-deep-learning-project.jpg","width":1200,"height":628},{"@type":"BreadcrumbList","@id":"https:\/\/techvidvan.com\/tutorials\/dog-breed-classification\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/techvidvan.com\/tutorials\/"},{"@type":"ListItem","position":2,"name":"Dog\u2019s Breed Identification using Deep Learning"}]},{"@type":"WebSite","@id":"https:\/\/techvidvan.com\/tutorials\/#website","url":"https:\/\/techvidvan.com\/tutorials\/","name":"TechVidvan Blogs","description":"","publisher":{"@id":"https:\/\/techvidvan.com\/tutorials\/#organization"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/techvidvan.com\/tutorials\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":"Organization","@id":"https:\/\/techvidvan.com\/tutorials\/#organization","name":"TechVidvan","url":"https:\/\/techvidvan.com\/tutorials\/","logo":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/techvidvan.com\/tutorials\/#\/schema\/logo\/image\/","url":"https:\/\/techvidvan.com\/tutorials\/wp-content\/uploads\/2024\/03\/techvidvan-logo-200x50-1.webp","contentUrl":"https:\/\/techvidvan.com\/tutorials\/wp-content\/uploads\/2024\/03\/techvidvan-logo-200x50-1.webp","width":200,"height":50,"caption":"TechVidvan"},"image":{"@id":"https:\/\/techvidvan.com\/tutorials\/#\/schema\/logo\/image\/"},"sameAs":["https:\/\/www.facebook.com\/TechVidvan\/","https:\/\/x.com\/vidvantech"]},{"@type":"Person","@id":"https:\/\/techvidvan.com\/tutorials\/#\/schema\/person\/e9c26e74dd3d87421f7ada9433b8cd22","name":"TechVidvan Team","description":"The TechVidvan Team delivers practical, beginner-friendly tutorials on programming, Java, Python, C++, DSA, AI, ML, data Science, Android, Flutter, MERN, Web Development, and technology. Our experts are here to help you upskill and excel in today\u2019s tech industry."}]}},"amp_enabled":false,"_links":{"self":[{"href":"https:\/\/techvidvan.com\/tutorials\/wp-json\/wp\/v2\/posts\/83688","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/techvidvan.com\/tutorials\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/techvidvan.com\/tutorials\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/techvidvan.com\/tutorials\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/techvidvan.com\/tutorials\/wp-json\/wp\/v2\/comments?post=83688"}],"version-history":[{"count":0,"href":"https:\/\/techvidvan.com\/tutorials\/wp-json\/wp\/v2\/posts\/83688\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/techvidvan.com\/tutorials\/wp-json\/wp\/v2\/media\/84272"}],"wp:attachment":[{"href":"https:\/\/techvidvan.com\/tutorials\/wp-json\/wp\/v2\/media?parent=83688"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/techvidvan.com\/tutorials\/wp-json\/wp\/v2\/categories?post=83688"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/techvidvan.com\/tutorials\/wp-json\/wp\/v2\/tags?post=83688"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}