Camera Recognition

I went through the 2 days to a demo code and i was wondering where i can change the fps? It shows the FPS in the window when starting the program but where can i adjust that number?

Thank you very much for your effort.

Steffen

width = 640
	height = 480
	network = "googlenet"
	camera = "/dev/video0"
	
	# load the recognition network
	net = jetson.inference.imageNet(network, [])

	# create the camera and display
	font = jetson.utils.cudaFont()
	camera = jetson.utils.gstCamera(width, height, camera)
	display = jetson.utils.glDisplay()

	while display.IsOpen():
		# capture the image
		img, width, height = camera.CaptureRGBA()

		#classify the image
		class_idx, confidence = net.Classify(img, width, height)

		#find the object description
		class_desc = net.GetClassDesc(class_idx)

		#overlay the result on the image	
		font.OverlayText(img, width, height, "{:05.2f}% {:s}".format(confidence * 100, class_desc), 5, 5, font.White, font.Gray40)
		
		#render the image
		display.RenderOnce(img, width, height)

		#update the title bar
		display.SetTitle("{:s} | Network {:.0f} FPS".format(net.GetNetworkName(), 1000.0 / net.GetNetworkTime()))

hello steffen.epp,

it’s the capability of the object recognition, you might configure NVPModel to put the platform in performance mode.
please also check the documentation, Supported Modes and Power Efficiency for details of configuration.
please also refer to Topic 1050377 for Jetson-Nano deep learning inference benchmarks.
thanks

Thanks for this information. When running the Nano in performance mode, would the workload be reduced while running the code, or would the number of fps rise? Actually i don’t want higher fps, I want to reduce the workload to run something in parallel to that.

Line 25 above is where the fps is printed. If you want to control that, you need only wait for a regular interval inside your while loop just before the display.renderonce

So you need to remember the last time you displayed a frame, and then the next frame you just wait 1/whatever a second before displaying.

Please see jetson_camera_source in this file for an example of the this idea for controlling the frame rate in Python:

https://github.com/mdegans/jetstreamer/blob/master/jetstreamer/pipeline.py

You could probably also modify the Jetson utils gstreamer camera source since with gstreamer you can set the capture rate and the jetson.utils camera will block until a frame is ready (iirc) but that is more difficult and requires some knowledge of c and gstreamer.

I believe the gstCamera doesn’t support you changing the FPS. It uses a fixed FPS; to change it, you will have to edit the gstCamera source code. Alternatively, you can use the NanoCamera library. It supports you entering your own FPS choice.
https://github.com/thehapyone/NanoCamera