micbelgique / BigData-ArtificialIntelligence-101

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

BigData-ArtificialIntelligence-101

Create your Model

Custom Vision

First, you will need to go on this link to activate your Azure subscription as a student. After it, go on Azure portal. When you are on the portal, create a ressource named Custom Vision. You can find it like this Custom Vision When your ressource is created, go on Custom Vision Portal. On the portal, you can create a new project and select what correspond better to your idea( no idea, you can find datasets on ImageNet. Create project

You will normally arrive on a project where there's no pictures so you will need to create your own dataset. Pay attention on pictures you select and don't forget to retrieve testing part inside the dataset. It's recommanded to have at least 50 pictures for each tags. When you have your dataset, you can begin to upload your pictures. When they are uploaded, you will need to tag them. Pay attention when you tag them because it's the most important part for your model ! Tagging When you have enough pictures uploaded and tagged, you will need to train your model. To train it, you will need to go inside the train part. For purpose, here we will only use quick training. Choosing training

As you launch a quick training, the performance part will open and you will see the model beeing trainder. When it's over, you will receive the result of your model. Get your result

You can test it by clicking on quick test and put your image there. If the result are not quite good. You can add more picture and tag them and make another training. Do that until you have the result you want. After it, you can publish your model by clicking on publish inside the performance tab. You can choose the name used to publish it. After that, you can try it by using postman and making a request on it. Use data in postman

Angular project

When your model is published, you can try to use it inside an angular app. You don't know Angular? No problem! You will see everything is needed here. First, you will open the folder CustomVisionTool inside VS Code and you will open the terminal inside it too. You will enter

npm install

When it's finished, you will go inside the terminal and you will create a service named Prediction like this: Prediction service

After it, you will go inside the new file created and declare the httpClient inside the constructor to have acces to it:µ Declare HttpClient

You will need an httpHeaders too so you will do the same and declare it: Declare HttpHeaders

When it's done, you will just make http request to your publish model. You can make 4 types of requests on it. The first one is Predict Image. You will send a picture inside a blob container and it will read it like this: Predict Image

If you don't want to have inside predictions tab inside your portal you predicted pictures and for GDPR problems, you can use th Predict Image with No Store: Predict Image WIth No Store

Instead of using blob container and you have an url picture, you can use Predict Image Url: Predict Image Url

If you want like Predict Image with no Store for url, it's possible and it's like this: Prdict Url with No Store

After this, you will need to go insde the Detector folder and detector.component.ts and add Predction service inside the constructor like this: Add inside constructor

You will need to find the //PUT YOUR CODE HERE inside the same file, when you find it, you will need to add this code to declare the prediction: Declare prediction

When your Prediction is created, you will need to subscribe to it to get the result from the model API: Get the result

For each prediction upside of 60%, we want to show it so we need to draw it like this: Draw the result

And now, you can put your prediction URL and your key from the portal there: Put prediction endpoint

After this, you can put inside the terminal npm start and you can go on localhost:4200 to try your model!

GO further

Already finished? You can try to make an AI Solution Architecture from this Azure Getting Started.

About

License:MIT License


Languages

Language:TypeScript 80.0%Language:HTML 8.2%Language:JavaScript 7.4%Language:CSS 4.4%