{"slug": "learn-about-edge-ai-like-a-child", "title": "Learn about ‘Edge AI’ like a child", "summary": "Edge AI runs machine learning models directly on devices like phones, cameras, and appliances instead of relying on cloud servers, keeping data local. An ML model processes input data—such as images or text—converted into multidimensional arrays called tensors, with shapes like [1, 320, 320, 3] for a 320×320 RGB image or [1, 96] for text input, and outputs predictions through inference.", "body_md": "Artificial Intelligence has become part of our everyday lives, and many AI features send your data to the internet for processing. That’s where on device AI, also known as **Edge AI**, comes in. Instead of relying on cloud servers, the AI runs directly on your device, making phones, computers, watches, TVs, cameras, and even coffee makers and air conditioners smarter while keeping your data local.\n\nIn this article, we will learn what a machine learning (ML) model is, how it works, and how to use one in your application. You can think of an ML model as a processing unit with an **input**, a **process**, and an **output**. We’ll explore what the input looks like, how to feed data into a model, and how to understand its output. You’ll also see that both input and output are simply collections of numbers arranged in multidimensional arrays (called **Tensors**).\n\nWhat’s this article not about**?**\n\n[Machine Learning vs Deep Learning](https://www.databricks.com/blog/machine-learning-vs-deep-learning)\n\nAll machine learning models are programs that have learned how to perform a specific task by studying a large amount of data. Unlike a normal program, where we write all the rules, an ML model learns those rules during training.\n\nOnce the training is finished, they become static; from that point on, it only performs predictions from new input data, also known as **Inference **or **Interpreting.**\n\nThe following hierarchy explains the relationship among AI, ML, and DL:\n\n```\nArtificial Intelligence (AI) Rules and Logic    // Can not be trained during usage (static)└── Machine Learning (ML) replaces rules with experience    // Can be trained during usage (dynamic)└── Deep Learning (DL) automatic learning\n```\n\nEvery machine learning model follows the same pipeline.\n\n```\nInput ↓Process ↓Output\n```\n\nThe input is the data you provide to the model.\n\nDepending on the model, the input could be:\n\nHowever, a model cannot understand any of these directly. Before the data reaches the model, it must be converted into numbers called **Tensor.**\n\nA **tensor** is simply a collection of numbers.\n\nIf you’ve worked with arrays in programming, you’ve already used something very similar. The only difference is that a tensor can have more than one dimension. It’s simply a **matrix**.\n\n```\n1D Tensor[12, 34, 56]2D Tensor[  [1, 2, 3],  [4, 5, 6]]\n```\n\n*What Does Shape Mean?*\n\nThe **shape** of a tensor describes how its numbers are organized.\n\nIt tells us the size of each dimension, but it does not change the actual values stored inside the tensor.\n\nFor example, a 1D tensor:\n\n``` php\n[12, 34, 56] -> shape is [3]\n```\n\nA 2D tensor:\n\n```\n[  [1, 2, 3],  [4, 5, 6]]This tensor has two dimensions:2 rows3 columnsShape is [2,3]\n```\n\n*What if the model receives an image?*\n\n**Example for Face Detection Input**\n\nSuppose we have a face detection model that expects an RGB image with a size of **320 × 320** pixels.\n\nThe original image:\n\n```\n320 × 320 RGB Image\n```\n\nwill be converted into a tensor with the shape of:\n\n```\n[1, 320, 320, 3]\n```\n\nwhere:\n\nBut internally, this is just one long array containing:\n\n```\n1 x 320 × 320 × 3 = 307,200 numbers\n```\n\nCheck out [this code example](https://gist.github.com/ShadAdman/48b908d131bc076c506d732abd56a4d5) on converting a Bitmap to a Tensor.\n\n*But what if the model receives text?*\n\n**Example for Text Model Input**\n\nNot every model works with images. Some models work with text instead.\n\nFor example, an English Grapheme-to-Phoneme** (G2P)** model converts written words into their pronunciation sounds.\n\nA model like **DeepPhonemizer** receives text as input and predicts the phonemes (the basic sound units of a language).\n\nThe input might be:\n\n```\n\"hello\"\n```\n\nWhen we convert this to a Tensor related to the model input shape, it will become something like this: (each char will become a number)\n\n```\n[  [  21,  8,  15,  15,  18  ]]\n```\n\nThe model receives this data as a tensor with shape of:\n\n```\ntext [1, 96]\n```\n\nThis means:\n\nIf the text is shorter than 96 tokens, the remaining positions are usually filled with padding values.\n\nThe process is the work performed inside the machine learning model.\n\nHere, the model applies the knowledge it learned during training by performing thousands or even millions of mathematical operations on the input tensor.\n\nThe output is the model’s prediction.\n\nDepending on the model, the output might be:\n\nJust like the input, the output is also a tensor with a predefined shape.\n\n**Example: Face Detection Output**\n\nSuppose the model detects two faces in the image.\n\nInstead of returning rectangles or drawing anything on the screen, it returns a tensor containing numbers such as:\n\n```\n[  45, 62, 128, 180, 0.98,  185, 74, 276, 192, 0.95]\n```\n\nFor a real face detection model, the output tensor might have the shape:\n\n```\n[1, 2500, 5]\n```\n\nThis means:\n\nYou can visualize the output tensor like this:\n\n```\n[  [                     ← Batch (1 image)    [45, 62, 128, 180, 0.98],   ← Prediction 1    [185, 74, 276, 192, 0.95],  ← Prediction 2    [ ... ],                    ← Prediction 3    ...    [ ... ]                     ← Prediction 2500  ]]\n```\n\nin code, this will look like:\n\n```\nval output = Array(1) {    Array(2500) {        FloatArray(5)    }}\n```\n\nso the shape of our model output is [1,2500,5].\n\nyou can access the first prediction like this:\n\n```\nval firstPrediction = output[0][0]val x = firstPrediction[0]val y = firstPrediction[1]val width = firstPrediction[2]val height = firstPrediction[3]val confidence = firstPrediction[4]\n```\n\nMost of these 2,500 predictions are not actual faces. Many will have very low confidence scores, such as 0.02 or 0.15. You must remove low confidence predictions and keep only the best ones. This is also known as **Thresholding**.\n\n*But what if the model produces text?*\n\n**Example for Text Model Output**\n\nConsider the input we earlier gave in the input section. The model then processes that input tensor and produces an output tensor with a shape of:\n\n```\n[1, 96, 64]\n```\n\nThis means:\n\nHere, the output is called **logits**. Logits are raw prediction scores before they are converted into probabilities.\n\nFor example, for the first character position, the model might output:\n\n```\n[  0.2,  -1.5,  3.8,  ...]\n```\n\nAfter converting these predictions, the output might become:\n\n```\nhello ↓ G2PHH AH L OW\n```\n\nNormalization is the process of changing numerical values into a specific range or format that the machine learning model expects. Almost 90% of errors will hover around this section.\n\nNormalization can happen in two places:\n\nNow that we understand how data moves through a machine learning model, the next step is running these models inside an application.\n\nFor edge AI, models are usually converted into formats optimized for mobile and embedded devices, such as tflite, onnx, or pt.\n\nOne of the most common libraries is **TensorFlow Lite**, now evolving under the name **LiteRT**.\n\nAnother popular option is **PyTorch Runtime or ExecuTorch:**\n\n**Thank you for reading.**\n\n[Learn about ‘Edge AI’ like a child](https://blog.devgenius.io/learn-about-edge-ai-like-a-child-23b0c7007890) was originally published in [Dev Genius](https://blog.devgenius.io) on Medium, where people are continuing the conversation by highlighting and responding to this story.", "url": "https://wpnews.pro/news/learn-about-edge-ai-like-a-child", "canonical_source": "https://blog.devgenius.io/learn-about-edge-ai-like-a-child-23b0c7007890?source=rss----4e2c1156667e---4", "published_at": "2026-07-23 12:06:45+00:00", "updated_at": "2026-07-23 12:29:19.097661+00:00", "lang": "en", "topics": ["artificial-intelligence", "machine-learning"], "entities": ["Edge AI", "DeepPhonemizer"], "alternates": {"html": "https://wpnews.pro/news/learn-about-edge-ai-like-a-child", "markdown": "https://wpnews.pro/news/learn-about-edge-ai-like-a-child.md", "text": "https://wpnews.pro/news/learn-about-edge-ai-like-a-child.txt", "jsonld": "https://wpnews.pro/news/learn-about-edge-ai-like-a-child.jsonld"}}