WaveShare IMX219-160 not playing nice w/ Jetson Nano 2G : Please Recommend Better Camera

Let me be clear, I am a Linux / Python / Jetson rookie. So, I recently purchased a Jetson Nano 2GB with a Waveshare IMX219-160. The camera has given me nothing but headaches (or at least I think it’s the camera). First time through, the Jetson Nano 2GB wouldn’t even recognize the camera. So, per a recommendation posted on this forum, I re-flashed JetPack. This appeared to take care of the problem, or so I thought.
With my hardware up and running, I started down the DLI “Getting Started with AI on Jetson Nano.” I was able to get through the “hello_camera” notebook just fine. I then started the “Image Classification Project.” I made it all the way to the second to last code cell. Once I stared the “training” process my video froze. I closed out everything, restarted the Nano, and made it back to the same place. Once again, the camera froze. Rather than restart everything, I simply restarted the kernel. Then I began running into the same errors mentioned on this thread “Jetson Nano 2gb giving runtime errors while training.”
While I certainly have learned a bit while trying to troubleshoot these camera problems, ultimately it’s becoming a distraction and source of frustration. I want to progress through the DLI course and not have to restart my Nano every few minutes. To that end, is there a better camera solution? I noticed the instructor in the DLI course utilizes a USB camera. Do USB cameras function more reliably with Nanos? If so, does anyone have a recommendation?
Thank you!

Did you check the camera function without DLI like just run the nvgstcapture-1.0 for checking?

ShaneCCC, first and foremost, thank you for helping. I am going to attempt to provide you with as much information as possible, I apologize for being long winded:

Did you check the camera function without DLI like just run the nvgstcapture-1.0? Yes, in fact, every time the Jetson Nano boots into Lightweight X11 Display Environment, one of the first things I do is check the camera with nvgstcapture1-0. And, it works beautifully. However, once I run the container and start the image classification project, the camera feed usually freezes in the widget shortly after its creation:

It’s at this point that wheels fall off. Once the camera feed hangs, the kernel status indicator in the Juypter notebook shows the kernel as “busy,” and it stays that way. At this point, I shutdown the kernel, then revert back to the CLI and run nvgstcapture-1.0. This produces the following error:

If I proceed to restart the Nano, the error apparently corrects itself. Upon reboot, nvgstcapture-1.0 produces the intended result, the camera feed from the IMX219.

Some amplifying information:

  • I am using the following Hardware:
  1. NVIDIA Jetson Nano 2GB Developer Kit
  2. WaveShare IMX219-160 Camera Module
  3. SanDisk 64GB Extreme
  4. CanaKit 3.5A Raspberry Pi 4 Power Supply
  • On the SD card, using balenaEtcher, is the “jetson-nano-2gb-jp46-sdcard-image”

  • At first, I was running the Nano headless. Once, I plugged up a monitor and recreated the problem, the Nano GUI produced a “Low Memory Warning.” The Nano did not make me aware of this while running headless through SSH.

  • During first boot and setup for the “Getting Started w/ AI on Jetson Nano,” I setup the recommend default SWAP file size, 5GB if I am not mistaken. I did account for this when setting up the docker container for the course:

--memory=500M --memory-swap=5G \
  • I have attempted several troubleshooting steps based on other posts on this forum, these include the following:
  1. Re-flashed JetPack (several times now)
  2. Downloaded and updated the package lists using: sudo apt-update then installed new packages using:
    sudo apt-upgrade
  3. Attempted to add SWAP using the script from the JetsonHacksNano account on GitHub. My intent was to change the SWAP size from 5GB to 8GB. As such, I used the following command from the script:
$ ./setSwapMemorySize.sh -g 8

However, after using the script, the system monitor now shows that I have 11.8 GB of SWAP space:

But, when I run the $ zramctl it returns the following:
zramctl_8GB_Swap

I interpret this to mean each of the four cores has been allocated 2GB of SWAP which totals to 8GB. This differs from the 11.8 GB displayed in the system monitor. Why they differ, I don’t know, but I would like to know if anyone can account for the difference. The only reason I care about this discrepancy is for the sake of setting up the docker container for the course. According to previous posts in this forum, increasing the SWAP space can alleviate the IMX219 camera freezing problem, but it’s imperative to input the exact amount of SWAP in the docker container setup line:

--memory=500M --memory-swap=<enter amount of SWAP here> \

I hope that I have provided you with enough information to continue diagnosing the problem, again, thank you for the help!

Could you give much detail reproduce information?

ShaneCCC, I don’t know how to interpret the question “Could you give much detail reproduce information?”

I think, but don’t know, that you are asking “Can you give detail to reproduce the problem?”

If that is in fact your question, here are my hardware / software details:

And here are steps I follow that lead to the problem:

  1. Enroll in the Nvidia Deep Learning Course titled “Getting Started with AI on Jetson Nano”

  2. Setup Jetson Nano according to the “Setting up your jetson > Headless Device Mode”
    According to step 7 on the page, I create and run a reusable script for this step with the following:


# create a reusable script
echo "sudo docker run --runtime nvidia -it --rm --network host \
    --memory=500M --memory-swap=4G \
    --volume ~/nvdli-data:/nvdli-nano/data \
    --volume /tmp/argus_socket:/tmp/argus_socket \
    --device /dev/video0 \
    nvcr.io/nvidia/dli/dli-nano-ai:v2.0.1-r32.6.1" > docker_dli_run.sh

# make the script executable
chmod +x docker_dli_run.sh

# run the script
./docker_dli_run.sh

Since creating move swap space, as previously mentioned, I change the script with 8G rather than 4G

  1. Log into the JupyterLab server according to the directions on the page

  2. Once in JupyterLab, open the "classification_interactive.ipybn, follow directions, and execute the code cells

  3. After running Code Cell #8, # Combine all the widgets into one display, the widget is created.

  4. Capture five thumbs up and five thumbs down, set the number of epochs to 10, and then click the “train tab” it is at this point that the camera hangs.

That being said, tonight, while trying to reproduce the problem, I ran into the “Troubleshooting” section of the Headless Device Mode page. There is a section specifically titled “I’m using a CSI camera with the 2GB Nano and the camera freezes during training.” It further says " Release as much RAM as possible, increase the swap, and specify memory options during the docker run launch: These directions follow:



# Disable ZRAM:
sudo systemctl disable nvzramconfig

# Prevent X-Server from starting:
sudo systemctl set-default multi-user.target

# Create additional 6GB swap file (assume 4GB already for a total of 10GB)
sudo fallocate -l 6G /mnt/6GB.swap
sudo chmod 600 /mnt/6GB.swap
sudo mkswap /mnt/6GB.swap

# Append the following line to /etc/fstab
sudo su
echo "/mnt/6GB.swap swap swap defaults 0 0" >> /etc/fstab
exit

# REBOOT!

# Check your memory and swap
free -h

# Create a reusable script
echo "sudo docker run --runtime nvidia -it --rm --network host \
    --volume ~/nvdli-data:/nvdli-nano/data \
    --volume /tmp/argus_socket:/tmp/argus_socket \
    --device /dev/video0 \
    --memory=500M --memory-swap=8G \
    nvcr.io/nvidia/dli/dli-nano-ai:v2.0.1-r32.6.1" > docker_dli_run.sh

# Make the script executable
chmod +x docker_dli_run.sh

# Run the script

After seeing this for the first time and following the directions, the “interactive classification tool” appears to run as intended and the camera no longer hangs. I must admit, I am embarrassed that I missed this many times until now. I apologize for any time wasted.

Again, in closing, my IMX219 would freeze and hang during the Image Classification portion of the DLI course titled “Getting Started with AI on Jetson Nano.” I followed the troubleshooting steps outlined here and above and it resolved the issue.

Thanks again for the help and I apologize for any time wasted.

Is your WaveShare IMX219-160 camera in conjunction with your Jetson Nano 2GB freezing during execution of DLI courses? Mine did, here’s how I resolved the issue (after hours of troubleshooting):

Follow troubleshooting directions found in the DLI Course “Getting Started with AI on Jetson Nano > Setting up your Jetson Nano > Headless Device Mode.” (requires a login to view)

For those of you that don’t want to login, the following information comes verbatim from the page:

I’m using a CSI camera with the 2GB Nano and the camera freezes during training.

  • Release as much RAM as possible, increase the swap, and specify memory options during the docker run launch:
# Disable ZRAM:
sudo systemctl disable nvzramconfig

# Prevent X-Server from starting:
sudo systemctl set-default multi-user.target

# Create additional 6GB swap file (assume 4GB already for a total of 10GB)
sudo fallocate -l 6G /mnt/6GB.swap
sudo chmod 600 /mnt/6GB.swap
sudo mkswap /mnt/6GB.swap

# Append the following line to /etc/fstab
sudo su
echo "/mnt/6GB.swap swap swap defaults 0 0" >> /etc/fstab
exit

# REBOOT!

# Check your memory and swap
free -h

# Create a reusable script
echo "sudo docker run --runtime nvidia -it --rm --network host \
    --volume ~/nvdli-data:/nvdli-nano/data \
    --volume /tmp/argus_socket:/tmp/argus_socket \
    --device /dev/video0 \
    --memory=500M --memory-swap=8G \
    nvcr.io/nvidia/dli/dli-nano-ai:v2.0.1-r32.6.1" > docker_dli_run.sh

# Make the script executable
chmod +x docker_dli_run.sh

# Run the script
./docker_dli_run.sh

A message to Nvidia:
As a newcomer to Python, AI, and single board computers, I purchased the Jetson Nano 2GB Developer Kit based on the following claim, found on the Jetson Nano 2GB Developer Kit website: “The NVIDIA® Jetson Nano™ 2GB Developer Kit is ideal for learning, building, and teaching AI and robotics—built for creators and priced for everyone.”
Yet, out of the box, the Jetson Nano 2GB developer kit isn’t capable of being used in Nvidia’s “Getting Started with AI on Jetson Nano.” I would happily have paid $40 more for the 4GB to avoid the hours lost trying to make the 2GB version compatible with the DLI course. If you have experience in computer science, which I don’t, I am sure that you probably feel differently. But remember, Nvidia markets this as being “ideal for learning” and compatible with their “easy-to-follow tutorials.”

That is all. I hope this post helps other newcomers like myself avoid some frustration.