0% found this document useful (0 votes)
71 views60 pages

AI On Azure Custom Vision and Cognitive Services

Here are the steps to create a basic Flask app: 1. Create a file called app.py 2. Import Flask 3. Create a Flask object called app 4. Define a route using the @app.route decorator 5. Return a string or render a template 6. Run the app Let me know if any part needs more explanation!

Uploaded by

swapnilr85
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
71 views60 pages

AI On Azure Custom Vision and Cognitive Services

Here are the steps to create a basic Flask app: 1. Create a file called app.py 2. Import Flask 3. Create a Flask object called app 4. Define a route using the @app.route decorator 5. Return a string or render a template 6. Run the app Let me know if any part needs more explanation!

Uploaded by

swapnilr85
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
You are on page 1/ 60

Azure Masterclass: Machine Learning

and Artificial Intelligence


@bethanyjep
Classify Images with the
Custom Vision Service
Click icon to add picture
Complete interactive learning exercises,
watch videos, and practice and apply
your new skills.
Live & interactive
Say “hi” and ask questions in the
chat
Learning  Learn how to use the Custom Vision service to create
an image classification solution.
objectives
 Introduction
 Understand classification

Agenda  Get started with image classification on Azure


 Exercise - Explore image classification
 Knowledge check
Introduction
Uses of image classification
 Some potential uses for image classification include:
• Product identification: performing visual searches for specific products in online searches or even,
in-store using a mobile device.
• Disaster investigation: identifying key infrastructure for major disaster preparation efforts. For
example, identifying bridges and roads in aerial images can help disaster relief teams plan ahead in
regions that are not well mapped.
• Medical diagnosis: evaluating images from X-ray or MRI devices could quickly classify specific
issues found as cancerous tumors, or many other medical conditions related to medical imaging
diagnosis.
Understand classification
Understand classification
 You can use a machine learning classification technique to predict
which category, or class, something belongs to.
Understand image classification
 Image classification is a machine learning technique in which the
object being classified is an image, such as a photograph.
Azure's Custom Vision service
 Most modern image classification solutions are based on deep
learning techniques that make use of convolutional neural networks
(CNNs) to uncover patterns in the pixels that correspond to
particular classes.
Get started with image classification on
Azure
Azure resources for Custom Vision

 Creating an image classification solution with Custom Vision consists


of two main tasks.

• Custom Vision: A dedicated resource for the custom vision service, which can be training,
a prediction, or both resources.
• Cognitive Services: A general cognitive services resource that includes Custom Vision
along with many other cognitive services. You can use this type of resource for training,
prediction, or both.
Model training
 To train a classification model, you must upload images to your
training resource and label them with the appropriate class labels.
Model evaluation
 Model training process is an iterative process in which the Custom
Vision service repeatedly trains the model using some of the data,
but holds some back to evaluate the model.
• Precision: What percentage of the class predictions made by the model were correct? For example,
if the model predicted that 10 images are oranges, of which eight were actually oranges, then the
precision is 0.8 (80%).
• Recall: What percentage of class predictions did the model correctly identify? For example, if there
are 10 images of apples, and the model found 7 of them, then the recall is 0.7 (70%).
• Average Precision (AP): An overall metric that takes into account both precision and recall).
Using the model for prediction
 After you've trained the model, and you're satisfied with its
evaluated performance, you can publish the model to your
prediction resource.
• Project ID: The unique ID of the Custom Vision project you created to train the model.
• Model name: The name you assigned to the model during publishing.
• Prediction endpoint: The HTTP address of the endpoints for the prediction resource to which you
published the model (not the training resource).
• Prediction key: The authentication key for the prediction resource to which you published the model
(not the training resource).
Demo
Classify Cats and Dogs
Knowledge check
You plan to use the Custom Vision service to train an image
classification model. You want to create a resource that can only
be used for model training, and not for prediction. Which kind of
resource should you create in your Azure subscription?

A. Custom Vision

Question 1 B. Cognitive Services


Type your answer in the chat
C. Computer Vision
You plan to use the Custom Vision service to train an image
classification model. You want to create a resource that can only be
used for model training, and not for prediction. Which kind of
resource should you create in your Azure subscription?

A. Custom Vision

Question 1 B. Cognitive Services


And the answer is….. C. Computer Vision
You train an image classification model that achieves less
than satisfactory evaluation metrics. How might you improve
it?

A. Reduce the size of the images used to train the model.

Question 2 B. Add a new label for "unknown" classes.

Type the answer in the chat C. Add more images to the training set.
You train an image classification model that achieves less
than satisfactory evaluation metrics. How might you improve
it?

A. Reduce the size of the images used to train the model.

Question 2 B. Add a new label for "unknown" classes.

And the answer is…


C. Add more images to the training set.
Summary
Summary
 The Custom Vision service simplifies the process for creating custom
image classification models and deploying AI solutions.
Clean-up
 It's a good idea at the end of a project to identify whether you still
need the resources you created.
• In the Azure portal, in the Resource groups page, open the resource group you specified when
creating your resource.
• Click Delete resource group, type the resource group name to confirm you want to delete it, and
select Delete. You can also choose to delete individual resources by selecting the resource(s),
clicking on the three dots to see more options, and clicking Delete.
Break and/or questions
Build an AI web app by
using Python and Flask

Click icon to add picture


Complete interactive learning exercises,
watch videos, and practice and apply
your new skills.
 An Azure account. Learn how to create a free account
Prerequisites in Create an Azure account.
 GitHub Account
 Learn how to set up a Flask development environment
Learning  Learn how to use Flask to build a form

objectives  Learn how to use the Translator service to translate


text
 Introduction
 Exercise - Set up a development environment

Agenda  Flask fundamentals


 Exercise - Create an app
 Translation
Agenda  Exercise - Create Translator service
 Exercise - Call Translator service
continued  Summary
 Install Visual Studio Code
Set up a local  Install Python

development  Create the project directory


 Create a Python virtual environment
environment  Install Flask and other libraries
Set up a
GitHub account  Github Account
 Fork the Repository
to use GitHub  Create codespaces

Codespaces
Flask fundamentals
Flask fundamentals
 Flask is an open-source web "micro-framework".
Responding to user requests with routes
 When a user uses a web application, they indicate what they want to
do, or the information they're seeking, by browsing to different
uniform resource locators (or URLs).
• https://adventure-works.com/ for the main page
• https://adventure-works.com/products/widget for details on a Widget
• https://adventure-works.com/cart/buy to complete a purchase
Methods or verbs
 Routes can be accessed in many ways, through what are known as
methods or verbs (the two terms mean the same thing and can be
used interchangeably).

• The user accesses the sign-up form via GET


Note: Regardless of the verb • The user completes the form and selects the
submit button
used, information can always • The information from the form is sent back to
be returned to the user. the server by using POST
• A "success" message is returned to the user
Templates
Hypertext Markup Language, or HTML, is the language used to structure the information
displayed on a browser, while Cascading Style Sheets, or CSS, is used to manage the style and
layout.

HTML

<h1>Welcome, {{ name }}</h1>


Knowledge check
Flask is a framework for building web apps in which of the
following languages?

A. Python and Node.js

B. Python and Java

Question 1 C. Python only

Vote at <LINK>
Flask is a framework for building web apps in which of the
following languages?

A. Python and Node.js

B. Python and Java

Question 1 C. Python only

Vote at <LINK>
Exercise
Create an app
 Create core application
 Add the route
Create an app  Create the HTML template for our form
 Test the application
Knowledge check
What is the default port number that Flask uses to service
HTTP requests?

A. 80

B. 5000

Question 2 C. 8080

Vote at <LINK>
What is the default port number that Flask uses to service
HTTP requests?

A. 80

B. 5000

Question 2 C. 8080

Vote at <LINK>
Translation
Translation
 While solutions using machine learning or artificial intelligence have
become increasingly common, they can still be difficult to create
from scratch.
Translator service
 Translator service, part of Cognitive Services, will translate to and
from dozens of languages.
Key management
 To call Translator service (or any other Cognitive Service), we'll need
a key.
Exercise
Create Translator service
Create  Get Translator service key

Translator  Create .env file to store the key


 Next steps
service
Exercise
Call Translator service
 Add code to call the service
Call Translator  Create the template to display results

service  Test the page


 Congratulations
Knowledge check
What is the name of the HTTP header that carries API keys in
calls to Azure Cognitive Services?

A. Ocp-Apim-Cognitive-Key

B. Ocp-Apim-Subscription-Key

Question 4 C. Ocp-Apim-Auth-Key

Vote at <LINK>
What is the name of the HTTP header that carries API keys in
calls to Azure Cognitive Services?

A. Ocp-Apim-Cognitive-Key

B. Ocp-Apim-Subscription-Key

Question 4 C. Ocp-Apim-Auth-Key

Vote at <LINK>
Summary
Summary
 In this module, you learned the core concepts of building websites in
Python by using the Flask framework.
@bethanyjep

Thank you.

© Copyright Microsoft Corporation. All rights reserved.

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy