 Thank you very much. I'm super happy to be here with all of you talking about TinyML. Before start, I would like to just let you know which kind of talk will be this one, just to be sure that everyone is on the same page. This is an introductory talk where we are going to cover a lot of topics. I'm going to try not to overwhelm you a lot, but we are going to see a lot of things. And you're going to discover why the structure of this talk during the talk. Well, I'm going to keep it very short because the chair did a great job introducing me. Then I'm just going to go into a couple of things. The last years, I have been working mainly with center data. And it's this kind of project that I just love to build also in my free time. For instance, growing lettuces in my balcony. It's something that I just enjoy a lot, and I truly recommend to you doing it. Also, implementing some machine learning pipelines to increase your happiness plans. And well, as you can see, my plans needed. And it's a clear example that sometimes we don't need machine learning to understand that our plans are not happy. But I enjoy a lot doing these kind of things. And in my last project that I developed at home, it was for kind of have control of my air quality. And I have a lot of fun building that because it was a monitoring system, but also a predictive system. I could know when I should activate my ventilation system, that in other words, was just when open the window. But I enjoy a lot. I thought, wait, what if I can have this kind of system? But with me, when I go to the street and see who is the contamination level, what if I need to wear a mask or not? What are these kind of things? And that was the moment when I start with tiny ML. Currently, I am developing this project. I cannot show you yet because it's not done. But maybe for the next conference, we'll be ready. But during this time developing this project, I learned a lot of things. And I realized that this knowledge could be shared with the community. And maybe it could help to someone to just do it easier. Let's start for the beginning. What is tiny ML? Tiny ML, it's in the interception of two great walls. It's interception between data science and electronics and specifically between machine learning and embedded system. And wow, it's awesome because you have a very great two walls working together. Yeah, that's true. However, it could be kind of challenging sometimes because you need some knowledge of data science and also some knowledge of electronics or have two teams that can work together and have good communication between them. But we are going to cover all these topics in case that you can just build your own projects as me. Why tiny ML? Well, one of the key points from my perspective is data privacy because you're going to be able to have all the manage your data, your prediction in the device without having the necessity to have access to a cloud or other things. Low energy consumption, these devices doesn't require a lot of energy and a lot of power. Low latency and theory should be faster. And also connectivity. If you're working with IoT systems and data, this kind of sensor data, maybe you are going to face some internet connections time to time and you're going to lose the data or you're going to have issues. Or maybe you need to have this system in a place where the internet doesn't arrive. This is one of the ways. And maybe you are thinking, yeah, but has this application in real life? Yes, there are applications. We can find examples currently and also for the future. One of the topics that also I think that is very, very important is health care. And it's because the data privacy that we were talking about. If you have a device that track your phone information and can keep this data privacy, maybe it's a good way to make things. Of course, this is only an example, a publication, but there are many of them that we can discuss later on. Also agriculture. And maybe you are thinking, why agriculture is key? Well, not everywhere arrive internet. Not everyone have access to internet data and has the ability to have a device or even in the mobile. Some models for predicting best, predicting who can happen to your plant, go help to the farmers around the world. Also smart spaces. It's important to understand if you have a person in the room or not for security reasons, sometimes in some spaces. Then we have more. We have predictive maintenance. This is one of my favorite topics that I'm gonna do in some mentioning because I have been working for long. And it's because of that is that you can predict also if something gonna fail in places that maybe the internet connection doesn't arrive. Also we have well conservation. There are projects that currently we can track elephants in this case, but also there are other whales. In this case, it's to avoid fur tips and avoid that the elephants could be killed. And also we have sound recognition. Maybe it's familiar to you this, hey, blah, blah, blah. Or okay, blah, blah, blah. And something happened. Maybe, sorry, I couldn't hear the sound. And maybe something happened. Maybe some sound could play. Yes, maybe you're familiar with some of those. This is also an application or something. Then as we were talking about before, there are some challenges or things that you need to have in consideration before start these kind of projects. And we are gonna start from the embedded system first, from the electronics part. First is the development boards. Which one you are gonna use? What are the needs of your project? Which one more? Of course, this is my bias because it's the boards that I am using currently for developing and doing my experiments. And specifically, I am playing around these two. But of course, you can choose the board that you need or you want. What is important? Understand what are your needs of your project. And then this means that you are gonna need to always have in mind what is your data science question on problem. And we are gonna see it later in the machine learning part because even it's very cool to see, I'm gonna take this board because it's a trending topic. Maybe it's not the best for your business case or your experiments or whatever you want to implement. We are gonna see it later on. But just let you know, I'm super fan of those because also it's super small. I'm not sure if you can see it, but because it's very small, it's the size of my A, but just to give you my two cents of that. What are some of the challenges? The heterogeneity, it's very hard. It's very hard to have some standards and tell you, A, you need to do ABC for all the boards. And of course, if you are in the electronic world and for you will be very easy, but if you came from the data world, it will be more challenging. And of course, the constraints, the constraints that we are gonna find. And this is something very important because when we're developing things in data science, of course, we try to be efficient, we try to optimize. However, we have other kind of challenges in the computing side, for instance, because usually we develop our project in a computer or in a cloud, and kind of happy, we train the models, we have these things. But then, in this case, will be much challenging. This means that, for instance, the training we are gonna need to keep it as we are doing it right now in a computer or in the cloud. Of course, these numbers are orientative, they're gonna be changing depending on the case also. This is the information that came from this website. Of course, it could be different, but just I wanted to share with you the constraints that we need to face. And one of the key things is the memory. We are gonna need to fit machine learning models into this storage and have it running in this memory. Let's, but no worries, we are gonna go into that, but it's a real challenge. Of course, development environment. If you develop and you work with microcontroller, for you, this is not a problem at all, but if you came from a different world, it's like, okay, how I do that, right? This is new, it's like I need to connect it and imagine it happened or I can do something else. Yeah, well, there are different options that you can develop, of course. You can also use your command line, very simplified ID, or just a cross-platform that is open source and also is language-agnostic and you can work about that. And of course, you're gonna know a bit of electronics or ask for some support with someone because you're gonna need to do some flashing and move files and understand how farm works and the specificity of the board and these kind of things that, again, when you are in the field, it's super obvious, but when you came out of that, it's like, I'm not sure what I'm doing. And of course, always reading the documentation, also check, my recommendation is check before, by some board, check the documentation to be sure that you are gonna be able to follow up. But it's true that once you start, you realize that it's quite straightforward. It's just follow some steps and everything gonna work sooner or later. Let's go for the machine learning challenges. And on here, we're gonna find some of them. Well, I'm here. We have a typical data science machine learning pipeline with the different steps. If you are into the data science world, you know that this linearity is not correct because we are gonna need to collect the data, process the data, wait. The model is not performing very well. You're gonna need back and then out. What about now? I know wait, I need more data. The data is not very good and you're gonna need to have this iteration in continuous. And this is gonna happen the same. This will be exactly the same. You need to do exactly the same that you think that you do normally, but with some differences that we are gonna arrive later on. The first, the only thing that I wanted to add in that point is just be careful because as I was mentioning, call the pipeline gonna need to be into the computer or cloud that you use until the deployment, of course, that will be in our microcontroller. If some of you are thinking, by the way, how I'm gonna implement now a neural network because I came from a different field, how can I do that from zero? There are options that could simplify this process and you can use a non-code option. In this case, in this platform, the it impulse, you can have all the pipeline just with clicking options. You can have the dashboard, there is a, you can have the collection of data that you can, I think that you can have it with sound, then you can have some model, train the model, have the metrics and that. One of the things that are very cool is that also you can know how big you're gonna be your model when you train and see all your metrics and decide if this is a good option for you or you need to just now go back and do all these pipeline that we were talking about. Maybe you need more data, maybe not. One of the things that this platform, I found it that was not matching with my necessities is that there was a specific, for some specific boards and I wanted to work with some specific boards and I could not use it. Other thing is that the availability of the models because I want to solve my data science problem in a specific way and in this case, the offer is still in the developing, I think. I think at some point, they are gonna have it but it's still that. But if you want to try it, it's a very nice option for sure. However, today we are gonna go for trying to do it by a scratch because I wanted to share all the points that you are gonna need to have in mind once you want to develop the project to make decisions. First thing gonna be what type of data science problem I have, it's a supervised or isn't a supervised, will be some classification, some progression, what exactly will be an anomaly detection? Oh, all these kind of questions you are gonna also need to answer. And of course, depends on the type of data, you are gonna have different challenges. For instance, for anomaly detection, in this case, they were using audio and in other cases, vibration. This means that the way that you are gonna need to process this data is completely different and work with audio, for instance, is very challenging and you are gonna need to face some challenges that you are not gonna need to face it in vibration data, for instance. Or if you are working with object recognition with images, also will be different. Of course, maybe you are thinking, okay, but then let's collect data from zero. Yeah, yes, this is an option. Then you have more options inside this option. You can have sensors. In this case, I'm sharing with you the sensor of CO2 from the project that I was mentioning before. But also you can have some microcontrollers with sensor integrated in the one that I was sharing showing before. But maybe you're thinking, by the way, they have a mobile phone. I can collect data from there. Yes, of course you can, but also you are gonna need to handle then the storage or who are you gonna connect these or other challenges, but of course, everything is a full, it's a whole full of options. What more? We have public datasets. We can also use them. We can also use pre-training models. People is the training models. Google people, for instance, has models available that we can use and use transfer learning and do some kind of adjustment of our case. Yeah, this is a possibility. However, you are gonna need also to understand which kind of data and if this is something that works for you. But, yeah, there are a lot of options that we can have. Let's go for the designing model and training the model because, of course, you'll need again to make the decision. Don't be overwhelming for this slide because it's full of information, but I want just to show you a couple of things that are super, super important to have in consideration before a start. Let's imagine, for instance, that you have a case, a business case that you say, yeah, this, the solution, it's a neural network because I need to implement a neural network. Okay, then you can go to the supported models and then you need to decide which gonna be the library for the training in your computer or in the cloud. And then you say, okay, let's go for TensorFlow. But then you are gonna also need to check if your microcontroller that we were talking at the beginning is compatible with these libraries. And in the framework that we are gonna need to use, in this case, for TensorFlow, gonna be TensorFlow Lite Micro, or for instance, also is compatible with U-Tensor, depends of the platform that you are using. Then this is quite a little more complex that we were discussing at the beginning, the, oh yeah, choose a microcontroller that works for you. Yes, it works for you, but you need to have very good defining the data science project and how you are gonna solve the problem. And as we were mentioning before, as we have also constraints of memory and storage, keep it simple. As simple, you can solve your problem better, but sometimes, you know, you cannot simplify more and there are problems that needs to be solved for more complexity, but this is my recommendation always. But imagine, for instance, that you are using Second Learn, because it's a library that it's awesome for data science and you want to continue doing your project with Second Learn. Can I do that? The inference in a microcontroller? Yes, you can. You can use the Second Learn Porter, for instance, or as we were mentioning for TensorFlow, there is a lot of options. Just to mention that in case of TensorFlow, we have TensorFlow Lite, and then we have TensorFlow Micro. In the case of TensorFlow Lite, it's more for mobile and for microcontrollers, it's the micro. Just to give you a small detail. And then imagine, you train your neural network because you were, imagine that you were analyzing this case of detecting if in the room there is a person, there is a cat. Imagine that you are in a building, you are the security member and you need to know that time to time the alarm sound and you need to know if it's just a cat or it's a person who is in the building. And you implement a system to just have that and then you implement your neural network, everything is going very smooth, very good in your computer. And you know, sometimes things only work in our computer and this is a problem. And then we have another point. We have the optimization because we need to fit all this neural network with all these layers, all these parameters, all everything that was super good, our accuracy, all our metrics were very good. In this microcontroller that is super small and has constraints that we were mentioning before. One of the most popular option is to use quantification, even I also added the weight planning. In the case of quantification what we are doing is reduce the precision of the weight from 32 bits to 8 bits. Someone has concerns right now or maybe not, but you should have some concerns because if we have this size, this information, imagine that this is information from one side to another side of my hand and we reduce it to this with this quantification, we are losing some information. And maybe it's not the most important but maybe some of this information that we are taking out, it was important for our business, for our model. Then what is needed is to check before the deployment. We need to check if the performance of our model when we were training it in our computer with everything happy, everyone very happy with the success of this model is the same after the quantification. And also we are gonna need to think if we are eager to sacrifice a bit of accuracy in terms to have this model smaller because maybe if we are gonna do this for healthcare, we need to be very careful because if we have, I don't know, some accuracy that you accept as a good, also once you have this quantification process, you also need to have the same feeling that this is good. Well, the next challenge is the deployment of the model per se and of course the inference but the deployment, the physical deployment as we were mentioning before should not be a problem once you know how to move one file from one to our microcontroller. Then where is the challenge? In the case of TensorFlow Lite, let's think in this case, they recommended, this is from the official documentation and the recommended is convert our model to C array and then run the inference in C++. And then it's like, okay, well, what now? Because maybe for all of you, write C++ code is something that you are doing every day but for other people, maybe it's not and could be a new challenge, right? It's like, okay, now I need to learn C++ to write the code. What is very nice is the excuse to learn a new programming language. This was very nice motivation for me. However, for some other people, could be something that is a challenge also and I was wondering, is it possible to run the full pipeline with Python? Well, there is the option to extending macro Python in C. This is from the official documentation and then what I did is try to find some projects of people who did that before and I found this person who provides some examples, running TensorFlow with micro Python. There are only three examples but it's something that apparently is working for some specific boards also. Then this is the workflow options that we have currently. We have our training and optimization and step with Python but then the inference needs to be low level programming languages or go to the inference with micro Python. That we are still on that. I think because it's the only case that I found some information. Then the question will be why aren't there more Python options for inference and this could be a debate. Perfectly. Do you have any idea for comment someone who encoded to say why we don't have more pipelines that the inference is in Python? Okay, any other idea? I completely agree with both of you. I think that it's a think of optimization also could be other things like libraries and I think that could be more things. I, sorry, we, sorry, sorry. The thing is that this is the perfect opportunity for two things as I see it. First, we see that you can implement a workflow and projects that can work very good between Python and other programming languages and communities can interact and we can learn from each other. And on the other side, we can kind of open the door to see if we can find collaboration between the Python community members and see if we can kind of contribute to see more Python in this step. And of course, always trying to be open minded and accept the limitations that we could have. With that reflection, I will, with that reflection, I would like to finish my presentation of course that are my information in case that you want to discuss about this reflection or you need something of this whole pipeline. I will be very happy to share knowledge or discuss with you. Thanks a lot. Thank you very much. Thank you.