So you've trained a PyTorch convolutional neural network and you've trained a Keros with TensorFlow
back end convolutional neural network.
So you should have a good idea of the differences.
However, let's do a quick recap and I'll explain the differences between PyTorch and Keras in a bit
more detail and hopefully know that you actually have some hands on understanding of both libraries.
This lesson will feel a bit better.
It will reinforce what we've we've talked about before.
So let's begin with TensorFlow.
So when we used Keros, what did we do?
Well, Keros, think of Keros as an API that builds upon TensorFlow, so it allows you to access and
do and implement complex TensorFlow functions and scripting.
However, without actually knowing the TensorFlow could, so it does it behind the scenes.
So that should tell you that TensorFlow is a fairly low level library, and it is.
When it first came out in 2015, I remember sitting down and going to the library, comparing it to
the know, and I did find it a bit tricky to grasp all the concepts.
However, Keros was a godsend at that time in 2016 when I started using it.
It allowed you to build neural networks, so convolutional neural networks so much faster and create
such powerful deep networks almost effortlessly.
So you've seen this before, but I'll talk about it again.
TensorFlow was written in C++ and uses Nvidia's CUDA Compute Package, which stands for Compute Unify
Device Architecture API allows you to implement very complicated computational calculations on the GPU
quite quickly and scalable.
Also, it's primarily used in Python that is TensorFlow, not CUDA.
I'm talking about and the other APIs or app is exist in other languages.
But obviously C++, which is a direct sort of like API.
It's a direct coding core Java, JavaScript and Swift and TensorFlow 2.0, which incorporated Kerberos,
was released in 2019.
Late 2019, if I'm if I'm not mistaken.
So you've seen PyTorch and Page two, which basically came out a little bit after TensorFlow, maybe
in about 2018 or so it became popular, and it's free and open source apps from Facebook iResearch research
team.
It's also Cbus Tensor Library Tensor, meaning that that's what the matrices are called.
And when we're doing deep learning, we describe it as a tensor because that's what it is mathematically,
and it's also written with CUDA capabilities, which makes it super fast as well.
It's primarily meant for Python, although it's the C++ as well supported, and it's basically it's
Python.
This scientific computing package aimed at replacement for a nampai when using by using, allowing you
to use the power of GPUs and also provides you with a very good deep learning research platform and
PyTorch is actually very customizable.
It's one of the key advantages in why it's taken over the research world.
So much so.
Keros Keros was developed by Francois Shuli, and basically he made a proposal explained to you before.
That basically allows you to access to low level TensorFlow operations.
Initially, it was TensorFlow A. A. They supported.
The T.A. has been deprecated now, and it allows you to build deep networks so easily.
It's written in Python for Python, and it's basically primarily meant to make TensorFlow easy to use.
So and that's why in 2019, Keros is no bundled with TensorFlow 2.0.
So let's compare them, though.
So TensorFlow and Python, it's about fairly low level, meaning that they actually go into the nitty
gritty detail of implementing each layer.
You have specified input output sizes, activation functions.
I mean, you do all of that in Keros, but they do take care a lot of a lot of things for you and Carrera's
when comparing it to Pi Touch or TensorFlow.
So Chris is simpler and definitely quicker to implement and also less prone to user errors, which is
a good thing, especially when you're prototyping code.
TensorFlow has definitely being first to market and supported by Google has gained wider adoption in
the industry at large.
However, I will tell you in 2021 right now, almost all companies I'm seeing switching are switching
to by touch.
It's remarkable how fast touch is gaining popularity, and the reason for that was because many state
of the art networks that are done in research are built using PI Watch.
And the only way to implement those on your production side is by using PI torture as well.
I mean, you can.
Could the same thing in TensorFlow, but it's often challenging when why do that, when the code is
available on GitHub in Python already?
So does this apply to watch in that case?
So the myriad of differences between Keras and PyTorch is that this is a high level API that can use
different buckets.
However, right now it's almost exclusively going to use TensorFlow 2.0.
No one is going to use the old divisions of care has to do with anyone else to have some legacy thing
to support, which is unlikely.
So Python to do is also fairly low level, and because of that, it requires a lot more.
Could coding knowledge of Python to implement the same things that Karas does quite easily, which you've
seen before, you've seen how easy it is to implement model that fits in Keros, whereas the actual
training loop code in Python, which can become quite complicated.
So but Python much to offer something here.
It's a very python like language and scripting API.
So if you're if you're a good Python developer, you're going to find PI to.
It's very easy to work with and I do as well.
It's quite nice.
So let's take a look at some of the code here.
You can see when recruiting a PI PyTorch model how you have to enforce and inherit from the super,
using super from the fighters in that class, then you have to define your filters here or your convolutional
is your max boot.
All of these things here specified input and output sizes, while the input sizes for each layer see
the output sizes.
So it is a bit trickier to do in Python.
It's not as intuitive as carers and carers because you just you can model that ad using the sequential
model.
It's quite easy just to link layers together, and you don't even have to know about the output size.
It carries off automatically passes that information onto the next layer, whereas PyTorch doesn't.
So that's basically what I just said.
Here it is in point form, you can definitely see carers obstructs us away from the specifics and quitting
a lot, so it's quite easy to add more layers deeper and easier, but less good.
Whereas carers is simpler and modular, PyTorch, you can see, has a lot more stuff going on.
So why would you use Python watching?
Well, to me, PyTorch has definitely been more flexible.
So if you're doing some intricate state of the art deep learning, using implementing some deep learning
techniques, PyTorch will almost always be the way to go.
But it also does encourage you to have a stronger understanding of deep learning, which is a very good
thing.
And as I said, the popularity of PyTorch is growing very, very quickly, especially in the academia
and research world.
So here's a comparison table of carers first PyTorch.
I'm not going to read this for you if you want, you can pause this right now.
However, I will just discuss some things here.
Firstly, as you've seen, carers is easier to use in speed.
They're both equal.
However, PyTorch has easier multi-GPU support, so I tend to use it more often when treating it works
right now.
Because of that, debugging is quite good, and they have both very good documentation as well.
Customisation is less obviously what carers buy, which is quite good and you're constantly adding new
features.
Facebook's I-Team does a very good job of keeping Python up to date features by which probably wins
there.
However, carers is quite good, so don't take it for granted.
Carers is very, very well supported with a lot of features.
So even though I say Python, which allows you to do more experimental state of the art stuff, although
a lot of these things end up in carers just a little bit later in terms of reach, this is hard to see
right now.
I would say they're about neck and neck in equal input production and academia.
Although I do think by two which has the advantage in academia right now and support, there is tons
of libraries that support other high level frameworks that support what I touch and a lot do in the
TensorFlow as well care as being one of them deployment.
I do realise that deploying models been built in TensorFlow tends to be easier, but again, that is
changing quickly as more people are using PyTorch.
So when would you use PyTorch?
Well, if you want more visibility over the training aspects of your network, Python, which gives
you that, so a lot of researchers will train custom exotic models using Python precisely for that reason.
So if you want to also alter an existing model and add some tweaks, experiment with some of little
new blocks of CNN offer deep learning layers PEIDA, which is quite good for that.
And if you're quite good at Python, then pretty much would be pretty easy for you to use.
So when would you use Keros?
Keros is great for quick prototyping when I just want to get out a quick classifier of something.
I mean, I do use my torch now to be fair, but Keros has also always been so easy just to train some
simple classifier or something simple as well.
So Keros has is definitely quicker, and it's definitely easier to for beginners.
So because you don't have to have as deep as in-depth Python knowledge as you do with Byddwch.
So Kerry's definitely wins in that sense.
It also because it supports TensorFlow.
It's going to be quite fast.
It's going to be so many external tools that support TensorFlow functions.
Deployment is going to be quite easy as well because so many things support TensorFlow models.
So Keros is quite good.
You're not going to go wrong using either of these two libraries, basically.
So in terms of popularity, these are the Google Trends analysis.
This is up to 2020 and late 2020.
You can see Keros is definitely popular.
TensorFlow has been kind of going down slightly, but Python, which has been remarkably popular just
a little bit in here.
But they're both neck and neck.
And in terms of research publications, you can see who is using what in different research conferences
right now.
So A.B. and I see a Lawrence Clipper would be the top computer vision conferences, and you can see
who's using PI torch.
Most people are using PI to watch right now.
Definitely.
It's definitely a good sign.
Solid lines, I thought so.
Pi Dodge, as I said, is quite strong in the academia.
Will all of these solid lines are pointing up, whereas all the dotted lines are sort of remaining constant?
So why aren't we learning pure TensorFlow?
Well, it's even more low level and pi touch.
And to be honest, it's so it's so rare to see in that were acquitted in pure TensorFlow right now.
Maybe only in academia, academia or research papers.
You would see it.
Everyone is using cameras because it's effectively the same thing.
It does require a bit more hands-on, working around than PyTorch as well, and others have cameras
provides 95 percent of the deep learning capabilities of TensorFlow, especially in computer vision.
They have implemented so many complex algorithms with cameras and computer vision, so there's no need
to actually code these things with TensorFlow.
And learning Keras and PyTorch is a very good idea.
It's not going to.
It's not only going to open up your job prospects, but it's going to enable you to learn so much quicker.
Because, as I said, half of the market right now in both academia and production is split between
cameras and TensorFlow carries TensorFlow and PyTorch so little.
But you're going to it's not going to be you're not going to go wrong learning, but definitely not.
And many companies simply just use cameras with fatal logic in my company.
Actually, the past two or three companies have looked when no one really cares too much what library
use.
But a lot of companies are standardizing on PyTorch like my company as well.
So it's keep us in mind, so we'll stop there.
And in the next section, we'll take a look at assessing model performance, which is a very important
thing to do.
So after you train your model, you need to understand how to analyze its performance metrics.
So I'll see you in the next lesson.
Thank you.