Slide 1

Slide 1 text

Making PHP see By Thijs Feryn using the Google Cloud Vision API

Slide 2

Slide 2 text

Inspired by a presentation by Peter Gasston @stopsatgreen

Slide 3

Slide 3 text

OK Computer

Slide 4

Slide 4 text

The commoditization of artificial intelligence

Slide 5

Slide 5 text

Artificial intelligence is getting very good, very quickly

Slide 6

Slide 6 text

Algorithms have been available for a while

Slide 7

Slide 7 text

But now the computational resources are readily available

Slide 8

Slide 8 text

The Cloud

Slide 9

Slide 9 text

Speech & vision

Slide 10

Slide 10 text

Automate

Slide 11

Slide 11 text

No content

Slide 12

Slide 12 text

No content

Slide 13

Slide 13 text

Tagging Cataloging OCR …

Slide 14

Slide 14 text

https://cloud.google.com/vision/

Slide 15

Slide 15 text

Since this is a PHP meetup …

Slide 16

Slide 16 text

I wrote a wrapper in PHP

Slide 17

Slide 17 text

Hi, I’m Thijs

Slide 18

Slide 18 text

I’m @ThijsFeryn on Twitter

Slide 19

Slide 19 text

I’m an Evangelist At

Slide 20

Slide 20 text

I’m a at board member

Slide 21

Slide 21 text

https://packagist.org/ packages/thijsferyn/ google-cloud-vision-api

Slide 22

Slide 22 text

composer require thijsferyn/google- cloud-vision-api

Slide 23

Slide 23 text

No content

Slide 24

Slide 24 text

I use a lot of generators

Slide 25

Slide 25 text

And some (return) type hinting

Slide 26

Slide 26 text

Guzzle

Slide 27

Slide 27 text

✓ Label detection ✓ Text detection ✓ Face detection ✓ Landmark detection ✓ Logo detection ✓ Image properties ✓ Safe search detection Capabilities

Slide 28

Slide 28 text

Just throw images at it

Slide 29

Slide 29 text

Base64 encoded payload

Slide 30

Slide 30 text

Used this picture as an example

Slide 31

Slide 31 text

{ "responses": [ { "labelAnnotations": [ { "mid": "/m/01g317", "description": "person", "score": 0.94566113 }, { "mid": "/m/09cx8", "description": "finger", "score": 0.90582412 }, { "mid": "/m/0k65p", "description": "hand", "score": 0.80619782 }, { "mid": "/m/0dzf4", "description": "arm", "score": 0.78079385 }, { "mid": "/m/01dv4h", "description": "portrait", "score": 0.71484989 }, { "mid": "/m/012t_z", "description": "businessperson", "score": 0.55623162 }, { "mid": "/m/01bmhj", "description": "thumb", "score": 0.53253812 } ] } ] }

Slide 32

Slide 32 text

addImageByUrl(‘https://pbs.twimg.com/ profile_images/638779332354265088/Nsf1xLhH.jpg'); $api->addFeature($api::FEATURE_LABEL_DETECTION,10); $result = $api->request(); foreach($result as $key=>$value) { var_dump($key,$value); }

Slide 33

Slide 33 text

$api->addImageByUrl(“http://bla.com/test.jpg”); $api->addImageByFilename(“test.jpg”); $api->addRawImage(“base64blablabla”); Register images

Slide 34

Slide 34 text

Parellel requests

Slide 35

Slide 35 text

Batch processing

Slide 36

Slide 36 text

$result = $api->request(10); Batch processing

Slide 37

Slide 37 text

Demo time

Slide 38

Slide 38 text

https://blog.feryn.eu https://talks.feryn.eu https://youtube.com/thijsferyn https://soundcloud.com/thijsferyn https://twitter.com/thijsferyn http://itunes.feryn.eu

Slide 39

Slide 39 text

No content