Working with Camera and Networks

In [1]:
from conx.widgets import CameraWidget
from conx import Network
from conx.layers import *
Using Theano backend.
In [2]:
camera = CameraWidget()
In [3]:
camera
In [4]:
image = camera.get_image()
image
Out[4]:
In [5]:
data = camera.get_data()
In [6]:
data.shape
Out[6]:
(240, 320, 3)
In [7]:
net = Network("Camera Network")
net.add(ImageLayer("camera", (240, 320), 3))
net.add(Conv2DLayer("conv2d", 32, (3,3)))
net.add(MaxPool2DLayer("maxpool", (2,2)))
net.add(FlattenLayer("flatten"))
net.add(Layer("output", 10))
net.connect()
net.compile(error="mse", optimizer="adam")
In [8]:
net.dashboard()
In [10]:
net.snapshot(camera.get_data())
Out[10]:
Camera NetworkLayer: output (output) shape = (10,) Keras class = DenseoutputWeights from flatten to output output/kernel has shape (605472, 10) output/bias has shape (10,)Layer: flatten (hidden) Keras class = FlattenflattenWeights from maxpool to flattenLayer: maxpool (hidden) Keras class = MaxPooling2Dmaxpool320Weights from conv2d to maxpoolLayer: conv2d (hidden) Keras class = Conv2Dconv2d320Weights from camera to conv2d conv2d/kernel has shape (3, 3, 3, 32) conv2d/bias has shape (32,)Layer: camera (input) shape = (240, 320, 3) Keras class = Inputcamera