Presentacion Python Pueacademy
Presentacion Python Pueacademy
15:35 a 16:45h
[email protected]
@jordiAS2K
Introducción
To do Doing Done
Agenda
1.- Introducción
2.- Python en la actualidad
3.- CNA: Portfolio educativo
4.- PCAP: Programming Essentials in Python
5.- PCAP: Demo del curso
6.- Hands-On Labs
Introducción
Exam block #2
Data Aggregates (25%)
Exam block #3
Functions and Modules (25%)
Exam block #4
Classes, Objects and Exceptions (25%)
Introducción
What snippet would you insert in the line indicated below:
A. print(n)
B. print(n, sep=" ")
C. print(n, end=" ")
D. print(n, " ")
Introducción
IoT Fundamentals:
Connecting Things, Big Data & Analytics, IoT
IoT y análisis Introduction to IoT
Security*
Hackathon Playbook
IoT Fundamentals:
Connecting Things, Big Data & Analytics, IoT
IoT y análisis Introduction to IoT
Security*
Hackathon Playbook
Beneficios
Con PCAP: Programming Essentials in Python, aprenderá a diseñar,
escribir, depurar y ejecutar programas codificados en el lenguaje Coordinado con
Python. No se requiere ningún conocimiento previo de programación. la certificación
El curso comienza con una orientación básica paso a paso hasta que Características
se vuelva experto en resolver problemas más complejos.
Público objetivo: estudiantes de secundaria y terciarios
Requisitos previos: ninguno
Componentes educativos
Requiere capacitación a cargo de instructor: no
• 5 módulos de contenido instructivo interactivo Idiomas: inglés
• Más de 30 prácticas de laboratorio incluidas Presentación del curso: con instructor
• Herramienta en línea integrada para realizar prácticas de laboratorio Tiempo estimado para completar el curso: 60 a 70 horas
• Quizzes y Tests de evaluación por módulo y sección Próximo curso recomendado: IoT Fundamentals, Networking
Essentials, NDG Linux Essentials
• Test de evaluación final
36
Programming Essentials in Python
Course Syllabus
El curso está formado por 5 módulos con contenido
interactivo, distribuidos en dos partes o secciones
(Basics e Intermediate).
Introduction
Module 0
Part I: Basics
Module 1: Basics I
Module 2: Basics II
Module 3: Basics II
https://edube.org/sandbox?language=python
Programming Essentials in Python
Edube Labs
El curso contiene más de 30 prácticas o laboratorios
con soluciones incluidas.
Programming Essentials in Python
Modelo de evaluación
El curso contiene una serie de quizzes de preparación
y tests de evaluación para cada módulo y sección.
https://pypi.org/project/opencv-contrib-python/
load_image.py
Hands-On Labs # Import the necessary packages
import argparse
import cv2
# Configure windows
windowName = "Image Visualizer"
if (args["full"]):
cv2.namedWindow(windowName, cv2.WND_PROP_FULLSCREEN)
cv2.setWindowProperty(windowName, cv2.WND_PROP_FULLSCREEN,
cv2.WINDOW_FULLSCREEN)
# Configure windows
windowName = "Video Visualizer"
if (args["full"]):
cv2.namedWindow(windowName, cv2.WND_PROP_FULLSCREEN)
cv2.setWindowProperty(windowName, cv2.WND_PROP_FULLSCREEN,
cv2.WINDOW_FULLSCREEN)
# Configure windows
windowName = "Webcam Visualizer"
if (args["full"]):
cv2.namedWindow(windowName, cv2.WND_PROP_FULLSCREEN)
cv2.setWindowProperty(windowName, cv2.WND_PROP_FULLSCREEN,
cv2.WINDOW_FULLSCREEN)
# Configure windows
windowName = "Webcam Visualizer"
if (args["full"]):
cv2.namedWindow(windowName, cv2.WND_PROP_FULLSCREEN)
cv2.setWindowProperty(windowName, cv2.WND_PROP_FULLSCREEN,
cv2.WINDOW_FULLSCREEN)
# Configure windows
windowName = "Faces Detector"
if (args["full"]):
cv2.namedWindow(windowName, cv2.WND_PROP_FULLSCREEN)
cv2.setWindowProperty(windowName, cv2.WND_PROP_FULLSCREEN,
cv2.WINDOW_FULLSCREEN)
# Configure windows
windowName = "Cats Detector"
if (args["full"]):
cv2.namedWindow(windowName, cv2.WND_PROP_FULLSCREEN)
cv2.setWindowProperty(windowName, cv2.WND_PROP_FULLSCREEN,
cv2.WINDOW_FULLSCREEN)
# loop over the cat faces and draw a rectangle surrounding each
for (i, (x, y, w, h)) in enumerate(cats):
cv2.rectangle(image, pt1 = (x, y), pt2 = (x + w, y + h), …)
cv2.putText(image, text = f"Face #{i}", org = (x, y - 10), …)
# Configure windows
windowName = "Video: Cam Detector“
if (args["full"]):
cv2.namedWindow(windowName, cv2.WND_PROP_FULLSCREEN)
cv2.setWindowProperty(windowName, cv2.WND_PROP_FULLSCREEN,
cv2.WINDOW_FULLSCREEN)
# Configure windows
windowName = "Webcam: Face Detector"
if (args["full"]):
cv2.namedWindow(windowName, cv2.WND_PROP_FULLSCREEN)
cv2.setWindowProperty(windowName, cv2.WND_PROP_FULLSCREEN,
cv2.WINDOW_FULLSCREEN)
# Configure windows
windowName = "Eyes Tracking"
if (args["full"]):
cv2.namedWindow(windowName, cv2.WND_PROP_FULLSCREEN)
cv2.setWindowProperty(windowName, cv2.WND_PROP_FULLSCREEN,
cv2.WINDOW_FULLSCREEN)
eyes_tracking.py
Hands-On Labs # If --video is not supplied we will read video from the webcam.
# Otherwise, open the video file pointed by the --video argument
if (args["video"]):
video = cv2.VideoCapture(args["video"])
else:
video = cv2.VideoCapture(0)
# In order to build face and eyes recognition system, we use the built-
in Haar cascade classifiers in OpenCV.
facesClassifier = cv2.CascadeClassifier(args["fclassifier"])
eyesClassifier = cv2.CascadeClassifier(args["eclassifier"])
# Configure windows
windowName = "Object Tracking"
if (args["full"]):
cv2.namedWindow(windowName, cv2.WND_PROP_FULLSCREEN)
cv2.setWindowProperty(windowName, cv2.WND_PROP_FULLSCREEN,
cv2.WINDOW_FULLSCREEN)
obj_tracking.py
Hands-On Labs # The object that will be tracking is a "yellow" object.
colorLower = (20, 100, 100)
colorUpper = (30, 255, 255)
cv2.imshow(windowName, frame)
# Configure windows
windowName = "Multi Tracking"
if (args["full"]):
cv2.namedWindow(windowName, cv2.WND_PROP_FULLSCREEN)
cv2.setWindowProperty(windowName, cv2.WND_PROP_FULLSCREEN,
cv2.WINDOW_FULLSCREEN)
multi_object_tracking.py
Hands-On Labs # Initialize a dictionary that maps strings to their corresponding
# OpenCV object tracker implementations
# I recommend the following three algorithms:
# KCF: Fast and accurate
# CSRT: More accurate than KCF but slower
# MOSSE: Extremely fast but not as accurate as either KCF or CSRT
OPENCV_OBJECT_TRACKERS = {
"csrt": cv2.TrackerCSRT_create,
"kcf": cv2.TrackerKCF_create,
"boosting": cv2.TrackerBoosting_create,
"mil": cv2.TrackerMIL_create,
"tld": cv2.TrackerTLD_create,
"medianflow": cv2.TrackerMedianFlow_create,
"mosse": cv2.TrackerMOSSE_create
}
# grab the updated bounding box coordinates (if any) for each
# object that is being tracked
# The update method will locate the object’s new position and
# return a success boolean
# and the bounding box of the object.
(success, boxes) = trackers.update(frame)
# loop over the bounding boxes and draw then on the frame
for box in boxes:
(x, y, w, h) = [int(v) for v in box]
cv2.rectangle(frame, (x, y), (x + w, y + h), (0, 255, 0), 2)
# create a new object tracker for the bounding box and add it
# to our multi-object tracker
tracker = OPENCV_OBJECT_TRACKERS[args["tracker"]]()
trackers.add(tracker, frame, box)
video.release()
https://pypi.org/project/google-cloud-vision/
Hands-On Labs > pip list
Package Version
------------------------ --------
cachetools 3.1.0
certifi 2019.3.9
chardet 3.0.4
google-api-core 1.9.0
google-auth 1.6.3
google-cloud-vision 0.36.0
googleapis-common-protos 1.5.9
grpcio 1.20.1
idna 2.8
numpy 1.16.3
opencv-contrib-python 4.1.0.25
pip 19.1
protobuf 3.7.1
pyasn1 0.4.5
pyasn1-modules 0.2.5
pytz 2019.1
requests 2.21.0
…
https://pypi.org/project/google-cloud-vision/
logo_detection.py
Hands-On Labs # Import the necessary packages
import io
import os
from google.cloud import vision
from google.cloud.vision import types
import argparse
{
mid: "/m/045c7b"
description: "google"
score: 0.9927250146865845
bounding_poly {
vertices {
}
vertices {
x: 759
}
vertices {
x: 759
y: 439
}
vertices {
y: 439
}
}
}
logo_detection.py
Hands-On Labs
logo_detection.py
Hands-On Labs
Number of logos found: 1
------------------------------
Logo: mcdonalds
Score: 0.9921749830245972
------------------------------
{
mid: "/m/07gyp7"
description: "mcdonalds"
score: 0.9921749830245972
bounding_poly {
vertices {
}
vertices {
x: 923
}
vertices {
x: 923
y: 600
}
vertices {
y: 600
}
}
}
object_detection.py
Hands-On Labs # Import the necessary packages
import io
import os
from google.cloud import vision
from google.cloud.vision import types
import argparse
-------------------------------------------------
Description: Plaza de Cibeles
Score: 0.9911772012710571
-------------------------------------------------
landmark_detection.py
Hands-On Labs
-------------------------------------------------
Description: Puerta del Sol, Post Office
Score: 0.5609591007232666
-------------------------------------------------
¡Muchas gracias!
To do Doing Done
[email protected]
@jordiAS2K
#PUEAcademyDay19
¿Alguna pregunta?
www.pue.es/cisco
[email protected]
#PUEAcademyDay19