from conx.widgets import CameraWidget
from conx import Network
from conx.layers import *
Using Theano backend. conx, version 3.5.2
camera = CameraWidget()
camera
Failed to display Jupyter Widget of type CameraWidget
.
If you're reading this message in the Jupyter Notebook or JupyterLab Notebook, it may mean that the widgets JavaScript is still loading. If this message persists, it likely means that the widgets JavaScript library is either not installed or not enabled. See the Jupyter Widgets Documentation for setup instructions.
If you're reading this message in another frontend (for example, a static rendering on GitHub or NBViewer), it may mean that your frontend doesn't currently support widgets.
image = camera.get_image()
image
image.save("nips91.jpg")
data = camera.get_data()
data.shape
(240, 320, 3)
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")
net.dataset.add(data, to_categorical(1, 10))
net.dashboard()
Failed to display Jupyter Widget of type Dashboard
.
If you're reading this message in the Jupyter Notebook or JupyterLab Notebook, it may mean that the widgets JavaScript is still loading. If this message persists, it likely means that the widgets JavaScript library is either not installed or not enabled. See the Jupyter Widgets Documentation for setup instructions.
If you're reading this message in another frontend (for example, a static rendering on GitHub or NBViewer), it may mean that your frontend doesn't currently support widgets.
net.snapshot(camera.get_data())
This should work:
camera.observe(lambda widget: net.propagate(image2aray(camera.get_image())))
inputs = []
camera.observe(lambda widget: inputs.append(camera.get_image()))
for image in inputs:
display(array2image(image))
inputs
[]
camera.observe(lambda widget: net.propagate(image2array(camera.get_image())), "value")
camera.observe(lambda *args, **kwargs: print(args, kwargs))