Low Frame Rate in Real-Time Object Detection Example

I was following this tutorial for real-time object detection on the Jetson Nano: Real-Time Object Detection in 10 Lines of Python Code on Jetson Nano - YouTube

I tried using both a Raspberry Pi Camera v2 and a Logitech C525 USB Camera. I was able to run the example fine using both cameras. However, in the video of the example the program was able to achieve a frame rate of 22 fps. When I ran the program, I only got it to run at 8 fps with the pi camera and 5 fps with the Logitech camera. What should I do to improve the frame rate?