6. Inteligencia Artificial
¿Es un pan
o no?
if(esImagenDePerfil) {
if(esRectangular) {
if(tieneFormaCircular) {
if(tieneOrejas) {
return false;
}
else if (tieneOjos) {
return false;
}
else {
return true;
}
}
}
}
7. Machine Learning
Machine Learning es una rama de la IA que se enfoca en construir aplicaciones
que aprenden de los datos y mejoran su precisión con el paso del tiempo sin ser
explícitamente programadas para ello.
Datos históricos
Nuevos datos
Algoritmos de
Machine Learning
Modelo de
Machine Learning
Predicción de
Datos
Entrenamiento
Predicción
9. Deep Learning
Deep learning es un área del Machine Learning relacionada con algoritmos
inspirados por la estructura y función del cerebro llamada redes neuronales
artificiales.
Es excepcionalmente efectiva para descubrir patrones.
Los algoritmos aprenden a través de una jerarquía
multicapa.
Si proporcionas al sistema toneladas de información, comenzará a comprender
y responder de manera útil.
10. Deep Learning tiene un proceso de aprendizaje de características multi-
etapa incorporado que identifica representaciones jerárquicas enriquecidas
(patrones).
Low-level
features
Mid-level
features
Output (e.g. exterior,
interior)
High-level
features
Trainable
Classifier
11. Imagen
Texto
Cada módulo de Deep Learning transforma su representación de
entrada en una de nivel superior, de forma similar a la corteza cerebral
del ser humano.
Low Level
Features
Mid
Level
Features
Output
High
Level
Features
Trainable
Classifier
Input
13. Convolución
Input Image Convolved Image
(Feature Map)
a b c d
e f g h
i j k l
m n o p
w1 w2
w3 w4
Filter
h1 h2
ℎ1 = 𝑓 𝑎 ∗ 𝑤1 + 𝑏 ∗ 𝑤2 + 𝑒 ∗ 𝑤3 + 𝑓 ∗ 𝑤4
ℎ2 = 𝑓 𝑏 ∗ 𝑤1 + 𝑐 ∗ 𝑤2 + 𝑓 ∗ 𝑤3 + 𝑔 ∗ 𝑤4
14. Características: De bajo a alto nivel
Input Image
Layer 1
Feature Map
Layer 2
Feature Map
w1 w2
w3 w4
w5 w6
w7 w8
Filter 1
Filter 2
15. Pooling
Max pooling: informa la salida máxima dentro de una sección.
Average pooling: informa la salida promedio dentro de una sección.
1 3 5 3
4 2 3 1
3 1 1 3
0 1 0 4
MaxPool with 2X2 filter with
stride of 2
Input
Matrix
Output
Matrix
4 5
3 4
16. Red Neuronal de Convolución
Arquitectura de Extracción de Características
64
64
128
128
256
256
256
512
512
512
512
512
512
Filter
Max
Pool
Fully Connected
Layers
Living Room
Bed Room
Kitchen
Bathroom
Outdoor
Maxpool
Output
Vector
18. ML.NET es un framework para hacer ML a la medida
Ciclo de vida de
Machine Learning
Datos
Históricos
Prueba
& Evalua
Compila &
Entrena
Modelo
ML
Archivo
.ZIP
(Entrenado
)
Prepara Datos, Compila y Entrena un modelo de ML
ML.NET API
(Aplicación .NET de Consola, etc.)
ML.NET Model Builder
(Herramienta UI Desktop)
Tareas de ML, Transformaciones de Datos, Learners/Algoritmos
ML.NET API
(Aplicación .NET)
API para ejecutar el modelo
nuget nuget
Aplicación de Negocio
(Web/Servicio/Desktop/Móvil)
ML model
file
Aplicación .NET
Predicción: Ejecuta/consume el modelo de ML
?
Datos en
tiempo real
del usuario
ML.NET
API para consumir
el modelo
Ejecuta &
Predice
.NET
.NET
BD
Archivos CSV
etc
20. La mayoría de
escenarios
Microsoft.ML
Escenarios de predicción y
detección de anomalías
Microsoft.ML.TimeSeries
Recomendadores
Microsoft.ML.Recommender
Cargar bases de
datos
System.Data.SqlClient
Consumo de modelos
ONNX
Microsoft.ML.ONNXTransformer
Microsoft.ML.ImageAnalytics
para detección de objetos
Consumo de modelos de
TensorFlow
Microsoft.ML.TensorFlow
SciSharp.TensorFlow.Redist
Microsoft.ML.ImageAnalytics
para clasificación de imágenes
Entrenar modelos
personalizados de clasificación
de imagenes
Microsoft.ML.Vision
Microsoft.ML.ImageAnalytics
SciSharp.TensorFlow.Redist
21. MLContext
MLContext es el punto de inicio para todas las operaciones de ML.NET y
proporciona mecanismos para la creación de componentes de:
• Preparación de datos
• Ingeniería de características
• Entrenamiento
• Predicción
• Evaluación de modelos
• Bitácoras
• Control de ejecución
• Inicialización
22. Data Schema IDataView
• Es el conjunto de columnas, sus nombres, tipos y otras anotaciones.
• Antes de cargar datos, debes definir cómo se verá el esquema de datos
(nombres y tipos de columna)
• Utiliza definiciones de clase para definir esquemas IDV
Dataset
Definición de esquema de clases
IDataView
Label SepalLength SepalWidth PetalLength PetalWidth
Iris-setosa 5.1 3.5 1.4 0.2
Iris-
versicolor
7.0 3.2 4.7 1.4
Iris-setosa 4.9 3.0 1.5 0.1
…
24. Modelo de ML.NET
Un archivo zip serializado que contiene esquemas de datos, transformaciones
de datos y algoritmos.
Model
o de
ML.NE
T
MLModel.zip
Desktop
Web
Móvil
31. Main program
Loading data for
supervised learning
(images include
tags)
Training and Validation sets
Load pipeline:
Images loaded in
memory
Training options:
ImageClassificationTrainer
chosen, based on the
InceptionV3 architecture
Training pipeline:
Trying to predict a
category
Both pipelines are combined
32. Perform training
Model precision is validated using validation dataset
Model Metrics calculated
Test the classification model using the new images
Prepare new images for validation
Export the model
Consume the model
33. ConsumingModel
Load a previously trained
classification model and prepare
test images that were not used
before in the training and
validation stages
ClassifyImages: Test the model with new
images
40. Unable to find an entry point named 'TF_StringEncodedSize' in DLL 'tensorflow'
“I think ml.net support tensorflow 2.3.1 not yet support 2.4,
so you must download SciSharp.TensorFlow.Redist 2.3.1”
https://github.com/dotnet/machinelearning-samples/issues/880
42. ¡Gracias por tu atención!
Luis Beltrán
Tomás Bata University in Zlín
Tecnológico Nacional de México en Celaya
About Me:
https://about.me/luis-beltran
Notas del editor
La capacidad de una computadora para realizar tareas comúnmente asociadas con seres inteligentes (razonar, descubrir significado, generalizar, aprender de experiencias pasadas).
Normalmente comienza como un sistema basado en reglas o lógica.
Las técnicas tradicionales de IA pueden ser difíciles de escalar.
Low-level features are minor details of the image, like lines or dots, that can be picked up by, say, a convolutional filter (for really low-level things) or (for more abstract things like edges). High-level features are built on top of low-level features to detect objects and larger shapes in the image.
Convolutional neural networks use both types of features: the first couple convolutional layers will learn filters for finding lines, dots, curves etc. while the later layers will learn to recognize common objects and shapes.
Convolution is a general purpose filter effect for images
In Convolutional Neural Networks, Filters detect spatial patterns such as edges in an image by detecting the changes in intensity values of the image.
In terms of an image, a high-frequency image is the one where the intensity of the pixels changes by a large amount, whereas a low-frequency image is the one where the intensity is almost uniform. Usually, an image has both high and low frequency components. The high-frequency components correspond to the edges of an object because at the edges the rate of change of intensity of pixel values is high.
Convolution is a simple mathematical operation which is fundamental to many common image processing operators. Convolution provides a way of `multiplying together' two arrays of numbers, generally of different sizes, but of the same dimensionality, to produce a third array of numbers of the same dimensionality.
3. Now when you apply a set of filters on top of that (pass it through the 2nd conv. layer), the output will be activations that represent higher-level features. Types of these features could be semicircles (a combination of a curve and straight edge) or squares (a combination of several straight edges). As you go through the network and go through more conv. layers, you get activation maps that represent more and more complex features.
Pooling layers provide an approach to down sampling feature maps by summarizing the presence of features in patches of the feature map. Two common pooling methods are average pooling and max pooling that summarize the average presence of a feature and the most activated presence of a feature respectively.
A pooling layer is a new layer added after the convolutional layer. Specifically, after a nonlinearity (e.g. ReLU) h