- Exercises and tutorials (for beginners)
- All video courses and tutorials
- Code examples
- Additional useful tools
- Web sites to visit from time to time
- TensorFlow for Android
- TensorFlow CPUs and GPUs Configuration
Helpful for me and I hope will be helpful for you:
- Neural Networks by 3Blue1Brown — watch 4 videos
- fastai course, part1.
- TensorFlow free course — Highly recommend this course to ML newcomers, beginners, novices, rookies, etc.
- Neural Networks Demystified — intro into neural networks
- Top 10 Deep Learning tools for your inspiration. For more tools go to the section additional useful tools
- Neural Networks from Scratch. Literally from stratch, using Python and NumPy only. The course is not ready for now, but will be in 6-8 month.
- Machine Learning for Everyone (Машинное обучение для людей) and my brochure in Russian
- TensorFlow learn ML web-page with many useful learning resources (books, videos, examples, etc.).
- Get Started with TensorFlow — Webpage with many tutorials. Everyone should make at least 5 exercises for beginners and then continue with more advanced tutorials. with the source code.
- A Neural Network in 11 lines of Python (Part 1) — Simple neural network in 11 lines of Python code with detailed explanation and Russian translation is here.
- A Neural Network in 13 lines of Python (Part 2 - Gradient Descent) — Explanation of gradient descent with 13 lines of Python code.
- Create A Neural Network That Classifies Diabetes Risk In 15 Lines of Python — Neural network in 15 lines of Python code to diagnose diabetes. Russian translation here. Text explanations are here. CSV database file is here.
- Unsupervised Learning by Siraj Raval — Using signal processing and K-means clustering to extract and sort neural events in Python plus source code and dataset.
- Unet Segmentation in Keras — Easy explanation of the U-net in Keras with the source code.
- Deep Residual Unet Segmentation in Keras — Easy explanation of the ResUNet in Keras with the source code.
- Course Introduction to TensorFlow for AI, ML, and DL — Good introduction course into TensorFlow.
- Course Coding TensorFlow — You will look at various parts of TensorFlow from a coding perspective.
- Courses. Machine Learning Tokyo: CNN Workshop video blog and GitHub resource and CNN Architectures - implementations
All video courses and tutorials about Machine Learning I'm working on are placed here.
All code examples are placed here.
Additional useful tools everybody should know about:
-
Jupyter Notebook:
- Six easy ways to run your Jupyter Notebook in the cloud: Binder, Kaggle Kernels, Google Colaboratory (Colab), Microsoft Azure Notebooks, CoCalc, Datalore
- Google Colab — Colaboratory is a free Jupyter notebook environment that requires no setup and runs entirely in the cloud. With Colaboratory you can write and execute code, save and share your analyses, and access powerful computing resources, all for free from your browser.
- Kaggle Kernels — Free Jupyter notebook environment. If you tired to read documentation, just try to find and see some videos.
- K3D Jupyter — Jupyter notebook extension for 3D visualization with examples. Just start to view the examples and you'll like it :-)
- nbviewer — A simple way to share Jupyter Notebooks.
It is useful if your Jupyter Notebook
*.ipynb
won't load on Github. Enter the location of a Jupyter Notebook to have it rendered. - 10 Simple hacks to speed up your Data Analysis in Python
- Use Jupyter Notebook with RISE plug-in to make presentations right in the notebook.
- Juxtapose —
Easy-to-make frame comparisons. Useful for presentations.
Generate an embedable code snippet that you can use on any website or Jupyter notebook.
There must be an Internet connection to obtain URL.
Copy-paste code below into your Jupyter notebook and replace the
url
:
# Display the associated webpage in a new window
import IPython
url = 'https://cdn.knightlab.com/libs/juxtapose/latest/embed/index.html?uid=7e8015a0-4be7-11e9-8106-0edaf8f81e27'
iframe = '<iframe frameborder="0" class="juxtapose" width="100%" height="600" src="' + url + '"></iframe>'
IPython.display.HTML(iframe)
-
Downloading tools:
- Fatkun Batch Download Image add-on for Chrome browser — Fast and easy download of many images from Google Images. Menu "Ask where to save each file before downloading" must be turned off before downloading images.
- google_images_download is a Python Script for "searching" and "downloading" hundreds of Google images to the local hard disk
- For older versions of Firefox Google Images Downloader Firefox add-on by Rushikesh Tade
- How to scrape the web for images forum
-
Datasets Search:
-
Google Dataset Search is a search engine for datasets.
-
Kaggle datasets — search engine for 25 000 datasets on Kaggle.
-
Academic Torrents distributed system for sharing datasets.
-
Awesome Public Datasets list of a topic-centric public data sources.
-
Awesome Open Source find open source by browsing 7,000 topics across 59 categories.
-
NCBI Datasets. Find and download gene, transcript, protein and genome sequences, annotation and metadata.
-
-
Deep Learning add-on for Adaptive Vision Studio Lite — If you need out-of-the-box solutions, you could try Adaptive Vision tool with Deep Learning add-on. Unfortunately, Deep Learning add-on has only trial version for 30 days for educational purposes. Lite version is a limited-functionality freeware available for trial and non-commercial use. Recommended especially for students who want to learn how to develop complex algorithms with images loaded from files.
-
Annotation tools:
- Annotation tool labelImg.
This annotation tool supports both Windows and Linux, it will generate
xml
files inside image directories. Tip: use shortcuts (w
: draw box,d
: next file,a
: previous file, etc.) to accelerate the annotation. - My own annotation tools: Manual image annotation with polygons and Manual image annotation with rectangles can annotate and cut rectangular images.
- VGG Image Annotator is a simple and standalone manual annotation software for image, audio and video. VIA runs in a web browser and does not require any installation or setup. The complete VIA software fits in a single self-contained HTML page of size less than 400 Kilobyte that runs as an offline application in most modern web browsers.
- Computer Vision Annotation Tool (CVAT). CVAT is free, online, interactive video and image annotation tool for computer vision.
- https://supervise.ly The leading platform for entire computer vision lifecycle.
- Annotation tool labelImg.
This annotation tool supports both Windows and Linux, it will generate
-
Model Zoo:
- TensorFlow Hub is a library for the publication, discovery, and consumption of reusable parts of machine learning models. A module is a self-contained piece of a TensorFlow graph, along with its weights and assets, that can be reused across different tasks in a process known as transfer learning. If you think of a model like a binary, think of a module like a library (video).
- mmdetection is an open source object detection toolbox based on PyTorch. Plus model zoo.
- Detectron is Facebook AI Research's software system that implements state-of-the-art object detection algorithms. It is written in Python and powered by the Caffe2 deep learning framework.
- Model Zoo website curates and provides a platform for deep learning researchers to easily find pre-trained models for a variety of platforms and uses.
-
Data visualization:
- Tools to Design or Visualize Architecture of Neural Network
- diagrams.net is open source, online, desktop and container deployable diagramming software (link).
- Facets is an open source visualization tool for Machine Learning training data. It helps to understand the various features of data and explore them without having to explicitly code. Facets is released by Google under the PAIR (People + AI Research) initiative. Open example only in Chrome.
- GeoGebra is dynamic mathematics software for all levels of education that brings together geometry, algebra, spreadsheets, graphing, statistics and calculus in one easy-to-use package. Mandelbrot example.
- Hands-on TensorBoard (TensorFlow Dev Summit 2017) — Demonstration of TensorBoard tool with the source code.
- Streamlit is an open-source Python library that makes it easy to build beautiful apps for machine learning. I didn't use it yet.
-
OpenAI builds free software for training, benchmarking, and experimenting with AI. Reinforcement Learning (RL).
-
Resize multiple images with ratio
resize_with_ratio.py
script. -
Kite autocomplete plugin for Python IDE (PyCharm, Spyder, etc.).
Web sites for ML/DL:
- https://medium.com — Many articles in ML/DL. Very alike Хабр in Russian.
- https://distill.pub — Distillation of scientific publications.
- https://stackoverflow.com — and — all — its — siblings — are — vital for ML/DL search.
- https://realpython.com — web site with high-quality articles about Python.
- https://www.dlology.com — blog of Chengwei Zhang aka Tony607
- https://pythonprogramming.net — a bunch of tutorials about Machine Learning and more + video blog
- https://paperswithcode.com — Machine Learning papers, code and evaluation tables all in one web-site.
- https://sotabench.com — benchmarking every open source model
- https://madewithml.com — deliver value with applied ML
- https://ods.ai — Open Data Science community
- https://www.deeplearningweekly.com — Bringing you everything new and exciting in the world of deep learning from academia to the grubby depth of industry every week right to your inbox.
- https://www.pyimagesearch.com — Adrian Rosebrock's blog about Computer Vision, Deep Learning and OpenCV.
Video channels to explain scientific publications in ML/DL:
Newsletters:
For iOS review this blog of Matthijs Hollemans.
TensorFlow Lite guide — this is your starting point.
Video course Introduction to TensorFlow Lite.
TensorFlow Lite vs TensorFlow Mobile (link):
- Lite is the next version of Mobile. Generally, applications developed on Lite will have better performance and less binary file size than Mobile.
- Lite is still in early stages so not all the cases cover which is not the case for Mobile.
- Lite supports selective sets of operators, therefore not all the models will work on Lite by default. Whereas, Mobile has fully covered functionality.
I'm not familiar with Android development. So start with Android quickstart and Android image classification example:
- Download and install Android Studio.
- Set device in developer mode with USB debugging enabled. Enable developer mode and USB debugging on Xiaomi Redmi or Samsung Galaxy Tab. Google it to set developer and debugging on other phone models.
- Take USB cable (to connect Android device to your computer).
Configuration steps for MIUI 9 and above: Settings → Additional Settings → Developer options →
- Turn off
Turn on MIUI optimization
at the very bottom ofDeveloper options
and Restart the phone. - Turn On
USB Debugging
. - Turn On
Install via USB
. - Set USB Configuration to Charging. MTP(Media Transfer Protocol) is the default mode. Works even in MTP in some cases.
After finishing previous example run object detection example using a quantized MobileNet SSD model trained on the COCO dataset.
Result for image classification demo is decent (2019.09.13). I don't know which dataset they used, but the quality of classification is decent.
Result for object detection is poor (2019.09.13, COCO dataset). It is not for production.
For further Android development examples and TensorFlow Lite, visit this repository.
Links to read:
- TensorFlow CPUs and GPUs Configuration
- Using GPUs
- How to prevent tensorflow from allocating the totality of a GPU memory
- How can I flush GPU memory using CUDA (physical reset is unavailable)
By default TensorFlow occupies all GPUs on the platform. Also you should exit Python (ipython, jupyter) console to free GPU resources.
# Calculate on the 2nd GPU
import os
os.environ["CUDA_DEVICE_ORDER"] = "PCI_BUS_ID" # so the IDs match nvidia-smi
os.environ["CUDA_VISIBLE_DEVICES"] = "1" # "0,1" for multiple GPU or "-1" for CPU
# Note: it seems option "0,1" does not work for different GPU models.
# For Jupyter Notebook one has to restart the kernel
# after changing of environment variables.
# Monitor GPU permanently. To exit, press <Ctrl>+<C> keys.
watch -n 0.5 nvidia-smi
# Monitor CPU permanently. To exit, press <Q> key.
htop
By default TensorFlow occupies all memory on GPU. Limiting GPU memory growth.
You can dynamically reserve only necessary, but not all available memory:
# Reserve necessary GPU memory
import tensorflow as tf
# For TensorFlow 2.x
gpus = tf.config.list_physical_devices('GPU')
if gpus:
try:
# Currently, memory growth needs to be the same across GPUs
for gpu in gpus:
tf.config.experimental.set_memory_growth(gpu, True)
logical_gpus = tf.config.list_logical_devices('GPU')
print(len(gpus), "Physical GPUs,", len(logical_gpus), "Logical GPUs")
except RuntimeError as e:
# Memory growth must be set before GPUs have been initialized
print(e)
You can set the fraction of GPU memory to be allocated when you construct a tf.Session
by passing a tf.GPUOptions
as part of the optional config argument:
# Reserve GPU memory fraction
import tensorflow as tf
# For TensorFlow 2.x
gpus = tf.config.list_physical_devices('GPU')
if gpus:
# Restrict TensorFlow to only allocate 1GB of memory on the first GPU
try:
tf.config.set_logical_device_configuration(
gpus[0],
[tf.config.LogicalDeviceConfiguration(memory_limit=1024)])
logical_gpus = tf.config.list_logical_devices('GPU')
print(len(gpus), "Physical GPUs,", len(logical_gpus), "Logical GPUs")
except RuntimeError as e:
# Virtual devices must be set before GPUs have been initialized
print(e)
The per_process_gpu_memory_fraction
acts as a hard upper bound on the amount of GPU memory
that will be used by the process on each GPU on the same machine.
Currently, this fraction is applied uniformly to all of the GPUs on the same machine
import os
import tensorflow as tf
# 0 - all messages are logged (default behavior)
# 1 - INFO messages are not printed
# 2 - INFO and WARNING messages are not printed
# 3 - INFO, WARNING, and ERROR messages are not printed
os.environ['TF_CPP_MIN_LOG_LEVEL'] = '2' # show errors
After calculations everyone should clean up resources and exit from Python, iPython and Jupyter. Place this code at the end of your program:
# Clean up resources. Place this code at the end of the program.
import os, signal
os.kill(os.getpid(), signal.SIGTERM) # you can use signal.SIGKILL for Linux, but not for Windows
Root can forcibly clean up resources:
# Shows PIDs of processes
# using the specified files or file systems
sudo fuser -v /dev/nvidia*
USER PID ACCESS COMMAND
/dev/nvidia0: root 4051 F...m Xorg
username1 8138 F...m python
username2 11791 F.... python3
username3 14282 F...m python3
username3 14295 F...m python3
/dev/nvidia1: root 4051 F...m Xorg
username1 8138 F...m python
username2 11791 F...m python3
/dev/nvidiactl: root 4051 F...m Xorg
username1 8138 F...m python
username2 11791 F...m python3
username3 14282 F...m python3
username3 14295 F...m python3
/dev/nvidia-modeset: root 4051 F.... Xorg
/dev/nvidia-uvm: username1 8138 F...m python
username2 11791 F.... python3
username3 14282 F...m python3
username3 14295 F...m python3
# Finish 2 processes for nvidia0
sudo kill -9 14282
sudo kill -9 14295
sudo fuser -v /dev/nvidia*
nvidia-smi # show nvidia system management interface