Have you ever gone on a walk and asked yourself ''what type of tree or plant are you seeing ?'' Since it is never taught in high school or primary school, most of us are ignorant whereas it could be useful when it comes to make flower gifts for instance. It would be nice if you could just take a picture of the tree and our phone would tell us what type of tree it is, wouldn't it ?

How can you create this AI?

We need to create an AI. How? Thanks to ml5.js which is a JavaScript library. This library is a beginner-friendly one which aims at teaching everyone the very basics of Artifical Intelligence. MobilNets are a class of convolutional neural network which are trained to recognize images. Then, we are going to use a specifical tool named imageClassifier and MobilNets (the tool that will help to recognize the pictures).

Here are some steps to follow to succeed

You need to create a glitch file with HTML, Javascript and CSS.
Then, you need to include the library into the code in the HTML file by writing :

First method: You don't choose the image

Then, you have to create a js.file to include the code for ml5. First, you need to create a variable that will hold the image and create an ImageClassifer. These functions will enable you to hold the image.

Now, you need to create a function that will give the result with the highest probability.



Second method: You choose the picture

If you prefer the user to drop directly his own image, then you need to use another function That is what you will have to write on the js.file:

You will also have to write this in the index.html:



And the result will be :