您的位置 > 首页 > 商业智能 > Build an Image Classification Model using Convolutional Neural Networks in PyTor ...

Build an Image Classification Model using Convolutional Neural Networks in PyTor ...

来源:分析大师 | 2019-10-08 | 发布:BOB体育娱乐平台之家

I’m enthralled by the power and capability of neural networks. Almost every breakthrough happening in the machine learning and deep learning space right now has neural network models at its core.This is especially prevalent in the field of computer vision. Neural networks have opened up possibilities of working with image data – whether that’s simple image classification or something more advanced like object detection. In short, it’s a goldmine for a data scientist like me!Simple neural networks are always a good starting point when we’re solving an image classification problem using deep learning. But they do have limitations and the model’s performance fails to improve after a certain point.This is where convolutional neural networks (CNNs) have changed the playing field. They are ubiquitous in computer vision applications. And it’s honestly a concept I feel every computer vision enthusiast should pick up quickly.This article is a continuation of my new series where I introduce you to new deep learning concepts using the popular PyTorch framework. In this article, we will understand how convolutional neural networks are helpful and how they can help us to improve our model’s performance. We will also look at the implementation of CNNs in PyTorch.This is the second article of this series and I highly recommend to go through the first part before moving forward with this article.Let’s quickly recap what we covered in the first article. We discussed the basics of PyTorch and tensors, and also looked at how PyTorch is similar to NumPy.PyTorch is a Python-based library that provides functionalities such as:Tensors in PyTorch are similar to NumPys n-dimensional arrays which can also be used with GPUs. Performing operations on these tensors is almost similar to performing operations on NumPy arrays. This makes PyTorch very user-friendly and easy to learn.In part 1 of this series, we built a simple neural network to solve a case study. We got a benchmark accuracy of around 65% on the test set using our simple model. Now, we will try to improve this score using Convolutional Neural Networks.Before we get to the implementation part, lets quickly look at why we need CNNs in the first place and how they are helpful.We can consider Convolutional Neural Networks, or CNNs, as feature extractors that help to extract features from images.In a simple neural network, we convert a 3-dimensional image to a single dimension, right? Lets look at an example to understand this:Can you identify the above image? Doesn’t seem to make a lot of sense. Now, lets look at the below image:
We can now easily say that it is an image of a dog. What if I tell you that both these images are the same? Believe me, they are! The only difference is that the first image is a 1-D representation whereas the second one is a 2-D representation of the same image.Artificial neural networks (ANNs) also lose the spatial orientation of the images. Lets again take an example and understand it: Can you identify the difference between these two images? Well, at least I cannot. It is very difficult to identify the difference since this is a 1-D representation. Now, lets look at the 2-D representation of these images:
京ICP备11001960号  京ICP证090565号 京公网安备1101084107号 论坛法律顾问:王进律师知识产权保护声明免责及隐私声明   主办单位:人大经济论坛 版权所有
联系QQ:2881989700  邮箱:service@pinggu.org
合作咨询电话:(010)62719935 广告合作电话:13661292478(刘老师)

投诉电话:(010)68466864 不良信息处理电话:(010)68466864