Instructional Material
Computer Vision with Python ($19.99 to FREE)
Welcome to the ultimate online course on Python for Computer Vision! This course is your best resource for learning how to use the Python programming language for Computer Vision. We'll be exploring how to use Python and the OpenCV (Open Computer Vision) library to analyze images and video data. The most popular platforms in the world are generating never before seen amounts of image and video data. Now more than ever it's necessary for developers to gain the necessary skills to work with image and video data using computer vision.
NLP Basic Course for Beginner ($19.99 to FREE)
Welcome to the best Natural Language Processing course on the Udemy! This course is designed to be your complete online resource for learning how to use Natural Language Processing with the Python programming language. In the course we will cover everything you need to learn in order to become a world class practitioner of NLP with Python. We'll start off with the basics, learning how to open and work with text, as well as learning how to use regular expressions to search for custom patterns inside of text files. Afterwards we will begin with the basics of Natural Language Processing, utilizing the Natural Language Toolkit library for Python, as well as the state of the art Spacy library for ultra fast tokenization, parsing, entity recognition, and lemmatization of text.
Complete Machine Learning and Data Science: Zero to Mastery
HIGHEST RATED, 4.8 (240 ratings), Created by Andrei Neagoie, Daniel Bourke, English [Auto-generated] Become a complete Data Scientist and Machine Learning engineer! Join a live online community of 180,000 developers and a course taught by industry experts that have actually worked for large companies in places like Silicon Valley and Toronto. This is a brand new Machine Learning and Data Science course just launched January 2020! Graduates of Andrei's courses are now working at Google, Tesla, Amazon, Apple, IBM, JP Morgan, Facebook, other top tech companies. Learn Data Science and Machine Learning from scratch, get hired, and have fun along the way with the most modern, up-to-date Data Science course on Udemy (we use the latest version of Python, Tensorflow 2.0 and other libraries).
What is Focal Loss and when should you use it?
In this blogpost we will understand what Focal Loss and when is it used. We will also take a dive into the math and implement it in PyTorch. Where was Focal Loss introduced and what was it used for? So, why did that work? What did Focal Loss do to make it work? Alpha and Gamma? How to implement this in code? Credits Where was Focal Loss introduced and what was it used for? Before understanding what Focal Loss is and all the details about it, letโs first quickly get an intuitive understanding of what Focal Loss actually does. Focal loss was implemented in Focal Loss for Dense Object Detection paper by He et al. For years before this paper, Object Detection was actually considered a very difficult problem to solve and it was especially considered very hard to detect small size objects inside images. See example below where the model doesnโt predict anything for the motorbike which is of relatively smaller size compared to other images. The reason why in the image above, the bike is not predicted by the model is because this model was trained using Binary Cross Entropy loss which really asks the model to be confident about what is predicting. Whereasm, what Focal Loss does is that it makes it easier for the model to predict things without being 80-100% sure that this object is โsomethingโ. In simple words, giving the model a bit more freedom to take some risk when making predictions. This is particularly important when dealing with highly imbalanced datasets because in some cases (such as cancer detection), we really need to model to take a risk and predict something even if the prediction turns out to be a False Positive. Therefore, Focal Loss is particularly useful in cases where there is a class imbalance. Another example, is in the case of Object Detection when most pixels are usually background and only very few pixels inside an image sometimes have the object of interest. OK - so focal loss was introduced in 2017, and is pretty helpful in dealing with class imbalance - great! By the way, here are the predictions of the same model when trained with Focal Loss. This might be a good time to actually analyse the two and observe the differences. This will help get an intuitive understanding about Focal Loss. So, why did that work? What did Focal Loss do to make it work? So now that we have seen an example of what Focal Loss can do, letโs try and understand why that worked. The most important bit to understand about Focal Loss is the graph below: In the graph above, the โblueโ line represents the Cross Entropy Loss. The X-axis or โprobability of ground truth classโ (letโs call it pt for simplicity) is the probability that the model predicts for the ground truth object. As an example, letโs say the model predicts that something is a bike with probability 0.6 and it actually is a bike. The in this case pt is 0.6. Also, consider the same example but this time the object is not a bike. Then pt is 0.4 because ground truth here is 0 and probability that the object is not a bike is 0.4 (1-0.6). The Y-axis is simply the loss value given pt. As can be seen from the image, when the model predicts the ground truth with a probability of 0.6, the Cross Entropy Loss is still somewhere around 0.5. Therefore, to reduce the loss, our model would have to predict the ground truth label with a much higher probability. In other words, Cross Entropy Loss asks the model to be very confident about the ground truth prediction. This in turn can actually impact the performance negatively: The Deep Learning model can actually become overconfident and therefore, the model wouldnโt generalize well. This problem of overconfidence is also highlighted in this excellent paper Beyond temperature scaling: Obtaining well-calibrated multiclass probabilities with Dirichlet calibration. Also, Label Smoothing which was introduced as part of Rethinking the Inception Architecture for Computer Vision is another way to deal with the problem. Focal Loss is different from the above mentioned solutions. As can be seen from the graph Compare FL with CE, using Focal Loss with ฮณ>1 reduces the loss for โwell-classified examplesโ or examples when the model predicts the right thing with probability > 0.5 whereas, it increases loss for โhard-to-classify examplesโ when the model predicts with probability < 0.5. Therefore, it turns the models attention towards the rare class in case of class imbalance. The Focal Loss is mathematically defined as: Scary? Itโs rather quite intuitive - read on :) Alpha and Gamma? So, what the hell are these alpha and gamma in Focal Loss? Also, we will now represent alpha as ฮฑ and gamma as ฮณ. Here is my understanding from fig-3: ฮณ controls the shape of the curve. The higher the value of ฮณ, the lower the loss for well-classified examples, so we could turn the attention of the model more towards โhard-to-classify examples. Having higher ฮณ extends the range in which an example receives low loss. Also, when ฮณ=0, this equation is equivalent to Cross Entropy Loss. How? Well, for the mathematically inclined, Cross Entropy Loss is defined as: After some refactoring and defining pt as below: Putting eq-3 in eq-2, our Cross Entropy Loss therefore, becomes: Therefore, at ฮณ=0, eq-1 becomes equivalent to eq-4 that is Focal Loss becomes equivalent to Cross Entropy Loss. Here is an excellent blogpost that explains Cross Entropy Loss. Ok, great! So now we know what ฮณ does, but, what does ฮฑ do? Another way, apart from Focal Loss, to deal with class imbalance is to introduce weights. Give high weights to the rare class and small weights to the dominating or common class. These weights are referred to as ฮฑ. Adding these weights does help with class imbalance however, the focal loss paper reports: The large class imbalance encountered during training of dense detectors overwhelms the cross entropy loss. Easily classified negatives comprise the majority of the loss and dominate the gradient. While ฮฑ balances the importance of positive/negative examples, it does not differentiate between easy/hard examples. What the authors are trying to explain is this: Even when we add ฮฑ, while it does add different weights to different classes, thereby balancing the importance of positive/negative examples - just doing this in most cases is not enough. What we also want to do is to reduce the loss of easily-classified examples because otherwise these easily-classified examples would dominate our training. So, how does Focal Loss deal with this? It adds a multiplicative factor to Cross Entropy loss and this multiplicative factor is (1 โ pt)**ฮณ where pt as you remember is the probability of the ground truth label. From the paper for Focal Loss: We propose to add a modulating factor (1 โ pt)**ฮณ to the cross entropy loss, with tunable focusing parameter ฮณ โฅ 0. Really? Is that all that the authors have done? That is to add (1 โ pt)**ฮณ to Cross Entropy Loss? Yes!! Remember eq-4? How to implement this in code? While TensorFlow provides this loss function here, this is not inherently supported by PyTorch so we have to write a custom loss function. Here is the implementation of Focal Loss in PyTorch: class WeightedFocalLoss(nn.Module): "Non weighted version of Focal Loss" def __init__(self, alpha=.25, gamma=2): super(WeightedFocalLoss, self).__init__() self.alpha = torch.tensor([alpha, 1-alpha]).cuda() self.gamma = gamma def forward(self, inputs, targets): BCE_loss = F.binary_cross_entropy_with_logits(inputs, targets, reduction='none') targets = targets.type(torch.long) at = self.alpha.gather(0, targets.data.view(-1)) pt = torch.exp(-BCE_loss) F_loss = at*(1-pt)**self.gamma * BCE_loss return F_loss.mean() If youโve understood the meaning of alpha and gamma then this implementation should also make sense. Because, similar to the paper it is simply adding a factor of at*(1-pt)**self.gamma to the BCE_loss or Binary Cross Entropy Loss. Credits Please feel free to let me know via twitter if you did end up trying Focal Loss after reading this and whether you did see an improvement in your results! Thanks for reading! The implementation of Focal Loss has been adapted from here. fig-1 and fig-2 are from the Fastai 2018 course Lecture-09!
Learn Artificial Neural Network From Scratch in Python
Welcome to the course where we will learn about Artificial Neural Network (ANN) From Scratch! If you're looking for a complete Course on Deep Learning using ANN that teaches you everything you need to create a Neural Network model in Python? You've found the right Neural Network course! Identify the business problem which can be solved using Neural network Models. Have a clear understanding of Advanced Neural network concepts such as Gradient Descent, forward and Backward Propagation etc.
2021 Data Science/MachineLearning Project Deployment Mastery
Then this course is for you!! This course has been practically and carefully designed by industry experts to offer the best way of learning Data Science and Machine Learning the practical way with hands-on projects and Deployment throughout the course. This course will help you learn complex Data Science concepts and machine learning algorithms the practical way for easier understanding. We will walk you through step-by-step on each topic explaining each line of code for your understanding. There is going to be a lot of fun, excited, and robust projects to better understand each concept under each topic.
ROS2 Robotics Developer Course - Using ROS2 In Python
Learn how to use the latest version of the Robot Operating System (ROS 2) in Python to program robots. Learn how to use the Robot Operating System (ROS) version 2 platform (ROS2) which is used to program real world robotics. The course is designed for beginners with little, to no experience using ROS2. The coding in this course is done in Python 3 using ROS2 Foxy. We will go over installation of ROS2, how to develop code that uses the framework, and even go over simulation tools so you can make your own robot and control it in simulation, with code that can easily be ported to a real robotic system.
Machine Learning for BI, PART 2: Classification Modeling
Demystify the world of Machine Learning and build core Data Science & predictive analytics skills, without writing code! Created by Maven Analytics, Joshua McCarty 2.5 hours on-demand video course If you're excited to explore data science & machine learning but anxious about learning complex programming languages or intimidated by terms like "naive bayes", "logistic regression", "KNN" and "decision trees", you're in the right place. This course makes data science approachable to everyday people, and is designed to demystify powerful machine learning tools & techniques without trying to teach you a coding language at the same time.
Feature Selection for Machine Learning
Welcome to Feature Selection for Machine Learning, the most comprehensive course on feature selection available online. In this course, you will learn how to select the variables in your data set and build simpler, faster, more reliable and more interpretable machine learning models. Who is this course for? You've given your first steps into data science, you know the most commonly used machine learning models, you probably built a few linear regression or decision tree based models. You are familiar with data pre-processing techniques like removing missing data, transforming variables, encoding categorical variables.
Hyperparameter Optimization for Machine Learning
Learn the approaches and tools to tune hyperparameters and improve the performance of your machine learning models. Created by Soledad Galli 7.5 hours on-demand video course Welcome to Hyperparameter Optimization for Machine Learning. In this course, you will learn multiple techniques to select the best hyperparameters and improve the performance of your machine learning models. If you are regularly training machine learning models as a hobby or for your organization and want to improve the performance of your models, if you are keen to jump up in the leader board of a data science competition, or you simply want to learn more about how to tune hyperparameters of machine learning models, this course will show you how. We'll take you step-by-step through engaging video tutorials and teach you everything you need to know about hyperparameter tuning.