More on lesson 15

pull/52/head
Jim Bennett 4 years ago
parent 9a568f5796
commit 09e1926e9a

@ -0,0 +1,20 @@
{
"cSpell.words": [
"ADCs",
"Geospatial",
"Kbps",
"Mbps",
"Seeed",
"Twilio",
"UART",
"UDID",
"Zigbee",
"antimeridian",
"geofence",
"geofences",
"geofencing",
"microcontrollers",
"mosquitto",
"sketchnote"
]
}

@ -1,12 +1,12 @@
# Manufacturing and processing - using IoT to improve the processing of food
Once food reaches a central hub or processing plant, it isn't always just shipped out to supermarkets. A lot of the time the food goes through a number of processing steps, such as sorting by quality. This is a process that used to be manual - it would start in the field when pickers would only pick ripe fruit, then at the factory the fruit would be ride a conver belt and staff would manually remove any bruised or rotten fruit. Having picked and sorted strawberries myself as a summer job during school, I can testify that this isn't a fun job.
Once food reaches a central hub or processing plant, it isn't always just shipped out to supermarkets. A lot of the time the food goes through a number of processing steps, such as sorting by quality. This is a process that used to be manual - it would start in the field when pickers would only pick ripe fruit, then at the factory the fruit would be ride a conveyer belt and employees would manually remove any bruised or rotten fruit. Having picked and sorted strawberries myself as a summer job during school, I can testify that this isn't a fun job.
More modern setups rely on IoT for sorting. Some of the earliest devices like the sorters from [Weco](https://wecotek.com) use LEDs and optical sensors to detect the quality of produce, rejecting green tomatoes for example. These can be deployed in harvesters on the farm itself, or in processing plants. The video below shows one of these machines in action.
More modern setups rely on IoT for sorting. Some of the earliest devices like the sorters from [Weco](https://wecotek.com) use optical sensors to detect the quality of produce, rejecting green tomatoes for example. These can be deployed in harvesters on the farm itself, or in processing plants.
[![Automatic sorting of tomatoes via color](https://img.youtube.com/vi/AcRL91DouAU/0.jpg)](https://www.youtube.com/watch?v=AcRL91DouAU)
As advances happen in Artificial Intelligence (AI) and Machine Learning (ML), these machines can become more advanced, using ML models trained to distinguish between fruit and foreign objects such as rocks, dirt or insects. These models can also be trained to detect fruit quality, not just bruised fruit but early detection of disease or other crop problems.
As advances happen in AI, these machines can become more advanced, using models trained to distinguish between fruit and foreign objects such as rocks, dirt or insects. These models can also be trained to detect fruit quality, not just bruised fruit but early detection of disease or other crop problems.
> 🎓 The term *ML model* refers to the output of training machine learning software on a set of data. For example, you can train a ML model to distinguish between ripe and unripe tomatoes, then use the model on new images to see if the tomatoes are ripe or not.
In these 4 lessons you'll learn how to train image-based AI models to detect fruit quality, how to use these from an IoT device, and how to run these on the edge - that is on an IoT device rather than in the cloud.

@ -10,13 +10,86 @@ Add a sketchnote if possible/appropriate
## Introduction
In this lesson you will learn about
The recent rise in Artificial Intelligence (AI) and Machine Learning (ML) is providing a wide range of capabilities to todays developers. ML models can be trained to recognize different things in images, including unripe fruit, and this can be used in IoT devices to help sort produce either as it is being harvested, or during processing in factories or warehouses.
In this lesson you will learn about image classification - using ML models to distinguish between images of different things. You will learn how to train an image classifier to distinguish between fruit that is good, and fruit that is bad, either under or over ripe, bruised, or rotten.
In this lesson we'll cover:
* [Thing 1](#thing-1)
* [Using AI and ML to sort food](#using-ai-and-ml-to-sort-food)
* [Image classification via Machine Learning](#image-classification-via-machine-learning)
* [Train an image classifier](#train-an-image-classifier)
* [Test your image classifier](#test-your-image-classifier)
## Using AI and ML to sort food
Feeding the global population is hard, especially at a price that makes food affordable for all. One of the largest costs is labor, so farmers are increasingly turning to automation and tools like IoT to reduce their labor costs. Harvesting by hand is labor intensive (and often backbreaking work), and is being replaced by machinery, especially in richer nations. Despite the savings in cost of using machinery to harvest, there is a downside - the ability to sort food as it is being harvested.
Not all crops ripen evenly. Tomatoes, for example, can still have some green fruits on the vine when the majority is ready for harvest. Although it is a waste to harvest these early, it is cheaper and easier for the farmer to harvest everything using machinery and dispose of the unripe produce later.
✅ Have a look at different fruits or vegetables, either growing near you in farms or in your garden, or in shops, Are they all the same ripeness, or do you see variation?
Sorting produce moved from the harvest to the factory, with food travelling on long conveyer belts with teams of people picking over the produce removing anything that wasn't up to the required quality standard. Harvesting was cheaper thanks to machinery, but there was still a cost to manually sort food.
![If a red tomato is detected it continues its journey uninterrupted. If a green tomato is detected it is flicked into a waste bin by a lever](../../../images/optical-tomato-sorting.png)
***If a red tomato is detected it continues its journey uninterrupted. If a green tomato is detected it is flicked into a waste bin by a lever. tomato by parkjisun from the Noun Project - from the [Noun Project](https://thenounproject.com)***
The next evolution was to use machines to sort, either built into the harvester, or in the processing plants. The first generation of these machines used optical sensors to detect colors, controlling actuators to push green tomatoes into a waste bin using levers of puffs of air, leaving red tomatoes to continue on a network of conveyor belts.
The video below shows one of these machines in action.
[![Automatic sorting of tomatoes via color](https://img.youtube.com/vi/AcRL91DouAU/0.jpg)](https://www.youtube.com/watch?v=AcRL91DouAU)
In this video, as tomatoes fall from one conveyer belt to another, green tomatoes are detected and flicked into a bin using levers.
✅ What conditions would you need in a factory or in a field for these optical sensors to work correctly?
The latest evolutions of these sorting machines take advantage of AI and ML, using models trained to distinguish good produce from bad, not just by obvious color differences such as green tomatoes vs red, but by more subtle differences in appearance that can indicate disease or bruising.
## Image classification via Machine Learning
Traditional programming is where you take data, apply an algorithm to the data, and get output. For example, in the last project you took GPS coordinates and a geofence, applied an algorithm that was provided by Azure Maps, and got back a result of if the point was inside or outside the geofence. You input more data, you get more output.
![Traditional development takes input and an algorithm and gives output. Machine learning uses input and output data to train a model, and this model can take new input data to generate new output](../../../images/traditional-vs-ml.png)
Machine learning turns this around - you start with data and known outputs, and the machine learning tools work out the algorithm. You can then take that algorithm, called a *machine learning model*, and input new data and get new output.
> 🎓 The process of a machine learning tool generating a model is called *training*. The inputs and known outputs are called *training data*.
For example, you could give a model millions of pictures of unripe strawberries as input training data, with the training output set as `unripe`, and millions of ripe strawberry pictures as training data with the output set as `ripe`. The ML tools will then generate a model. You then give this model a new picture of a strawberry and it will predict if the new picture is a ripe or an unripe strawberry.
> 🎓 The results of ML models are called *predictions*
![2 strawberries, a rip one with a prediction of 99.7% ripe, 0.3% unripe, and an unripe one with a prediction of 1.4% ripe, 98.6% unripe](../../../images/strawberries-ripe-vs-unripe-predictions.png)
ML models don't give a binary answer, instead they give probabilities. For example, a model may be given a picture of a strawberry and predict `ripe` at 99.7% and `unripe` at 0.3%. Your code would then pick the best prediction and decide the strawberry is ripe.
The ML model used to detect images like this is called an *image classifier* - it is given labelled images, and then classifies new images based off these labels.
## Train an image classifier
To successfully train an image classifier you need millions of images. As it turns out, once you have an image classifier trained on millions or billions of assorted images, you can re-use it and re-train it for just a small set of images and get great results, using a process called transfer learning.
Once an image classifier has been trained for a wide variety of images, it's internals are great at recognizing shapes, colors and patterns. Transfer learning allows the model to take what it has already learned in recognizing image parts, and use that to recognize new images.
![Once you can recognize shapes, they can be put into different configurations to make a boat or a cat](../../../images/shapes-to-images.png)
You can think of this as a bit like children's shape books, where once you can recognize a semi-circle, a rectangle and a triangle, you can recognize a sailboat or a cat depending on the configuration of these shapes. The image classifier can recognize the shapes, and the transfer learning teaches it what combination makes a boat or a cat - or a ripe strawberry.
There are a wide range of tools that can help you do this, including cloud-based services that can help you train your model, then use it via web APIs.
> 💁 Training these models takes a lot of computer power, usually via Graphics Processing Units, or GPUs. The same specialized hardware that makes graphics on your Xbox look amazing can also be used to train machine learning models. By using the cloud you have access to the power you need, just for the time you need it.
### Task - create a cognitive services resource
### Task - create an image classifier project
### Task - train your image classifier project
## Test your image classifier
## Thing 1
### Task - test your image classifier
---

Binary file not shown.

@ -0,0 +1 @@
<svg xmlns="http://www.w3.org/2000/svg" data-name="Layer 1" viewBox="0 0 96 116.8875" x="0px" y="0px"><title>18</title><path d="M97.28,40.76A31.82,31.82,0,0,0,77.71,17.64c-1.4.77-4.47,2.39-7.48,3.64a15.14,15.14,0,0,1-7.81,1,18.06,18.06,0,0,0,2.17,2.18c2.15,2,2.8,6.45,2.8,6.45a20.36,20.36,0,0,1-2.3.45c-7.63.34-17.59-5.15-17.59-5.15-2.15-.11-6.28,1.64-9.68,3.11s-10.65,2-10.65,2A34.79,34.79,0,0,1,30,25.59C31.76,22.87,34,19.81,34,19.81c-2.5-1.09-4.93-3.91-6.09-5.39C8.43,20.62-2.47,42.28,3.75,62.49a48.65,48.65,0,0,0,52,34C91.82,92.46,100.84,56.46,97.28,40.76Z" transform="translate(-2 -3.24)"/><path d="M40.05,18.67C37.93,20.38,32.66,27,32.66,27s4.75-1.44,6.25-2.14c6-2.76,9.64-2.66,9.64-2.66a62.36,62.36,0,0,0,13.63,5.2c-.67-2.17-2.1-1.76-4-6.09-1.06-2.41,1.48-2.06,5.58-2.11C70.26,19.1,79,12.8,79,12.8c-3.24-.87-9.09,3.14-13.09,3a67.33,67.33,0,0,1-10.25-1.61c-2.67-1.35-2-6.31-1.43-8.7A1.74,1.74,0,0,0,53,3.42a8.21,8.21,0,0,0-3.26,0,1.63,1.63,0,0,0-.85.42C45.68,7,46.38,13.3,46.38,13.3a4,4,0,0,0,3.71,3.62c3.4.26,4.42-.85,4.42-.85s-1.77,3.46-7,2c-2-.56-3.21-2.36-3.93-4.47L40.37,14c-6.34-.44-12.43-8.1-12.43-8.1A17.59,17.59,0,0,0,40.05,18.67Z" transform="translate(-2 -3.24)"/><text x="0" y="108.51" fill="#000000" font-size="5px" font-weight="bold" font-family="'Helvetica Neue', Helvetica, Arial-Unicode, Arial, Sans-serif">Created by parkjisun</text><text x="0" y="113.51" fill="#000000" font-size="5px" font-weight="bold" font-family="'Helvetica Neue', Helvetica, Arial-Unicode, Arial, Sans-serif">from the Noun Project</text></svg>

After

Width:  |  Height:  |  Size: 1.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 42 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 27 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 461 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 34 KiB

Loading…
Cancel
Save