Upgrade to Pro — share decks privately, control downloads, hide ads and more …

Machine Learning ❤️ Google

Machine Learning ❤️ Google

I gave this talk on how to get started with Machine Learning with Google products like TensorFlow and the Vision API on DevFest Paraná (29/11), Belo Horizonte (05/11) and São Paulo (12/11).

Maria Clara Santana

November 12, 2016
Tweet

More Decks by Maria Clara Santana

Other Decks in Programming

Transcript

  1. Como escrever um código para diferenciar uma de uma ?

    (aka hello world de machine learning)
  2. > tweet.json { "document":{ "type":"PLAIN_TEXT", "content":"Want to recover a locked

    AppleID and then Apple asks if I want to have an unlock email sent to the locked AppleID. Fuck logic." } }
  3. { "documentSentiment": { "polarity": -1, "magnitude": 1.4 }, "language": "en"

    } $ curl -s -X POST -H "Content-Type: application/json" --data- binary @tweet.json https://language.googleapis.com/v1beta1/ documents:analyzeSentiment?key=${NL_API_KEY}
  4. { "entities": [ { "name": "Apple", "type": "ORGANIZATION", "metadata": {

    "wikipedia_url": "https://en.wikipedia.org/wiki/ Apple_Inc." }, "salience": 0.18, }, ... ] } $ curl -s -X POST -H "Content-Type: application/json" --data- binary @tweet.json https://language.googleapis.com/v1beta1/ documents:analyzeEntities?key=${NL_API_KEY}
  5. > tweet.json { "document":{ "type":"PLAIN_TEXT", "content":"Want to recover a locked

    AppleID and then Apple asks if I want to have an unlock email sent to the locked AppleID. Fuck logic." }, "features":{ "extractSyntax":true } }
  6. $ curl -s -X POST -H "Content-Type: application/json" --data- binary

    @request.json https://language.googleapis.com/v1beta1/ documents:annotateText?key=${NL_API_KEY}
  7. > audio.json { "config": { "encoding":"FLAC", "sample_rate": 16000, "language_code": "en-US"

    }, "audio": { "uri":"gs://cloud-samples-tests/speech/brooklyn.flac" } } Áudio: http://bit.ly/2eSp4Z6
  8. $ curl -s -X POST -H "Content-Type: application/json" --data- binary

    @audio.json "https://speech.googleapis.com/v1beta1/ speech:syncrecognize?key=${SPEECH_API_KEY}" { "results": [ { "alternatives": [ { "transcript": "how old is the Brooklyn Bridge", "confidence": 0.98267895 } ] } ] }
  9. Transfer Learning / Inductive Learning + Inception V3 API Leitura

    adicional: https://arxiv.org/abs/1512.00567
  10. % cd $HOME % mkdir tf_files % cd tf_files %

    curl -O http://download.tensorflow.org/example_images/ flower_photos.tgz % tar xzf flower_photos.tgz % docker run -it -v $HOME/tf_files:/tf_files gcr.io/tensorflow/ tensorflow:latest-devel # cd /tensorflow # git pull
  11. # python tensorflow/examples/image_retraining/retrain.py \ --bottleneck_dir=/tf_files/bottlenecks \ --how_many_training_steps 500 \ --model_dir=/tf_files/inception

    \ --output_graph=/tf_files/retrained_graph.pb \ --output_labels=/tf_files/retrained_labels.txt \ --image_dir /tf_files/flowers_photos
  12. % cd $HOME/tf_files % curl -L https://goo.gl/tx3dqg > $HOME/tf_files/label_image.py %

    docker run -it -v $HOME/tf_files:/tf_files gcr.io/ tensorflow/tensorflow:latest-devel% mkdir paintings % python /tf_files/label_image.py /tf_files/flower_photos/ daisy/21652746_cc379e0eea_m.jpg daisy (score = 0.99071) sunflowers (score = 0.00595) dandelion (score = 0.00252) roses (score = 0.00049) tulips (score = 0.00032)