Home

Awesome

Zero to Mastery Deep Learning with TensorFlow

All of the course materials for the Zero to Mastery Deep Learning with TensorFlow course.

This course will teach you the foundations of deep learning and how to build and train neural networks for various problem types with TensorFlow/Keras.

Important links

Contents of this page

Fixes and updates

Course materials

This table is the ground truth for course materials. All the links you need for everything will be here.

Key:

Note: You can get all of the notebook code created during the videos in the video_notebooks directory.

NumberNotebookData/ModelExercises & Extra-curriculumSlides
00TensorFlow FundamentalsGo to exercises & extra-curriculumGo to slides
01TensorFlow RegressionGo to exercises & extra-curriculumGo to slides
02TensorFlow ClassificationGo to exercises & extra-curriculumGo to slides
03TensorFlow Computer Visionpizza_steak, 10_food_classes_all_dataGo to exercises & extra-curriculumGo to slides
04Transfer Learning Part 1: Feature extraction10_food_classes_10_percentGo to exercises & extra-curriculumGo to slides
05Transfer Learning Part 2: Fine-tuning10_food_classes_10_percent, 10_food_classes_1_percent, 10_food_classes_all_dataGo to exercises & extra-curriculumGo to slides
06Transfer Learning Part 3: Scaling up101_food_classes_10_percent, custom_food_images, fine_tuned_efficientnet_modelGo to exercises & extra-curriculumGo to slides
07Milestone Project 1: Food Vision πŸ”πŸ‘, Template (your challenge)feature_extraction_mixed_precision_efficientnet_model, fine_tuned_mixed_precision_efficientnet_modelGo to exercises & extra-curriculumGo to slides
08TensorFlow NLP Fundamentalsdiaster_or_no_diaster_tweets, USE_feature_extractor_modelGo to exercises & extra-curriculumGo to slides
09Milestone Project 2: SkimLit πŸ“„πŸ”₯pubmed_RCT_200k_dataset, skimlit_tribrid_modelGo to exercises & extra-curriculumGo to slides
10TensorFlow Time Series Fundamentals & Milestone Project 3: BitPredict πŸ’°πŸ“ˆbitcoin_price_data_USD_2013-10-01_2021-05-18.csvGo to exercises & extra-curriculumGo to slides
11Preparing to Pass the TensorFlow Developer Certification Exam (archive)Go to exercises & extra-curriculumGo to slides

Course structure

This course is code first. The goal is to get you writing deep learning code as soon as possible.

It is taught with the following mantra:

Code -> Concept -> Code -> Concept -> Code -> Concept

This means we write code first then step through the concepts behind it.

If you've got 6-months experience writing Python code and a willingness to learn (most important), you'll be able to do the course.

Should you do this course?

Do you have 1+ years experience with deep learning and writing TensorFlow code?

If yes, no you shouldn't, use your skills to build something.

If no, move onto the next question.

Have you done at least one beginner machine learning course and would like to learn about deep learning/how to build neural networks with TensorFlow?

If yes, this course is for you.

If no, go and do a beginner machine learning course and if you decide you want to learn TensorFlow, this page will still be here.

Prerequisites

What do I need to know to go through this course?

πŸ›  Exercises & πŸ“– Extra-curriculum

To prevent the course from being 100+ hours (deep learning is a broad field), various external resources for different sections are recommended to puruse under your own discretion.

You can find solutions to the exercises in extras/solutions/, there's a notebook per set of exercises (one for 00, 01, 02... etc). Thank you to Ashik Shafi for all of the efforts creating these.


πŸ›  00. TensorFlow Fundamentals Exercises

  1. Create a vector, scalar, matrix and tensor with values of your choosing using tf.constant().
  2. Find the shape, rank and size of the tensors you created in 1.
  3. Create two tensors containing random values between 0 and 1 with shape [5, 300].
  4. Multiply the two tensors you created in 3 using matrix multiplication.
  5. Multiply the two tensors you created in 3 using dot product.
  6. Create a tensor with random values between 0 and 1 with shape [224, 224, 3].
  7. Find the min and max values of the tensor you created in 6 along the first axis.
  8. Created a tensor with random values of shape [1, 224, 224, 3] then squeeze it to change the shape to [224, 224, 3].
  9. Create a tensor with shape [10] using your own choice of values, then find the index which has the maximum value.
  10. One-hot encode the tensor you created in 9.

πŸ“– 00. TensorFlow Fundamentals Extra-curriculum


πŸ›  01. Neural network regression with TensorFlow Exercises

  1. Create your own regression dataset (or make the one we created in "Create data to view and fit" bigger) and build fit a model to it.
  2. Try building a neural network with 4 Dense layers and fitting it to your own regression dataset, how does it perform?
  3. Try and improve the results we got on the insurance dataset, some things you might want to try include:
  1. Import the Boston pricing dataset from TensorFlow tf.keras.datasets and model it.

πŸ“– 01. Neural network regression with TensorFlow Extra-curriculum


πŸ›  02. Neural network classification with TensorFlow Exercises

  1. Play with neural networks in the TensorFlow Playground for 10-minutes. Especially try different values of the learning, what happens when you decrease it? What happens when you increase it?
  2. Replicate the model pictured in the TensorFlow Playground diagram below using TensorFlow code. Compile it using the Adam optimizer, binary crossentropy loss and accuracy metric. Once it's compiled check a summary of the model. tensorflow playground example neural network Try this network out for yourself on the TensorFlow Playground website. Hint: there are 5 hidden layers but the output layer isn't pictured, you'll have to decide what the output layer should be based on the input data.
  3. Create a classification dataset using Scikit-Learn's make_moons() function, visualize it and then build a model to fit it at over 85% accuracy.
  4. Train a model to get 88%+ accuracy on the fashion MNIST test set. Plot a confusion matrix to see the results after.
  5. Recreate TensorFlow's softmax activation function in your own code. Make sure it can accept a tensor and return that tensor after having the softmax function applied to it.
  6. Create a function (or write code) to visualize multiple image predictions for the fashion MNIST at the same time. Plot at least three different images and their prediction labels at the same time. Hint: see the classification tutorial in the TensorFlow documentation for ideas.
  7. Make a function to show an image of a certain class of the fashion MNIST dataset and make a prediction on it. For example, plot 3 images of the T-shirt class with their predictions.

πŸ“– 02. Neural network classification with TensorFlow Extra-curriculum


πŸ›  03. Computer vision & convolutional neural networks in TensorFlow Exercises

  1. Spend 20-minutes reading and interacting with the CNN explainer website.
  1. Play around with the "understanding hyperparameters" section in the CNN explainer website for 10-minutes.
  1. Take 10 photos of two different things and build your own CNN image classifier using the techniques we've built here.
  2. Find an ideal learning rate for a simple convolutional neural network model on your the 10 class dataset.

πŸ“– 03. Computer vision & convolutional neural networks in TensorFlow Extra-curriculum


πŸ›  04. Transfer Learning in TensorFlow Part 1: Feature Extraction Exercises

  1. Build and fit a model using the same data we have here but with the MobileNetV2 architecture feature extraction (mobilenet_v2_100_224/feature_vector) from TensorFlow Hub, how does it perform compared to our other models?
  2. Name 3 different image classification models on TensorFlow Hub that we haven't used.
  3. Build a model to classify images of two different things you've taken photos of.
  1. What is the current best performing model on ImageNet?

πŸ“– 04. Transfer Learning in TensorFlow Part 1: Feature Extraction Extra-curriculum


πŸ›  05. Transfer Learning in TensorFlow Part 2: Fine-tuning Exercises

  1. Use feature-extraction to train a transfer learning model on 10% of the Food Vision data for 10 epochs using tf.keras.applications.EfficientNetB0 as the base model. Use the ModelCheckpoint callback to save the weights to file.
  2. Fine-tune the last 20 layers of the base model you trained in 2 for another 10 epochs. How did it go?
  3. Fine-tune the last 30 layers of the base model you trained in 2 for another 10 epochs. How did it go?
  4. Write a function to visualize an image from any dataset (train or test file) and any class (e.g. "steak", "pizza"... etc), visualize it and make a prediction on it using a trained model.

πŸ“– 05. Transfer Learning in TensorFlow Part 2: Fine-tuning Extra-curriculum


πŸ›  06. Transfer Learning in TensorFlow Part 3: Scaling-up Exercises

  1. Take 3 of your own photos of food and use the trained model to make predictions on them, share your predictions with the other students in Discord and show off your Food Vision model πŸ”πŸ‘.
  2. Train a feature-extraction transfer learning model for 10 epochs on the same data and compare its performance versus a model which used feature extraction for 5 epochs and fine-tuning for 5 epochs (like we've used in this notebook). Which method is better?
  3. Recreate the first model (the feature extraction model) with mixed_precision turned on.

πŸ“– 06. Transfer Learning in TensorFlow Part 3: Scaling-up Extra-curriculum


πŸ›  07. Milestone Project 1: πŸ”πŸ‘ Food Vision Bigβ„’ Exercises

Note: The chief exercise for Milestone Project 1 is to finish the "TODO" sections in the Milestone Project 1 Template notebook. After doing so, move onto the following.

  1. Use the same evaluation techniques on the large-scale Food Vision model as you did in the previous notebook (Transfer Learning Part 3: Scaling up). More specifically, it would be good to see:
  1. Take 3 of your own photos of food and use the Food Vision model to make predictions on them. How does it go? Share your images/predictions with the other students.
  2. Retrain the model (feature extraction and fine-tuning) we trained in this notebook, except this time use EfficientNetB4 as the base model instead of EfficientNetB0. Do you notice an improvement in performance? Does it take longer to train? Are there any tradeoffs to consider?
  3. Name one important benefit of mixed precision training, how does this benefit take place?

πŸ“– 07. Milestone Project 1: πŸ”πŸ‘ Food Vision Bigβ„’ Extra-curriculum


πŸ›  08. Introduction to NLP (Natural Language Processing) in TensorFlow Exercises

  1. Rebuild, compile and train model_1, model_2 and model_5 using the Keras Sequential API instead of the Functional API.
  2. Retrain the baseline model with 10% of the training data. How does perform compared to the Universal Sentence Encoder model with 10% of the training data?
  3. Try fine-tuning the TF Hub Universal Sentence Encoder model by setting training=True when instantiating it as a Keras layer.
# We can use this encoding layer in place of our text_vectorizer and embedding layer
sentence_encoder_layer = hub.KerasLayer("https://tfhub.dev/google/universal-sentence-encoder/4",
                                        input_shape=[],
                                        dtype=tf.string,
                                        trainable=True) # turn training on to fine-tune the TensorFlow Hub model
  1. Retrain the best model you've got so far on the whole training set (no validation split). Then use this trained model to make predictions on the test dataset and format the predictions into the same format as the sample_submission.csv file from Kaggle (see the Files tab in Colab for what the sample_submission.csv file looks like). Once you've done this, make a submission to the Kaggle competition, how did your model perform?
  2. Combine the ensemble predictions using the majority vote (mode), how does this perform compare to averaging the prediction probabilities of each model?
  3. Make a confusion matrix with the best performing model's predictions on the validation set and the validation ground truth labels.

πŸ“– 08. Introduction to NLP (Natural Language Processing) in TensorFlow Extra-curriculum

To practice what you've learned, a good idea would be to spend an hour on 3 of the following (3-hours total, you could through them all if you want) and then write a blog post about what you've learned.


πŸ›  09. Milestone Project 2: SkimLit πŸ“„πŸ”₯ Exercises

  1. Train model_5 on all of the data in the training dataset for as many epochs until it stops improving. Since this might take a while, you might want to use:
  1. Checkout the Keras guide on using pretrained GloVe embeddings. Can you get this working with one of our models?
  1. Try replacing the TensorFlow Hub Universal Sentence Encoder pretrained embedding for the TensorFlow Hub BERT PubMed expert (a language model pretrained on PubMed texts) pretrained embedding. Does this effect results?
  1. What happens if you were to merge our line_number and total_lines features for each sequence? For example, created a X_of_Y feature instead? Does this effect model performance?
  1. Write a function (or series of functions) to take a sample abstract string, preprocess it (in the same way our model has been trained), make a prediction on each sequence in the abstract and return the abstract in the format:

πŸ“– 09. Milestone Project 2: SkimLit πŸ“„πŸ”₯ Extra-curriculum


πŸ›  10. Time series fundamentals and Milestone Project 3: BitPredict πŸ’°πŸ“ˆ Exercises

  1. Does scaling the data help for univariate/multivariate data? (e.g. getting all of the values between 0 & 1)
  1. Get the most up to date data on Bitcoin, train a model & see how it goes (our data goes up to May 18 2021).
  1. For most of our models we used WINDOW_SIZE=7, but is there a better window size?
  1. Create a windowed dataset just like the ones we used for model_1 using tf.keras.preprocessing.timeseries_dataset_from_array() and retrain model_1 using the recreated dataset.
  2. For our multivariate modelling experiment, we added the Bitcoin block reward size as an extra feature to make our time series multivariate.
  1. Make prediction intervals for future forecasts. To do so, one way would be to train an ensemble model on all of the data, make future forecasts with it and calculate the prediction intervals of the ensemble just like we did for model_8.
  2. For future predictions, try to make a prediction, retrain a model on the predictions, make a prediction, retrain a model, make a prediction, retrain a model, make a prediction (retrain a model each time a new prediction is made). Plot the results, how do they look compared to the future predictions where a model wasn't retrained for every forecast (model_9)?
  3. Throughout this notebook, we've only tried algorithms we've handcrafted ourselves. But it's worth seeing how a purpose built forecasting algorithm goes.

πŸ“– 10. Time series fundamentals and Milestone Project 3: BitPredict πŸ’°πŸ“ˆ Extra-curriculum

We've only really scratched the surface with time series forecasting and time series modelling in general. But the good news is, you've got plenty of hands-on coding experience with it already.

If you'd like to dig deeper in to the world of time series, I'd recommend the following:


TensorFlow Developer Certificate (archive)

Note: As of 1 May 2024, the TensorFlow Developer Certification is no longer available for purchase. After being in contact with the TensorFlow Certification team, they stated they were closing the program with no official next steps (see #645 for more).

With this in mind, the exercises/extra-curriculum below are for archive purposes only. The rest of the course materials are still valid.

πŸ›  11. Passing the TensorFlow Developer Certification Exercises (archive)

Preparing your brain

  1. Read through the TensorFlow Developer Certificate Candidate Handbook.
  2. Go through the Skills checklist section of the TensorFlow Developer Certification Candidate Handbook and create a notebook which covers all of the skills required, write code for each of these (this notebook can be used as a point of reference during the exam).

mapping the TensorFlow Developer handbook to code in a notebook Example of mapping the Skills checklist section of the TensorFlow Developer Certification Candidate handbook to a notebook.

Prearing your computer

  1. Go through the PyCharm quick start tutorials to make sure you're familiar with PyCharm (the exam uses PyCharm, you can download the free version).
  2. Read through and follow the suggested steps in the setting up for the TensorFlow Developer Certificate Exam guide.
  3. After going through (2), go into PyCharm and make sure you can train a model in TensorFlow. The model and dataset in the example image_classification_test.py script on GitHub should be enough. If you can train and save the model in under 5-10 minutes, your computer will be powerful enough to train the models in the exam.
    • Make sure you've got experience running models locally in PyCharm before taking the exam. Google Colab (what we used through the course) is a little different to PyCharm.

before taking the TensorFlow Developer certification exam, make sure you can run TensorFlow code in PyCharm on your local machine Before taking the exam make sure you can run TensorFlow code on your local machine in PyCharm. If the example image_class_test.py script can run completely in under 5-10 minutes on your local machine, your local machine can handle the exam (if not, you can use Google Colab to train, save and download models to submit for the exam).

πŸ“– 11. Passing the TensorFlow Developer Certification Extra-curriculum (archive)

If you'd like some extra materials to go through to further your skills with TensorFlow and deep learning in general or to prepare more for the exam, I'd highly recommend the following:


What this course is missing

Deep learning is a broad topic. So this course doesn't cover it all.

Here are some of the main topics you might want to look into next:

Extensions (possible places to go after the course)

Ask questions

Contact Daniel Bourke or add a discussion (preferred).

Log