Camera won't initialize when restarting kernel?

Hello all.

I’ve been trying to get the thumbs project to work from the Getting Started with AI on Jetson Nano course. So far I’ve had more issues than success with the Nano 2g I was so excited to get.

One issue I’ve lost hours on most recently, the camera (CSI) freezes unless its run headless when doing the Thumbs Project.

Now that I’ve got it in headless mode I’m able to get the camera to take sample images and train the model. Camera freezes again…

I’ve tried the suggested:
“Note: If at any time your camera seems to “freeze”, it will be necessary to shut down the kernel from the menu bar, then restart the kernel and run all cells. Your data is saved, but the model training will need to be run again”
But It won’t get past the second cell.

RuntimeError Traceback (most recent call last)
/usr/local/lib/python3.6/dist-packages/jetcam-0.0.0-py3.6.egg/jetcam/ in init(self, *args, **kwargs)
23 if not re:
—> 24 raise RuntimeError(‘Could not read image from camera.’)
25 except:

RuntimeError: Could not read image from camera.

During handling of the above exception, another exception occurred:

RuntimeError Traceback (most recent call last)
7 # for CSI Camera (Raspberry Pi Camera Module V2), uncomment the following line
----> 8 camera = CSICamera(width=224, height=224, capture_device=0) # confirm the capture_device number
10 camera.running = True

/usr/local/lib/python3.6/dist-packages/jetcam-0.0.0-py3.6.egg/jetcam/ in init(self, *args, **kwargs)
25 except:
26 raise RuntimeError(
—> 27 ‘Could not initialize camera. Please see error trace.’)
29 atexit.register(self.cap.release)

RuntimeError: Could not initialize camera. Please see error trace.

I’ve seen a few posts on increasing swap and memory but shouldn’t that be in the course setup somewhere?

The only way I can get it working again is to restart the Nano, any suggestions for a less time consuming way ?


Hi @murray, sorry about that - with the Jupyter notebooks that do training while displaying the camera on Nano 2GB, we recommend to use USB camera (such as Logitech C270 or C920) to avoid the camera freezing during training. You can find some additional suggestions regarding the swap in this post:

You can also do training with the Hello AI World tutorial, which doesn’t display camera while training. That works fine with MIPI CSI camera on Nano 2GB. There are also some instructions for decreasing RAM usage included with that tutorial: