guokeli / gcp_class

Google Cloud AI人工智慧與機器學習應用班

Home Page:https://ojt.wda.gov.tw/ClassSearch/Detail?OCID=123280&plantype=1

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

gcp_class

I. 高雄市資訊培育協會: Google Cloud AI人工智慧與機器學習應用班

課程

Python 開發環境建置及 Google Cloud SDK

    mklink "C:\ProgramData\Anaconda3\DLLs\libcrypto-1_1-x64.dll" "C:\ProgramData\Anaconda3\Library\bin\libcrypto-1_1-x64.dll"
    mklink "C:\ProgramData\Anaconda3\DLLs\libssl-1_1-x64.dll" "C:\ProgramData\Anaconda3\Library\bin\libssl-1_1-x64.dll"

Day 5

Tensorflow: 文字辨識、車牌辨識應用

Serverless Computing

  • 底下實驗包含:
    • Google Cloud Functions
    • Google Cloud Pub/Sub
    • Google Cloud Storage
    • Google Cloud Translation API
    • Google Cloud Vision API

  • Running train.py
    • python train.py # 產出2個檔案 - fashion_mnist_weights_new.index - fashion_mnist_weights.data-00000-of-00001
    • copy two files to gs://your-bucket/tensorflow/ with test.png
  • Deploy by command Line (在 Console 中執行)
git clone https://github.com/ryfeus/gcf-packs
cd gcf-packs/tensorflow2.0/example/
# modeify bucket name in main.py
gcloud functions deploy handler --runtime python37 --trigger-http --memory 2048
gcloud functions call handler

Main Lab (Notebook)

Example Usage:
python detect.py text ./resources/wakeupcat.jpg
python detect.py labels ./resources/landmark.jpg
python detect.py web ./resources/landmark.jpg
python detect.py web-uri http://wheresgus.com/dog.JPG
python detect.py web-geo ./resources/city.jpg
python detect.py faces-uri gs://your-bucket/file.jpg
python detect.py ocr-uri gs://python-docs-samples-tests/HodgeConj.pdf gs://BUCKET_NAME/PREFIX/
python detect.py object-localization ./resources/puppies.jpg
python detect.py object-localization-uri gs://...
For more information, the documentation at
https://cloud.google.com/vision/docs.
# Google Cloud vision API using Tensorflow examples and documents
git clone https://github.com/GoogleCloudPlatform/python-docs-samples.git

實戰演練

  • Q1: 把 image 存下來, 試著放至 storage, 然後傳下來至個人電腦

說明:

已經設置安裝好的 VM 想要保留下來,參照第一天的實作,建立 image, 然後傳到 storage bucket,

接著在Local端以 gsutil 指令下載, 最後記得把 bucket 中的 image 及 vm中建立的 image 刪除

  • Q2: face recognition 專案, 可以把它做成第四天實作的第一個 Flask 網頁程式嗎?

  • Q3: 可以把 GCP VM 的 X11 Display 打開, 以 vnc viewer 在 Local 端顯示嗎?

參考

Day 4

Tensorflow: 環境建置、人臉辨識應用

Face recognition 環境建置

或是:

sudo apt-get update
sudo apt-get install build-essential cmake
sudo apt-get install libopenblas-dev liblapack-dev 
sudo apt-get install libx11-dev libgtk-3-dev
sudo apt-get install python python-dev python-pip
sudo apt-get install python3 python3-dev python3-pip
pip install numpy
pip install dlib
sudo apt-get update
sudo apt-get install virtualenv git
virtualenv cv -p python3
source cv/bin/activate
pip install -r requirements.txt
pip install imutils
sudo apt-get install libsm6
sudo apt-get install libxrender1
sudo apt-get install libxext-dev
git clone https://github.com/nikitaa30/Face-Recognition
git clone https://github.com/ageitgey/face_recognition.git
python Face-Recognition/encode_faces.py --dataset Dataset --encodings encodings.pickle
python Face-Recognition/recognize_faces_image.py --encodings encodings.pickle --image examples/example_01.png

setup tensorflow in gcp vm

  • STEP1. 建立 VM, 2CPU, 8GB RAM, Debian
  • STEP2. 下載並安裝 putty 終端機
  • STEP3. 檢視 並複製 SSH之 gcloud指令 SSH
  • STEP4. 開啟 cmd 視窗,執行剛剛複製之 gcloud 指令 (已事先安裝 GCP SDK,見上方說明)
  • STEP5. 進入終端機後安裝環境:
sudo apt-get update
sudo apt-get install python3
sudo apt-get install python3-pip
sudo pip3 install tensorflow==2.0.0.b1

Tensorflow code

Hello World!
code1: {coma-test.py},
code2: {nHello.py}
# tensorflow 1.x
import tensorflow as tf
msg = tf.constant('Hello, TensorFlow!')
sess = tf.Session()
print(sess.run(msg))
##
# tensorflow 2.x
import tensorflow as tf
msg = tf.constant('Hello, TensorFlow!')
tf.print(msg)

Lab

ln -fs /opt/graph_def/ssd_mobilenet_v1_coco_11_06_2017/frozen_inference_graph.pb /opt/graph_def/frozen_inference_graph.pb
systemctl restart object-detection
systemctl status object-detection

Book

參考

Day 3

參考:

Day 2

定價

Day1

書籍

參考連結

Google CodeLab

About

Google Cloud AI人工智慧與機器學習應用班

https://ojt.wda.gov.tw/ClassSearch/Detail?OCID=123280&plantype=1


Languages

Language:Python 70.0%Language:C++ 28.5%Language:C 0.8%Language:Jupyter Notebook 0.7%Language:JavaScript 0.0%Language:CSS 0.0%Language:Shell 0.0%Language:HTML 0.0%Language:CMake 0.0%