north americai iotskynet-v2

91
THE RISE OF THE MACHINE - IS SKYNET CLOSER THAN EVER?

Upload: steve-poole

Post on 15-Apr-2017

17 views

Category:

Software


0 download

TRANSCRIPT

Page 1: North americai iotskynet-v2

THE RISE OF THE MACHINE - IS SKYNET CLOSER THAN EVER?

Page 2: North americai iotskynet-v2

JVM Developer DevOps practitionerDeveloper AdvocateRobot BuilderIoT speculator AI explorer @spoole167

Work at IBM’s UK Researchand Development Laboratory

MeansI get to play

with cool stuff

Steve Poole : IBM

Page 3: North americai iotskynet-v2

How close are we tobuilding Skynet?

And can anyone do it?

Page 4: North americai iotskynet-v2

“Skynet is a fictional neural net-based conscious group mind and artificial general intelligence (see also superintelligence)

system that features centrally in the Terminator franchise and serves as the franchise's main antagonist.”

https://en.wikipedia.org/wiki/Skynet_(Terminator)

Page 5: North americai iotskynet-v2

We live in interesting times

Page 6: North americai iotskynet-v2

Autonomous Robots

Page 7: North americai iotskynet-v2

Meet ‘Handle’ Another Robot from Boston Dynamics

http://www.bostondynamics.com/

Handle is 6.5 feet tall, can jump 4 feet and travels at speeds of up to 9 mph. and can travel up to 15 miles between charges

Page 8: North americai iotskynet-v2

Autonomous Cars

Page 9: North americai iotskynet-v2

Hyundai - The Empty Car Convoy

Page 10: North americai iotskynet-v2

Autonomous Drones

Page 11: North americai iotskynet-v2

The test of the world's largest micro-drone swarm in California in October2016 included 103 Perdix micro-dronesmeasuring around six inches launchedfrom three F/A-18 Super Hornet fighterjets,

Page 12: North americai iotskynet-v2

Large organisations of devices

Page 13: North americai iotskynet-v2

Bot Nets

500,000+ hijacked internet-connected thingslike cameras, lightbulbs, and thermostatslaunched the largest DDoS attack everagainst a top security blogger

IOT

An integrated end-to-end solution that enablesyour apps to communicate with, control, analyze,and update connected electronics

Page 14: North americai iotskynet-v2

50 Billion devices connected to the internet by 2020

Wikipedia: “Skynet gained self-awareness after it had spread into millions of computer servers all across the world”

Page 15: North americai iotskynet-v2

AI’s that can beat humans at Chess, Go and even Jeopardy

Jan 2016Feb1996 Feb 2011

Page 16: North americai iotskynet-v2

Computers we can talk to

Page 17: North americai iotskynet-v2

Apple’s Siri Google’s AssistantAmazon’s Alexa

Page 18: North americai iotskynet-v2

Computers that can understand the world

Page 19: North americai iotskynet-v2

https://github.com/karpathy/neuraltalk2

Dynamic Image Captioning

Page 20: North americai iotskynet-v2

Computers that can recognise you

Page 21: North americai iotskynet-v2
Page 22: North americai iotskynet-v2

Q: How long do we have left?In the movie (set in 1984) the first Terminator came from 2024

Page 23: North americai iotskynet-v2

A: AI is not scary in the way you might imagine

Page 24: North americai iotskynet-v2

The Nature of AI: a worked example

Page 25: North americai iotskynet-v2

CanIbuildaterminator?

Mywifesays“no”

Page 26: North americai iotskynet-v2

CanIbuildaterminator?

Toolate!

Page 27: North americai iotskynet-v2

CanIbuildarobotthatdoessomethingelse?

Naturallymycolleaguessuggestweshouldbuildabeerdeliverysystem

Page 28: North americai iotskynet-v2

Terminator4J RobotDelivery4J

Page 29: North americai iotskynet-v2

MyRobot

• Needstobeabletodeliveracantoanindividualwithinaspecificamountoftimeiebeforethedrinkgetstoowarm

• Needstotakeverbalinstructionsnokeyboardsthankyou

• Needstobeabletocommunicatewiththetargetindividualie”hereisyourdrink”

• Plusallthesimplestufflikefindingitswayaroundaroom

Page 30: North americai iotskynet-v2

MyRobotneeds“senses”

Hear->microphoneSpeak->loudspeakerLocate->position&orientation?Touch->ultra-sonicrangesensor?Vision->cameraTemperature->temperaturesensor?

Page 31: North americai iotskynet-v2

Mytoolkit

• Java• OpenCV• Cuda4J• ApacheSpark• DeepLearning4j• Neuroph• Processing• Gazebo

• RaspberryPI• RobotHAT• Robotchassiswithwheels• TiSensorTag• Ultrasonicrangefinder• Webcam• Loudspeaker• Microphone• Batteriesxmany,many

Page 32: North americai iotskynet-v2

MyRobot

DistanceSensor

Wheels

TiTag

Camera

Raspberry PIRobot HATBattery

Page 33: North americai iotskynet-v2

MyRobot

DistanceSensor

Wheels

TiTag

Camera

Drink

Page 34: North americai iotskynet-v2

TiSensorTag

• Bluetoothenabled

• 9axismotionsensor• IRthermopiletemperaturesensor• Digitalmicrophone• Magnetsensor• Humiditysensor• Pressuresensor• Lightsensor

Page 35: North americai iotskynet-v2

Howhardcanitbe?

Page 36: North americai iotskynet-v2

Somethingsimple– directioncontrol

Page 37: North americai iotskynet-v2

LearningwithNeuralNets

• Simpleexample

• Iftargettotheleft- turnleft• Iftargettotheright– turnright• Iftargetstraightahead– moveforwards• Iftargetwithin5cm- stop

Target

DistanceSensor

Wheels

0o

180o

Page 38: North americai iotskynet-v2

LeftMotor=backRightMotor=forward

LeftMotor=forwardRightMotor=back

LeftMotor=forwardRightMotor=forward

LeftMotor=stopRightMotorstop

Page 39: North americai iotskynet-v2

Psudocode

ifdistancetotarget<=5cm//closeleftmotor=stoprightmotor=stop

elseifangletotarget>355oor<5o //straightaheadleftmotor=forwardrightmotor=forward

else ifangle<180o //ontherightleftmotor=forwardrightmotor=backward

Else//ontheleftleftmotor=backwardrightmotor=forward

Page 40: North americai iotskynet-v2

Motordirectionplot(distanceignored)

0 15 30 45 60 75 90 105 120 135 150 165 180 195 210 225 240 255 270 285 300 315 330 345

Left Right

+0.5Forward

-0.5Backwards

Angleoftarget

Page 41: North americai iotskynet-v2

0.5 0.7

0.52

ValuesfromNodes

Areweighted0.10.9

summed

=(0.5*0.9)+(0.7*0.1)=0.45+0.07=0.52

Andasignmoidtransferfunctionapplied

1.0./(1.0+exp(-0.52))

0.6271477663131956

Page 42: North americai iotskynet-v2

0.5 0.7

0.52

0.1- 0.010.9+0.02

0.6271477663131956

Wetakeexpectedanswer 0.7

Andadjusttheweights

Dependingontheircontribution

=(0.5*0.92)+(0.7*0.09)=0.46+0.063=0.523

0.6278489986434628Andrepeatafewtimes

Page 43: North americai iotskynet-v2

Myfirstneuralnet

Inputnode“direction”

Hiddenlayer

Outputmode“rightmotor”

Outputmode“leftmotor”

Page 44: North americai iotskynet-v2

Myfirstneuralnet

• Allinputandoutputisbetween0&1• Usesa“sigmoidfunction”asthetrigger• Usesabackpropagationmethod• Usessupervisedtraining.

Page 45: North americai iotskynet-v2

Motordirection50sampledata

-0.07

-0.035

0.

0.035

0.07

0.105

0 15 30 45 60 75 90 105 120 135 150 165 180 195 210 225 240 255 270 285 300 315 330 345

Left Right

+0.5Forward

-0.5Backwards

Page 46: North americai iotskynet-v2

Motordirection500sampledata

-0.75

-0.5

-0.25

0.

0.25

0.5

0.75

0 15 30 45 60 75 90 105 120 135 150 165 180 195 210 225 240 255 270 285 300 315 330 345

Left Right

+0.5Forwards

-0.5Backwards

Page 47: North americai iotskynet-v2

Motordirection5000sampledata

-0.75

-0.5

-0.25

0.

0.25

0.5

0.75

0 15 30 45 60 75 90 105 120 135 150 165 180 195 210 225 240 255 270 285 300 315 330 345

Left Right

-0.5Backwards

+0.5Forwards

Page 48: North americai iotskynet-v2

Motordirection50000sampledata

-0.75

-0.5

-0.25

0.

0.25

0.5

0.75

0 15 30 45 60 75 90 105 120 135 150 165 180 195 210 225 240 255 270 285 300 315 330 345

Left Right

-0.5Backwards

+0.5Forwards

Page 49: North americai iotskynet-v2

Motordirection500000sampledata

-0.75

-0.5

-0.25

0.

0.25

0.5

0.75

0 15 30 45 60 75 90 105 120 135 150 165 180 195 210 225 240 255 270 285 300 315 330 345

Left Right

-0.5Backwards

+0.5Forwards

Page 50: North americai iotskynet-v2

Motordirection5000000sampledata

-0.8

-0.5

-0.3

0.

0.3

0.5

0.8

0 15 30 45 60 75 90 105 120 135 150 165 180 195 210 225 240 255 270 285 300 315 330 345

Left Right

-0.5Backwards

+0.5Forwards

Page 51: North americai iotskynet-v2

But..

ErrorsinyourtrainingcancauseerrorsintheAI

Page 52: North americai iotskynet-v2

Motordirectionplot(distanceignored)

-0.8

-0.5

-0.3

0.

0.3

0.5

0.8

0 15 30 45 60 75 90 105 120 135 150 165 180 195 210 225 240 255 270 285 300 315 330 345

Left Right

Ihadabuginthetrainingalgorithm

Page 53: North americai iotskynet-v2

Motordirection500000sampledata

-0.75

-0.5

-0.25

0.

0.25

0.5

0.75

0 15 30 45 60 75 90 105 120 135 150 165 180 195 210 225 240 255 270 285 300 315 330 345

Left Right

WhichtheNNcopied

Page 54: North americai iotskynet-v2

Whataboutotherneuralnetstructures

1x2x2?1x12x2?

Page 55: North americai iotskynet-v2

Motordirection500000sampledata1x2x2

-0.75

-0.5

-0.25

0.

0.25

0.5

0.75

0 15 30 45 60 75 90 105 120 135 150 165 180 195 210 225 240 255 270 285 300 315 330 345

Left Right

Page 56: North americai iotskynet-v2

Motordirection500000sampledata1x12x2

-0.75

-0.5

-0.25

0.

0.25

0.5

0.75

0 15 30 45 60 75 90 105 120 135 150 165 180 195 210 225 240 255 270 285 300 315 330 345

Left Right

Page 57: North americai iotskynet-v2

Trainingcosts

• Morenodes->moretime(noguaranteeofincreasedaccuracy)• Moreaccuracy->moretraining->(noguaranteeofincreasedaccuracy)

• Increasedcomplexityofproblem->morenodes—>moretime->(noguaranteeofincreasedaccuracy)

Page 58: North americai iotskynet-v2

We’veseenasimpleNNlearningtheoutputofanalgorithm

• Thealgorithmisasortofmathematicalfunction

• Italready‘knows’howtomaptheinputvaluetosomeoutputvalues

• TheNNistrainedtofindthesamefunctionmappingina3dimensionalspace.

• Somewhereinthespaceof(angle,rightmotor,leftmotor)thereistherightanswer.

Page 59: North americai iotskynet-v2

Nowwe’lladdindistance• we’recreatinganewalgorithmthatmapsavalueina4dimensionalspace

• Angle,distance,leftmotor,rightmotor

Distance

Page 60: North americai iotskynet-v2

Mysecondneuralnet

Inputnode“distance”

Hiddenlayer

Outputmode“rightmotor”

Outputmode“leftmotor”

Inputnode“direction”

Page 61: North americai iotskynet-v2

AIVisualiserScreenshot

Page 62: North americai iotskynet-v2

Poorlytrained

Loop 5000 timespick random angleget expected answerget answer from neural netapply positive & negative feedback

Loop throw angles 0..360get expected answerget answer from neural netapply positive & negative feedback

Properlytrained

Page 63: North americai iotskynet-v2

Nextsteps.

• Addintheothersensors• Temperature,proximitysensor,acceleration,light,compassdirectionetc

Distance

Page 64: North americai iotskynet-v2

I’mgoingtoneedabiggerneuralnet

left motor right motor I’m stuck No drink drink too warmdrink delivered

?

Page 65: North americai iotskynet-v2

HowdoIdecideonthestructureofthenetwork?

HowdoItrainthisthing!!!

HowdoIvisualisehowtheAI‘thinks’?

Page 66: North americai iotskynet-v2

Training=Simulation+Neuroevolution

• Gazeboforrobotsimulation• UsegeneticalgorithmstorepresentNeuralNetwork.• Definefitnessselectionsandaddincrementally• Fastesttodeliver• Nearesttotarget• abletospotbeingstuck…

• Evolve.• Willletyouknowwhenthisworks.• Unsupervisedtraining- survivalofthefittest

Page 67: North americai iotskynet-v2

Terminator4J RobotDelivery4J

• Trainingisstupidlyhard• Ihadn’tappreciatedhowhard.• YouneedsomethinglikeGazebo

• ButitstilltakessignificanttimetotrainandAI• PlusvisualisingtheAIdecisionprocessisdifficultifnotimpossible

http://gazebosim.org/

Page 68: North americai iotskynet-v2

Computer Vision : face recognition

• How do you turn a picture of a face into a ‘key’ ?

• Especially when the face is at a different distance or relative angle?

Page 69: North americai iotskynet-v2

“face landmark estimation"Convert the image into HOG format

Identify key points around the face.

Train an AI to find those points in an image

Use the located points to morph the face image into a standard form

Invented by Vahid Kazemi and Josephine Sullivan.

http://www.csc.kth.se/~vahidk/papers/KazemiCVPR14.pdf

http://sharky93.github.io/docs/gallery/auto_examples/plot_hog.html

Page 70: North americai iotskynet-v2

Once you can identifythe key parts of a face

you can morph the image in other interesting ways

face landmark estimation

Page 71: North americai iotskynet-v2

‘Encode” the face • With a standardised face image

• Identify the ‘important’ parts of the face so you can do pattern matching

• The challenge

• We don’t know what the ‘important’ parts are

• The answer

• Use a Neural Network to work it out.

• http://www.cv-foundation.org/openaccess/content_cvpr_2015/app/1A_089.pdf

Page 72: North americai iotskynet-v2

VoicetoText

• Humansareverygoodatunderstandingspokenwords:-)• Computershaveahardertime

Page 73: North americai iotskynet-v2
Page 74: North americai iotskynet-v2

http://cmusphinx.sourceforge.net/

Sphinx4

ApureJavaspeechrecognitionlibrary

WatsonSpeechtoText

JavaAPItoonlinespeechrecognitionsolution(freetier)

https://speech-to-text-demo.mybluemix.net/

Page 75: North americai iotskynet-v2

Results

“love they do is”

“Open the pod bay doors hal.”

Speaker 0: Open the pod baydoors hal.

Speaker 1: Sorry. Great I can.

“Open the pod bay doors hal. I’m sorry Dave. I can’t do that”

Sphinx4 Watson

Page 76: North americai iotskynet-v2

SpeechtoWords

• Accuratetranslationofspeechtowordscanbeverygood• It’salmostasaccurateashumans• Itwillsoonbemuchbetter.• Withoutgoodmicrophonesresultscanbemixed!• Behindthescenesthereisstillasignificantamountofcomputepowerbeingused.

Page 77: North americai iotskynet-v2

Practically

• HowwouldIgetmyrobottounderstandcommandslike

• “takethisdrinktoRobinthecorner”• “takethisdrinktotheladytalkingtomywife”• “givethisdrinktothemanwearingtheHawaiianshirtandblackshorts”

• HowdoIextractmeaning?

Page 78: North americai iotskynet-v2

ChatBots

User: "Alexa, open History Buff"Alexa: "History Buff. What day do you want events for?"User: "August thirtieth."Alexa: "For August thirtieth, in 2003, [...] . Wanna go deeper in history?"User: "Yes."Alexa: "In 1995, Bosnian war [...] . Wanna go deeper in history?"User: "No."Alexa: "Good bye!"

https://github.com/amzn/alexa-skills-kit-java

Page 79: North americai iotskynet-v2

ChatBots:alittlebitofacheatGetFirstEventIntent get events for {day}GetFirstEventIntent give me events for {day}GetFirstEventIntent what happened on {day}GetFirstEventIntent what happenedGetFirstEventIntent {day}

GetNextEventIntent yesGetNextEventIntent yupGetNextEventIntent sureGetNextEventIntent yes please

AMAZON.StopIntent noAMAZON.StopIntent nopeAMAZON.StopIntent no thanksAMAZON.StopIntent no thank you

Page 80: North americai iotskynet-v2

Chatbots

• Mapintenttoactions• WorkoutyourintentusingvariouslevelsofNaturalLanguageParsing

• Hardcodedstringmatching• Templates(likeAlexa)• Trainedsentencemapping(likeWatsonConversationService)

• Respondtoyouappropriately• Don’thaveanyintrinsicunderstandingofyourintent(yet)

Page 81: North americai iotskynet-v2

Artificial Intelligence

• Relies on ‘good’ data representations

• Relies on appropriate internal data structures

• Relies on the ‘right’ sort of training

• Embeds knowledge inside its data structures

• Very quickly becomes opaque to humans

• Needs significant processing power

This is‘art’ not

science

Page 82: North americai iotskynet-v2

GPUstotherescue?• GPU’scanmassivelyreduceneuralnettrainingandexecutiontimes.

• TheyareideallysuitedtoparallelprocessingthecalculationsofaNeuralNet.• Youcanuseyourownorbuytimeinthecloud• ForinstanceAmazonoffersan16xNVIDIAK80GPUinstanceinECSat$14/hour• Youget,nominally,x10performanceimprovements

• MultiplebindingsforGPUsformostlanguages

• IBMJVMhasintrinsicsupportforGPU’s.JITcanutiliseGPUsunderthecoversforappropriateoperations.

Page 83: North americai iotskynet-v2

How long do we have left?In the movie (set in 1984) the first Terminator came from 2024

Page 84: North americai iotskynet-v2

Checkpoint• Buildingyouowncognitiverobotorserviceishard

• Ittakestime.• Ittakesdata.• Ittakespatience.

•WhatAItechniquesaregivingusistheabilitytominedataeffectivelyandbeabletoteachsystemsto‘understand’thatdata

• It’sclearthatcompaniesarecreatingAI’sthatwillbesignificantassets.• It’salsoclearthatdifferentiatorwillbethequalityandquantityofdatausedtotraintheAI

•Nosignofsentienceyet.

•However…

Page 85: North americai iotskynet-v2

• WedesigntheAI• WetraintheAI• Ourdesires/agendas/biasescaneasilygetencodedintotheAI

• Howdowe‘trust’AI’s?

TheSkynetideastillhasanachillesheel…

Don’tworryaboutSkynetyet.

WorryabouthowwelearntounderstandandvisualisetheAIswe’vecreated.

Page 86: North americai iotskynet-v2

TheAchillesheelofSkynet

Page 87: North americai iotskynet-v2

MyRobotuses6AAbatteries

• Givesitafewhoursofrunning

Page 88: North americai iotskynet-v2

HowmanyAAbatterieswouldyouneedtorunaTerminator?

• Here’stheHumanequivalent

• NumberofAAbatteriestoplaythepianoforanhour?

• NumberofAAbatteriestowalkforanhour?

• NumberofAAbatteriestostandupandpaintawallforanhour?

91

127

152

Page 89: North americai iotskynet-v2

Yuckyquestion

Howmuchenergy(innumberofAAbatteries)isstoredin1kgofhumanfat?

1869

Page 90: North americai iotskynet-v2

Soactuallyhumanbeingsareprettyefficientbatteries?

Maybewe’reinthewrongmovie?

Page 91: North americai iotskynet-v2

Thank you

any questions?