TensorFlow 101: Introduction to Deep Learning for Python Within TensorFlow

Overview

TensorFlow 101: Introduction to Deep Learning

Stars License

I have worked all my life in Machine Learning, and I've never seen one algorithm knock over its benchmarks like Deep Learning - Andrew Ng

This repository includes deep learning based project implementations I've done from scratch. You can find both the source code and documentation as a step by step tutorial. Model structrues and pre-trained weights are shared as well.

Facial Expression Recognition Code, Tutorial

This is a custom CNN model. Kaggle FER 2013 data set is fed to the model. This model runs fast and produces satisfactory results. It can be also run real time as well.

We can run emotion analysis in real time as well Real Time Code, Video

Face Recognition Code, Tutorial

Face recognition is mainly based on convolutional neural networks. We feed two face images to a CNN model and it returns a multi-dimensional vector representations. We then compare these representations to determine these two face images are same person or not.

You can find the most popular face recognition models below.

Model Creator LFW Score Code Tutorial
VGG-Face The University of Oxford 98.78 Code Tutorial
FaceNet Google 99.65 Code Tutorial
DeepFace Facebook - Code Tutorial
OpenFace Carnegie Mellon University 93.80 Code Tutorial
DeepID The Chinese University of Hong Kong - Code Tutorial
Dlib Davis E. King 99.38 Code Tutorial
OpenCV OpenCV Foundation - Code Tutorial
OpenFace in OpenCV Carnegie Mellon University 92.92 Code Tutorial
SphereFace Georgia Institute of Technology 99.30 Code Tutorial
ArcFace Imperial College London 99.40 Code Tutorial

All of those state-of-the-art face recognition models are wrapped in deepface library for python. You can build and run them with a few lines of code. To have more information, please visit the repo of the library.

Real Time Deep Face Recognition Implementation Code, Video

These are the real time implementations of the common face recognition models we've mentioned in the previous section. VGG-Face has the highest face recognition score but it comes with the high complexity among models. On the other hand, OpenFace is a pretty model and it has a close accuracy to VGG-Face but its simplicity offers high speed than others.

Model Creator Code Demo
VGG-Face Oxford University Code Video
FaceNet Google Code Video
DeepFace Facebook Code Video
OpenFace Carnegie Mellon University Code Video

Large Scale Face Recognition

Face recognition requires to apply face verification several times. It has a O(n) time complexity and it would be problematic for very large scale data sets (millions or billions level data). Herein, if you have a really strong database, then you use relational databases and regular SQL. Besides, you can store facial embeddings in nosql databases. In this way, you can have the power of the map reduce technology. Besides, approximate nearest neighbor (a-nn) algorithm reduces time complexity dramatically. Spotify Annoy, Facebook Faiss and NMSLIB are amazing a-nn libraries. Besides, Elasticsearch wraps NMSLIB and it also offers highly scalablity. You should build and run face recognition models within those a-nn libraries if you have really large scale data sets.

Library Algorithm Tutorial Code Demo
Spotify Annoy a-nn Tutorial - Video
Facebook Faiss a-nn Tutorial - -
NMSLIB a-nn Tutorial Code -
Elasticsearch a-nn Tutorial Code Video
mongoDB k-NN Tutorial Code -
Cassandra k-NN Tutorial Code Video
Redis k-NN Tutorial Code Video
Hadoop k-NN Tutorial Code -
Relational Database k-NN Tutorial Code -
Neo4j Graph k-NN Tutorial Code Video

Apparent Age and Gender Prediction Tutorial, Code for age, Code for gender

We've used VGG-Face model for apparent age prediction this time. We actually applied transfer learning. Locking the early layers' weights enables to have outcomes fast.

We can run age and gender prediction in real time as well Real Time Code, Video

Celebrity You Look-Alike Face Recognition Code, Tutorial

Applying VGG-Face recognition technology for imdb data set will find your celebrity look-alike if you discard the threshold in similarity score.

This can be run in real time as well Real Time Code, Video

Race and Ethnicity Prediction Tutorial, Code, Real Time Code, Video

Ethnicity is a facial attribute as well and we can predict it from facial photos. We customize VGG-Face and we also applied transfer learning to classify 6 different ethnicity groups.

Beauty Score Prediction Tutorial, Code

South China University of Technology published a research paper about facial beauty prediction. They also open-sourced the data set. 60 labelers scored the beauty of 5500 people. We will build a regressor to find facial beauty score. We will also test the built regressor on a huge imdb data set to find the most beautiful ones.

Attractiveness Score Prediction Tutorial, Code

The University of Chicago open-sourced the Chicago Face Database. The database consists of 1200 facial photos of 600 people. Facial photos are also labeled with attractiveness and babyface scores by hundreds of volunteer markers. So, we've built a machine learning model to generalize attractiveness score based on a facial photo.

Making Arts with Deep Learning: Artistic Style Transfer Code, Tutorial, Video

What if Vincent van Gogh had painted Istanbul Bosporus? Today we can answer this question. A deep learning technique named artistic style transfer enables to transform ordinary images to masterpieces.

Autoencoder and clustering Code, Tutorial

We can use neural networks to represent data. If you design a neural networks model symmetric about the centroid and you can restore a base data with an acceptable loss, then output of the centroid layer can represent the base data. Representations can contribute any field of deep learning such as face recognition, style transfer or just clustering.

Convolutional Autoencoder and clustering Code, Tutorial

We can adapt same representation approach to convolutional neural networks, too.

Transfer Learning: Consuming InceptionV3 to Classify Cat and Dog Images in Keras Code, Tutorial

We can have the outcomes of the other researchers effortlessly. Google researchers compete on Kaggle Imagenet competition. They got 97% accuracy. We will adapt Google's Inception V3 model to classify objects.

Handwritten Digit Classification Using Neural Networks Code, Tutorial

We had to apply feature extraction on data sets to use neural networks. Deep learning enables to skip this step. We just feed the data, and deep neural networks can extract features on the data set. Here, we will feed handwritten digit data (MNIST) to deep neural networks, and expect to learn digits.

Handwritten Digit Recognition Using Convolutional Neural Networks with Keras Code, Tutorial

Convolutional neural networks are close to human brain. People look for some patterns in classifying objects. For example, mouth, nose and ear shape of a cat is enough to classify a cat. We don't look at all pixels, just focus on some area. Herein, CNN applies some filters to detect these kind of shapes. They perform better than conventional neural networks. Herein, we got almost 2% accuracy than fully connected neural networks.

Automated Machine Learning and Auto-Keras for Image Data Code, Model, Tutorial

AutoML concept aims to find the best network structure and hyper-parameters. Here, I've applied AutoML to facial expression recognition data set. My custom design got 57% accuracy whereas AutoML found a better model and got 66% accuracy. This means almost 10% improvement in the accuracy.

Explaining Deep Learning Models with SHAP Code, Tutorial

SHAP explains black box machine learning models and makes them transparent, explainable and provable.

Gradient Vanishing Problem Code Tutorial

Why legacy activation functions such as sigmoid and tanh disappear on the pages of the history?

How single layer perceptron works Code

This is the 1957 model implementation of the perceptron.

Face Alignment for Face Recognition Code, Tutorial

Google declared that face alignment increase its face recognition model accuracy from 98.87% to 99.63%. This is almost 1% accuracy improvement which means a lot for engineering studies.

Requirements

I have tested this repository on the following environments. To avoid environmental issues, confirm your environment is same as below.

>> import tensorflow as tf >>> print(tf.__version__) 1.9.0 >>> >>> import keras Using TensorFlow backend. >>> print(keras.__version__) 2.2.0 >>> >>> import cv2 >>> print(cv2.__version__) 3.4.4">
C:\>python --version
Python 3.6.4 :: Anaconda, Inc.

C:\>activate tensorflow

(tensorflow) C:\>python
Python 3.5.5 |Anaconda, Inc.| (default, Apr  7 2018, 04:52:34) [MSC v.1900 64 bit (AMD64)] on win32
Type "help", "copyright", "credits" or "license" for more information.
>>> import tensorflow as tf
>>> print(tf.__version__)
1.9.0
>>>
>>> import keras
Using TensorFlow backend.
>>> print(keras.__version__)
2.2.0
>>>
>>> import cv2
>>> print(cv2.__version__)
3.4.4

To get your environment up from zero, you can follow the instructions in the following videos.

Installing TensorFlow and Prerequisites Video

Installing Keras Video

Disclaimer

This repo might use some external sources. Notice that related tutorial links and comments in the code blocks cite references already.

Support

There are many ways to support a project - starring ⭐️ the GitHub repos is one.

Citation

Please cite tensorflow-101 in your publications if it helps your research. Here is an example BibTeX entry:

@misc{serengil2021tensorflow,
  abstract     = {TensorFlow 101: Introduction to Deep Learning for Python Within TensorFlow},
  author       = {Serengil, Sefik Ilkin},
  title        = {tensorflow-101},
  howpublished = {https://github.com/serengil/tensorflow-101},
  year         = {2021}
}

Licence

This repository is licensed under MIT license - see LICENSE for more details

Owner
Sefik Ilkin Serengil
👨‍💻Software Engineer 🎓GSU alumni ⌨️Blogger 🏠Istanbulite 💬Code wins arguments
Sefik Ilkin Serengil
This thesis is mainly concerned with state-space methods for a class of deep Gaussian process (DGP) regression problems

Doctoral dissertation of Zheng Zhao This thesis is mainly concerned with state-space methods for a class of deep Gaussian process (DGP) regression pro

Zheng Zhao 21 Nov 14, 2022
Voxel Set Transformer: A Set-to-Set Approach to 3D Object Detection from Point Clouds (CVPR 2022)

Voxel Set Transformer: A Set-to-Set Approach to 3D Object Detection from Point Clouds (CVPR2022)[paper] Authors: Chenhang He, Ruihuang Li, Shuai Li, L

Billy HE 141 Dec 30, 2022
A simple library that implements CLIP guided loss in PyTorch.

pytorch_clip_guided_loss: Pytorch implementation of the CLIP guided loss for Text-To-Image, Image-To-Image, or Image-To-Text generation. A simple libr

Sergei Belousov 74 Dec 26, 2022
Code for the paper "Generative design of breakwaters usign deep convolutional neural network as a surrogate model"

Generative design of breakwaters usign deep convolutional neural network as a surrogate model This repository contains the code for the paper "Generat

2 Apr 10, 2022
Contrastive Learning with Non-Semantic Negatives

Contrastive Learning with Non-Semantic Negatives This repository is the official implementation of Robust Contrastive Learning Using Negative Samples

39 Jul 31, 2022
[KDD 2021, Research Track] DiffMG: Differentiable Meta Graph Search for Heterogeneous Graph Neural Networks

DiffMG This repository contains the code for our KDD 2021 Research Track paper: DiffMG: Differentiable Meta Graph Search for Heterogeneous Graph Neura

AutoML Research 24 Nov 29, 2022
Code for KDD'20 "An Efficient Neighborhood-based Interaction Model for Recommendation on Heterogeneous Graph"

Heterogeneous INteract and aggreGatE (GraphHINGE) This is a pytorch implementation of GraphHINGE model. This is the experiment code in the following w

Jinjiarui 69 Nov 24, 2022
Official Pytorch implementation of Online Continual Learning on Class Incremental Blurry Task Configuration with Anytime Inference (ICLR 2022)

The Official Implementation of CLIB (Continual Learning for i-Blurry) Online Continual Learning on Class Incremental Blurry Task Configuration with An

NAVER AI 34 Oct 26, 2022
HCQ: Hybrid Contrastive Quantization for Efficient Cross-View Video Retrieval

HCQ: Hybrid Contrastive Quantization for Efficient Cross-View Video Retrieval [toc] 1. Introduction This repository provides the code for our paper at

13 Dec 08, 2022
Facial Action Unit Intensity Estimation via Semantic Correspondence Learning with Dynamic Graph Convolution

FAU Implementation of the paper: Facial Action Unit Intensity Estimation via Semantic Correspondence Learning with Dynamic Graph Convolution. Yingruo

Evelyn 78 Nov 29, 2022
Code for Neurips2021 Paper "Topology-Imbalance Learning for Semi-Supervised Node Classification".

Topology-Imbalance Learning for Semi-Supervised Node Classification Introduction Code for NeurIPS 2021 paper "Topology-Imbalance Learning for Semi-Sup

Victor Chen 40 Nov 23, 2022
A colab notebook for training Stylegan2-ada on colab, transfer learning onto your own dataset.

Stylegan2-Ada-Google-Colab-Starter-Notebook A no thrills colab notebook for training Stylegan2-ada on colab. transfer learning onto your own dataset h

Harnick Khera 66 Dec 16, 2022
A visualisation tool for Deep Reinforcement Learning

DRLVIS - Visualising Deep Reinforcement Learning Created by Marios Sirtmatsis with the support of Alex Bäuerle. DRLVis is an application used for visu

Marios Sirtmatsis 1 Nov 04, 2021
A simple API wrapper for Discord interactions.

Your ultimate Discord interactions library for discord.py. About | Installation | Examples | Discord | PyPI About What is discord-py-interactions? dis

james 641 Jan 03, 2023
MSG-Transformer: Exchanging Local Spatial Information by Manipulating Messenger Tokens

MSG-Transformer Official implementation of the paper MSG-Transformer: Exchanging Local Spatial Information by Manipulating Messenger Tokens, by Jiemin

Hust Visual Learning Team 68 Nov 16, 2022
Planar Prior Assisted PatchMatch Multi-View Stereo

ACMP [News] The code for ACMH is released!!! [News] The code for ACMM is released!!! About This repository contains the code for the paper Planar Prio

Qingshan Xu 127 Dec 31, 2022
Speech Enhancement Generative Adversarial Network Based on Asymmetric AutoEncoder

ASEGAN: Speech Enhancement Generative Adversarial Network Based on Asymmetric AutoEncoder 中文版简介 Readme with English Version 介绍 基于SEGAN模型的改进版本,使用自主设计的非

Nitin 53 Nov 17, 2022
E2EDNA2 - An automated pipeline for simulation of DNA aptamers complexed with small molecules and short peptides

E2EDNA2 - An automated pipeline for simulation of DNA aptamers complexed with small molecules and short peptides

11 Nov 08, 2022
TensorFlow implementation of "Learning from Simulated and Unsupervised Images through Adversarial Training"

Simulated+Unsupervised (S+U) Learning in TensorFlow TensorFlow implementation of Learning from Simulated and Unsupervised Images through Adversarial T

Taehoon Kim 569 Dec 29, 2022
Like Dirt-Samples, but cleaned up

Clean-Samples Like Dirt-Samples, but cleaned up, with clear provenance and license info (generally a permissive creative commons licence but check the

TidalCycles 39 Nov 30, 2022