Boost Productivity with Keras Ecosystem

Rate this content
Bookmark

TensorFlow has built a solid foundation for various machine learning applications, on top of which the Keras ecosystem can really boost the productivity of the developers in building machine learning solutions. Keras has a simple and arbitrarily flexible API for building and training models. However, we still need a lot of manual work to tune the hyperparameters. Fortunately, with Keras Tuner, we can automate the hyperparameter tuning process with minor modifications to the code for building and training the models. To further boost the productivity, we introduce AutoKeras, which fully automates the model building, training, and hyperparameter tuning process. It dramatically reduces the amount of prior knowledge needed of using machine learning for some common tasks. All you need is to define the task and to provide the training data.

This talk has been presented at ML conf EU 2020, check out the latest edition of this Tech Conference.

FAQ

TensorFlow is a foundational framework for deep learning that supports tensor manipulations, automatic differentiation, and deployment across various platforms. It is integral to the Keras ecosystem, providing the backend for executing complex mathematical operations and model training processes.

Automatic differentiation in TensorFlow allows for the calculation of gradients automatically without manual computation of derivatives. This is achieved using gradient tape to monitor variables and execute backpropagation efficiently.

TensorFlow supports deployment on various platforms including servers via TensorFlow Extended, single-chip machines such as edge devices using TensorFlow Lite, and web pages with TensorFlow.js.

Keras simplifies deep learning by providing high-level APIs that abstract the underlying TensorFlow operations. It allows for easy model creation with layers and training without the need to manually program the underlying mathematical operations or training loops.

Keras Tuner is a part of the Keras ecosystem that automates the tuning of hyperparameters in models. It requires only minor modifications to existing code and supports algorithms like random search, Bayesian optimization, and Hyperband to find optimal model configurations.

AutoKeras is an AutoML library for deep learning under the Keras ecosystem that reduces the learning curve for adopting machine learning. It enables building machine learning models with minimal code and no required ML background, supporting tasks like image classification and regression with advanced features like model export for deployment.

AutoKeras accommodates complex real-world scenarios through features like multi-model data handling and multitasking capabilities. It allows for the integration of diverse data types and simultaneous execution of multiple learning tasks, enhancing its applicability in varied applications.

Haifeng Jin
Haifeng Jin
30 min
02 Jul, 2021

Comments

Sign in or register to post your comment.
Video Summary and Transcription
The video highlights the Keras ecosystem's ability to simplify deep learning. TensorFlow offers tensor manipulations, automatic differentiation, and versatile deployment options including TensorFlow Lite and TensorFlow.js. Keras provides high-level APIs, making it easy to add layers and handle loss calculations and training loops. Keras Tuner automates hyperparameter tuning using algorithms like Bayesian optimization. AutoKeras makes machine learning accessible with minimal code, supporting tasks like image classification and regression. Beginners can start with AutoKeras or beginner-level courses. TensorFlow's Eager Execution offers flexibility for researchers. AutoKeras supports complex scenarios like multi-model data and multitasking. Time series forecasting will be available in AutoKeras by year-end.

1. Introduction to TensorFlow in Keras Ecosystem

Short description:

Hello, everyone. I'm very happy to be here at MLConf EU with you guys and thank you very much for the invitation. My presentation is about boost productivity with Keras ecosystem. We're going to highlight four features of TensorFlow. The first one is for tensor manipulations. The second feature is about automatic differentiation. Another important feature of TensorFlow is about deployment. It can be deployed anywhere for a model implemented with TensorFlow. TensorFlow is really about performance and scalability. But how do we really leverage the power of TensorFlow?

Hello, everyone. I'm very happy to be here at MLConf EU with you guys and thank you very much for the invitation. And my presentation is about boost productivity with Keras ecosystem.

So there are many members of the Keras ecosystem and the first one we're going to introduce is TensorFlow. I believe many of you guys have heard of it. It's a very powerful foundation for all the deep learning solutions built on top of it. But today, we're going to highlight four features of it for you to see how other members of the Keras ecosystem going to depend on these features to build something more.

The first one, we all know it's for tensor manipulations. As you can see, we have A and B as two by two matrix here, and you can do A plus B or C or exponential of D with them. This is supported by TensorFlow, or a source of mathematical operations on all those tensors. And the second feature we want to highlight is about automatic differentiation. It means you can calculate the gradients automatically without manually computing any of the derivatives on your own. Again, we have A and B as matrices, two by two. And the C is here, actually calculated from A and B. We got C. And now we want to calculate the gradient of C with respect to A. And you don't have to do any derivatives on your own, but by inserting these lines. With gradient tape, watch A, you can actually automatically calculate C, D, A, just by calling tape.gradientCA.

And another important feature of TensorFlow that's really used by any other library in the Keras ecosystem is about deployment. It can be deployed anywhere for a model that implemented with TensorFlow. For example, it can be deployed on servers with TensorFlow Extended. And it can be deployed on single-chip machines like Edge Devices with TensorFlow Lite, and also deploy on any web pages with tf.js. And moreover, TensorFlow is really about performance and scalability. So it runs on GPUs and TPUs for acceleration of all those medical operations on tensors. It also scales up to multiple servers with multiple GPUs and TPUs to make the training of the model really fast, and make the prediction for the model really fast, and deployment of the model really fast. And that's about TensorFlow. It's a very powerful mission for the Keras ecosystem.

But how do we really leverage the power of TensorFlow? As we saw, the API of TensorFlow is very low-level, consists of a lot of mathematical operations. You don't really want to implement a whole lot of deep learning solutions with all those mathematical operations, because each deep learning solution may involve hundreds of those mathematical operations. You don't want to write each one of them in your code on your own.

2. Keras: High-Level API for TensorFlow

Short description:

Keras is built on top of TensorFlow and provides high-level APIs that simplify deep learning. You can easily add layers to a sequential model and specify the number of neurons and activation functions. Loss calculations and training loops are handled automatically. Keras supports a wide range of tasks, from standard usage to advanced techniques like GANs and custom layers. For more complex scenarios, you can write custom metrics and losses, or even implement your own optimization algorithms using TensorFlow's low-level API.

So that's why we're going to go to the second member of the Keras, a radically productive deep learning. So for this one, it has actually built on top of TensorFlow and wrapping the TensorFlow low-level APIs into the high-level APIs, which are really simple to use.

We can see a very simple example code snippet here. We just initialize a sequential model, which is a type of model we're going to implement in Keras. And you can just keep adding those layers to the sequential model. Like here, we add a dense layer with 32 neurons, or units, in it, and activation function equal to Relu, and another dense layer to it. So then we got a model with two dense layers.

It's very simple to implement, and you don't really care about what mathematical operations are actually behind those dense layers, although it's actually matrix multiplication and additions, but you don't really need to write them on your own. You just use dense layer, and with a number of units. And also, you don't need to calculate the loss on your own. You just pass it as a string, categorical cross entropy. You don't do any calculations, but only a string.

This loss is actually for the classification task. And the model offset, you just passed in the training data. You don't need to write any loop on your own, like looping through 20 epochs. But you only pass in the data, and specify the epoch as 20. And then you start to do the predictions with the testing data. It's really simple to learn.

But despite the simplicity, it's capable of a lot of things. It's capable of everything supported by the TensorFlow low-level API. And you only need to learn what you need. We don't want the user to learn everything upfront that's quite a large learning curve. They start with a simple example like what we just showed before as a standard usage. You can use Sequential API, Function API, and Build and Layers.

But if you are aiming for something more, for example, you want to use TensorBoard and early stopping or saving the model to the disk with check pointing as you're training them, you can just pass a bunch of callback functions to the model. And it's really simple to do. But if you want something even more, like the GANS model or curriculum learning, and then you need to write some custom layers or custom metrics and custom losses, those are also very easy to implement just by extending the base classes in Keras.

But there are even more harder use cases, like learning to learn or you want to implement a new type of optimization algorithm, in that case, you will have to write your own training loop with the gradient tape operations. And with that, you are gaining full freedom of using anything supported with TensorFlow in Keras. So this is the logic of the API design of Keras.

QnA

Check out more articles and videos

We constantly think of articles and videos that might spark Git people interest / skill us up or help building a stellar career

TensorFlow.js 101: ML in the Browser and Beyond
ML conf EU 2020ML conf EU 2020
41 min
TensorFlow.js 101: ML in the Browser and Beyond
TensorFlow.js enables machine learning in the browser and beyond, with features like face mesh, body segmentation, and pose estimation. It offers JavaScript prototyping and transfer learning capabilities, as well as the ability to recognize custom objects using the Image Project feature. TensorFlow.js can be used with Cloud AutoML for training custom vision models and provides performance benefits in both JavaScript and Python development. It offers interactivity, reach, scale, and performance, and encourages community engagement and collaboration between the JavaScript and machine learning communities.
Build a 3D Solar System with Hand Recognition and Three.js
JSNation 2022JSNation 2022
36 min
Build a 3D Solar System with Hand Recognition and Three.js
Top Content
This Talk explores the use of TypeScript, 3JS, hand recognition, and TensorFlow.js to create 3D experiences on the web. It covers topics such as rendering 3D objects, adding lights and objects, hand tracking, and creating interactive gestures. The speaker demonstrates how to build a cube and a bouncy box, move objects with flick gestures, and create a solar system with stars and planets. The Talk also discusses the possibilities of using hand gestures for web navigation and controlling websites, as well as the performance limits of these technologies.
Using MediaPipe to Create Cross Platform Machine Learning Applications with React
React Advanced 2021React Advanced 2021
21 min
Using MediaPipe to Create Cross Platform Machine Learning Applications with React
Top Content
MediaPipe is a cross-platform framework that helps build perception pipelines using machine learning models. It offers ready-to-use solutions for various applications, such as selfie segmentation, face mesh, object detection, hand tracking, and more. MediaPipe can be integrated with React using NPM modules provided by the MediaPipe team. The demonstration showcases the implementation of face mesh and selfie segmentation solutions. MediaPipe enables the creation of amazing applications without needing to understand the underlying computer vision or machine learning processes.
Charlie Gerard's Career Advice: Be intentional about how you spend your time and effort
Charlie Gerard's Career Advice: Be intentional about how you spend your time and effort
Article
Charlie Gerard
Charlie Gerard
When it comes to career, Charlie has one trick: to focus. But that doesn’t mean that you shouldn’t try different things — currently a senior front-end developer at Netlify, she is also a sought-after speaker, mentor, and a machine learning trailblazer of the JavaScript universe. "Experiment with things, but build expertise in a specific area," she advises.
What led you to software engineering?My background is in digital marketing, so I started my career as a project manager in advertising agencies. After a couple of years of doing that, I realized that I wasn't learning and growing as much as I wanted to. I was interested in learning more about building websites, so I quit my job and signed up for an intensive coding boot camp called General Assembly. I absolutely loved it and started my career in tech from there.
What is the most impactful thing you ever did to boost your career?I think it might be public speaking. Going on stage to share knowledge about things I learned while building my side projects gave me the opportunity to meet a lot of people in the industry, learn a ton from watching other people's talks and, for lack of better words, build a personal brand.
What would be your three tips for engineers to level up their career?Practice your communication skills. I can't stress enough how important it is to be able to explain things in a way anyone can understand, but also communicate in a way that's inclusive and creates an environment where team members feel safe and welcome to contribute ideas, ask questions, and give feedback. In addition, build some expertise in a specific area. I'm a huge fan of learning and experimenting with lots of technologies but as you grow in your career, there comes a time where you need to pick an area to focus on to build more profound knowledge. This could be in a specific language like JavaScript or Python or in a practice like accessibility or web performance. It doesn't mean you shouldn't keep in touch with anything else that's going on in the industry, but it means that you focus on an area you want to have more expertise in. If you could be the "go-to" person for something, what would you want it to be? 
And lastly, be intentional about how you spend your time and effort. Saying yes to everything isn't always helpful if it doesn't serve your goals. No matter the job, there are always projects and tasks that will help you reach your goals and some that won't. If you can, try to focus on the tasks that will grow the skills you want to grow or help you get the next job you'd like to have.
What are you working on right now?Recently I've taken a pretty big break from side projects, but the next one I'd like to work on is a prototype of a tool that would allow hands-free coding using gaze detection. 
Do you have some rituals that keep you focused and goal-oriented?Usually, when I come up with a side project idea I'm really excited about, that excitement is enough to keep me motivated. That's why I tend to avoid spending time on things I'm not genuinely interested in. Otherwise, breaking down projects into smaller chunks allows me to fit them better in my schedule. I make sure to take enough breaks, so I maintain a certain level of energy and motivation to finish what I have in mind.
You wrote a book called Practical Machine Learning in JavaScript. What got you so excited about the connection between JavaScript and ML?The release of TensorFlow.js opened up the world of ML to frontend devs, and this is what really got me excited. I had machine learning on my list of things I wanted to learn for a few years, but I didn't start looking into it before because I knew I'd have to learn another language as well, like Python, for example. As soon as I realized it was now available in JS, that removed a big barrier and made it a lot more approachable. Considering that you can use JavaScript to build lots of different applications, including augmented reality, virtual reality, and IoT, and combine them with machine learning as well as some fun web APIs felt super exciting to me.

Where do you see the fields going together in the future, near or far? I'd love to see more AI-powered web applications in the future, especially as machine learning models get smaller and more performant. However, it seems like the adoption of ML in JS is still rather low. Considering the amount of content we post online, there could be great opportunities to build tools that assist you in writing blog posts or that can automatically edit podcasts and videos. There are lots of tasks we do that feel cumbersome that could be made a bit easier with the help of machine learning.
You are a frequent conference speaker. You have your own blog and even a newsletter. What made you start with content creation?I realized that I love learning new things because I love teaching. I think that if I kept what I know to myself, it would be pretty boring. If I'm excited about something, I want to share the knowledge I gained, and I'd like other people to feel the same excitement I feel. That's definitely what motivated me to start creating content.
How has content affected your career?I don't track any metrics on my blog or likes and follows on Twitter, so I don't know what created different opportunities. Creating content to share something you built improves the chances of people stumbling upon it and learning more about you and what you like to do, but this is not something that's guaranteed. I think over time, I accumulated enough projects, blog posts, and conference talks that some conferences now invite me, so I don't always apply anymore. I sometimes get invited on podcasts and asked if I want to create video content and things like that. Having a backlog of content helps people better understand who you are and quickly decide if you're the right person for an opportunity.What pieces of your work are you most proud of?It is probably that I've managed to develop a mindset where I set myself hard challenges on my side project, and I'm not scared to fail and push the boundaries of what I think is possible. I don't prefer a particular project, it's more around the creative thinking I've developed over the years that I believe has become a big strength of mine.***Follow Charlie on Twitter
TensorFlow.JS 101: ML in the Browser and Beyond
JSNation Live 2021JSNation Live 2021
39 min
TensorFlow.JS 101: ML in the Browser and Beyond
JavaScript with TensorFlow.js allows for machine learning in various environments, enabling the creation of applications like augmented reality and sentiment analysis. TensorFlow.js offers pre-trained models for object detection, body segmentation, and face landmark detection. It also allows for 3D rendering and the combination of machine learning with WebGL. The integration of WebRTC and WebXR enables teleportation and enhanced communication. TensorFlow.js supports transfer learning through Teachable Machine and Cloud AutoML, and provides flexibility and performance benefits in the browser and Node.js environments.
Observability with diagnostics_channel and AsyncLocalStorage
Node Congress 2023Node Congress 2023
21 min
Observability with diagnostics_channel and AsyncLocalStorage
Observability with Diagnostics Channel and async local storage allows for high-performance event tracking and propagation of values through calls, callbacks, and promise continuations. Tracing involves five events and separate channels for each event, capturing errors and return values. The span object in async local storage stores data about the current execution and is reported to the tracer when the end is triggered.

Workshops on related topic

Leveraging LLMs to Build Intuitive AI Experiences With JavaScript
JSNation 2024JSNation 2024
108 min
Leveraging LLMs to Build Intuitive AI Experiences With JavaScript
Featured Workshop
Roy Derks
Shivay Lamba
2 authors
Today every developer is using LLMs in different forms and shapes, from ChatGPT to code assistants like GitHub CoPilot. Following this, lots of products have introduced embedded AI capabilities, and in this workshop we will make LLMs understandable for web developers. And we'll get into coding your own AI-driven application. No prior experience in working with LLMs or machine learning is needed. Instead, we'll use web technologies such as JavaScript, React which you already know and love while also learning about some new libraries like OpenAI, Transformers.js
Can LLMs Learn? Let’s Customize an LLM to Chat With Your Own Data
C3 Dev Festival 2024C3 Dev Festival 2024
48 min
Can LLMs Learn? Let’s Customize an LLM to Chat With Your Own Data
WorkshopFree
Andreia Ocanoaia
Andreia Ocanoaia
Feeling the limitations of LLMs? They can be creative, but sometimes lack accuracy or rely on outdated information. In this workshop, we’ll break down the process of building and easily deploying a Retrieval-Augmented Generation system. This approach enables you to leverage the power of LLMs with the added benefit of factual accuracy and up-to-date information.
Let AI Be Your Docs
JSNation 2024JSNation 2024
69 min
Let AI Be Your Docs
Workshop
Jesse Hall
Jesse Hall
Join our dynamic workshop to craft an AI-powered documentation portal. Learn to integrate OpenAI's ChatGPT with Next.js 14, Tailwind CSS, and cutting-edge tech to deliver instant code solutions and summaries. This hands-on session will equip you with the knowledge to revolutionize how users interact with documentation, turning tedious searches into efficient, intelligent discovery.
Key Takeaways:
- Practical experience in creating an AI-driven documentation site.- Understanding the integration of AI into user experiences.- Hands-on skills with the latest web development technologies.- Strategies for deploying and maintaining intelligent documentation resources.
Table of contents:- Introduction to AI in Documentation- Setting Up the Environment- Building the Documentation Structure- Integrating ChatGPT for Interactive Docs
Intro to AI for JavaScript Developers with Tensorflow.js
JSNation Live 2021JSNation Live 2021
81 min
Intro to AI for JavaScript Developers with Tensorflow.js
Workshop
Chris Achard
Chris Achard
Have you wanted to explore AI, but didn't want to learn Python to do it? Tensorflow.js lets you use AI and deep learning in javascript – no python required!
We'll take a look at the different tasks AI can help solve, and how to use Tensorflow.js to solve them. You don't need to know any AI to get started - we'll start with the basics, but we'll still be able to see some neat demos, because Tensorflow.js has a bunch of functionality and pre-built models that you can use on the server or in the browser.
After this workshop, you should be able to set up and run pre-built Tensorflow.js models, or begin to write and train your own models on your own data.
Hands on with TensorFlow.js
ML conf EU 2020ML conf EU 2020
160 min
Hands on with TensorFlow.js
Workshop
Jason Mayes
Jason Mayes
Come check out our workshop which will walk you through 3 common journeys when using TensorFlow.js. We will start with demonstrating how to use one of our pre-made models - super easy to use JS classes to get you working with ML fast. We will then look into how to retrain one of these models in minutes using in browser transfer learning via Teachable Machine and how that can be then used on your own custom website, and finally end with a hello world of writing your own model code from scratch to make a simple linear regression to predict fictional house prices based on their square footage.
The Hitchhiker's Guide to the Machine Learning Engineering Galaxy
ML conf EU 2020ML conf EU 2020
112 min
The Hitchhiker's Guide to the Machine Learning Engineering Galaxy
Workshop
Alyona Galyeva
Alyona Galyeva
Are you a Software Engineer who got tasked to deploy a machine learning or deep learning model for the first time in your life? Are you wondering what steps to take and how AI-powered software is different from traditional software? Then it is the right workshop to attend.
The internet offers thousands of articles and free of charge courses, showing how it is easy to train and deploy a simple AI model. At the same time in reality it is difficult to integrate a real model into the current infrastructure, debug, test, deploy, and monitor it properly. In this workshop, I will guide you through this process sharing tips, tricks, and favorite open source tools that will make your life much easier. So, at the end of the workshop, you will know where to start your deployment journey, what tools to use, and what questions to ask.