NVIDIA-AI-IOT / deepstream-occupancy-analytics

This is a sample application for counting people entering/leaving in a building using NVIDIA Deepstream SDK, Transfer Learning Toolkit (TLT), and pre-trained models. This application can be used to build real-time occupancy analytics applications for smart buildings, hospitals, retail, etc. The application is based on deepstream-test5 sample application.
MIT License
217 stars 73 forks source link

Using Webcam/Camera #4

Closed PiyalGeorge closed 3 years ago

PiyalGeorge commented 3 years ago

Hi,

I'm trying to implement this repo in Jetson Nano. I have installed the packages as mentioned in repo, and its running. (Since i'm trying in Nano board its very slow, yes, i know, but that's not my issue).

In one terminal, i'm running this:

/opt/nvidia/deepstream/deepstream-5.0/sources/apps/sample_apps/deepstream-occupancy-analytics$ sudo ./deepstream-test5-analytics -c config/test5_config_file_src_infer_tlt.txt

In next terminal, i'm running this:

kafka_2.13-2.6.0$ bin/kafka-console-consumer.sh --topic quickstart-events --from-beginning --bootstrap-server localhost:9092

When i move my mouse suddenly screen display output goes blank and terminal says : "There may be a timestamping problem, or this computer is too slow." (may be Nano is getting hang)

This is my doubt: Currently this works for some videos in this repo. I need to run this using my webcam. Where and what modification i need to do? Kindly help on this issue.

mjhuria commented 3 years ago

Hi Piyal,

To add the webcam, please update the source group. Check here for more information: https://docs.nvidia.com/metropolis/deepstream/dev-guide/text/DS_ref_app_deepstream.html?highlight=camera#source-group For speed, you can do a couple of things:

  1. Clean up the logs generated by kafka if you don't need them.
  2. Application is sending data to the cloud for each frame if you don't need that then you can skip the frames. Check deepstream test4 application.
  3. Add qos=0 in sink group.
Ryan-ZL-Lin commented 3 years ago

Hi @mjhuria I checked the deepstream test4 application, in the source code line 360 (see the quote below), it will send out the message every 30 ms, but I don't see this part in deepstream_test5_app_main.c, does that mean I need to add this logic by myself? Is there any configuration could change the frequency to skip the frames?

if (is_first_object && !(frame_number % 30)) { /* Frequency of messages to be send will be based on use case.

  • Here message is being sent for first object every 30 frames. */

BTW, I observed a few meesages in following format via using the original configuration. Why the same result needs to send out 4 times every 30 ms?

{ "messageid" : "1d7c94ce-7c1a-481b-9dd4-ed1c5aae0c07", "@timestamp" : "2020-12-18T08:11:39.536Z", "analyticsModule" : { "occupancy" : 3.0, "source_id" : 0.0, "Entry" : 3.0, "Exit" : 0.0 }, "videoPath" : "" } { "messageid" : "e6fb4f11-6ef3-4312-be7c-33315df624ee", "@timestamp" : "2020-12-18T08:11:39.536Z", "analyticsModule" : { "occupancy" : 3.0, "source_id" : 0.0, "Entry" : 3.0, "Exit" : 0.0 }, "videoPath" : "" } { "messageid" : "0aa75017-e6af-4585-80c5-3fffa0f1de0d", "@timestamp" : "2020-12-18T08:11:39.536Z", "analyticsModule" : { "occupancy" : 3.0, "source_id" : 0.0, "Entry" : 3.0, "Exit" : 0.0 }, "videoPath" : "" } { "messageid" : "fca2f6fb-8436-4b52-aa8c-738cb3b86b88", "@timestamp" : "2020-12-18T08:11:39.536Z", "analyticsModule" : { "occupancy" : 3.0, "source_id" : 0.0, "Entry" : 3.0, "Exit" : 0.0 }, "videoPath" : "" }

mjhuria commented 3 years ago

Hi Ryan,

In the current application, we are sending metadata for every frame. You need to add the logic similar to the test4 application to skip 30 frames. Why the same result needs to send out 4 times every 30 ms? The count in the frame is the same but all 4 messages are different with different message ids. You can add your logic for how/when you need to send the data to the cloud.

Ryan-ZL-Lin commented 3 years ago

Thanks, @mjhuria