Download presentation
Presentation is loading. Please wait.
Published byKathleen Harrington Modified over 7 years ago
1
Building A Brain With Raspberry Pi And Zulu Embedded JVM
Simon Ritter Deputy CTO, Azul Systems
2
Introduction
3
Inspiration
4
Human Brain Neocortex
5
Hierarchical Temporal Memory
Theoretical framework for how the neocortex works Models neurons and synapses and how they interact Also includes dendrites and precise synapses This is different to basic neural network topologies HTM simulated neuron far more complex More adaptable than AI neuron links decay over time if not used (temporal) Potentially much better at learning
6
Project Hardware
7
Raspberry Pi Fantastically successful development board
Cheap, powerful, great connectivity Original boards $25, Pi Zero only $5! Officially launched on Febuary 29th 2012 First production run was 10,000 boards RS reported over 100,000 pre-orders in one day Crashed servers Over 10 million boards have been sold (Sept, 2016)
8
Raspberry Pi Variations
Model A Model B Pi Zero ARM v6 700 MHz ARMv6/7/8 700/900/1200 MHz 1 GHz 1 core 1 or 4 core 256 Mb 512 Mb 1 Gb 1 x USB No Network 2/4 USB 100 Mb Ethernet WiFi/Bluetooth (v3) 1 micro USB No ethernet WiFi/Bluetooth (Zero W)
9
Pi Brain Architecture Raspberry Pi Cluster Client Laptop
(Emulating HTM) Network Client Laptop
10
Raspberry Pi Cluster (Mk 1)
11
Raspberry Pi Cluster (Mk 2)
12
Cluster Hat Raspberry Pi 3 Master Pi Zero W USB GPIO Slaves PORT 1
Alert LED GPIO 21 Pi Zero W Slaves USB GPIO
13
Java For Embedded Applications
14
Why Java? “Write once, run anywhere”
Easy to move code between different platforms Wide range of libraries and frameworks Takes a lot of hard work out of app development Simple interfacing Pi4J and DIO libraries for Raspberry Pi Simple concurrency Comprehensive multi-threading support Native code integration for complex situations JNI
15
Azul Zulu Java For Embedded
Built from OpenJDK code base Passes all TCK tests Ports for Intel, ARM, PowerPC ARM v6, v7, v8 Soft and hard float 64 bit close to release C2 and C1+C2 compiler enhancements Drop in replacement for other JVMs No licensing restrictions (FoU)
16
Machine Learning In Java
17
Deep Learning Basics Neural network nodes
Neuron takes weighted inputs that can change Organised as layers Non-linear processing Different levels of problem abstraction Good analogy to HTM model Unsupervised learning No initial data set Learn by experience
18
Neural Network Elements: Node
1 W0 X1 W1 λ Σ W2 X2 W3 X3
19
Neural Network Elements: Layers
Output Layer Hidden Layer Input Layer
20
DeepLearning4J (DL4J) Toolkit for building, training and deploying Neural Networks provides tools to configure neural networks and build computation graphs DataVec Data ingestion, normalization and transformation into feature vectors Arbiter Search the hyperparameter space to find the best neural net configuration
21
DL4J Core Classes NeuralNetConfiguration.Builder backprop list
optimizationAlgo MultiLayerConfiguration.Builder tBPTTForwardLength/tBPTTBackwardLength Layer (DenseLayer, OutputLayer) nIn/nOut
22
Minecraft And Project Malmo
23
Minecraft Immensly popular ‘construction’ game
Especially amongst children Different modes: creative, survival, hardcore PC (first) version written in Java 121 million copies sold worldwide (all versions) Probably most successful Java desktop app ever Mojang aquired by Microsoft in 2014
24
Minecraft
25
Project Malmo Microsoft Labs project
AI experimentation platform built on top of Minecraft Mod for Java version of Minecraft Libraries to write AI agents to act as player in game Including Java Image courtesy of Microsoft
26
Malmo Example Code (1) AgentHost host = new AgentHost();
ClientPool clientPool = new ClientPool(); clientPool.add(new ClientInfo(" ")); MissionSpec mission = new MissionSpec(); mission.timeLimitInSeconds(120); mission.requestVideo(640, 480);
27
Malmo Example Code (2) MissionRecordSpec missionRecord =
new MissionRecordSpec("./saved_data.tgz"); missionRecord.recordCommands(); missionRecord.recordMP4(20, ); missionRecord.recordRewards(); missionRecord.recordObservations(); host.startMission(mission, clientPool, missionRecord, 0, "TEST");
28
Minecraft Interaction
MissionSpec setModeToCreative startAt/endAt drawBlock/drawLine/drawSphere AgentHost startMission peekWorldState sendCommand
29
Putting It All Together
30
Demo Software Architecture
Pi Zero 1 (Input) TC DL4J Raspberry Pi 3 Demo Controller Malmo Library Pi Zero 2 (Fliter) DL4J TC TCP/IP Pi Zero 3 (Fliter) DL4J TC Laptop Minecraft with Malmo mod Pi Zero 4 (Output) DL4J TC
31
Demo Scenario Original idea: Have agent build a house
Turns out that’s really hard Demo revision 1 Have the agent build a wall Simpler, but not much, than building a house Demo revision 2 Have agent walk around without getting killed Easier to develop a learning model
32
Applying ML To Minecraft
DL4J uses vectors to represent data For our simple example use 3D vector 2D position and block type for next move Start with random moves Record success/failure (live/die) Use reinforcement to (hopefully) learn how to navigate minecraft world safely
33
Conclusions & Future Directions
34
Conclusions Embedded hardware can be used for AI/ML/DL
Model on the structure of the human brain Cheap to build multi-core, multi-CPU cluster Java is an ideal language for this Easy to learn Simple threading model Many, many useful libraries Minecraft is a fun tool for AI testing and development
35
Future Directions More work on ML/DL for Minecraft
Make a better player! Investigation of jCUDA Use NVidia Jetson TK1 board Use of machine vision OpenCV Java bindings
36
Further Information www.raspberrypi.org clusterhat.com
deeplearning4j.org minecraft.net Code to be published on Github after some cleaning up Will post a blog about this
37
Demo Time!
Similar presentations
© 2025 SlidePlayer.com Inc.
All rights reserved.