Code Monkey home page Code Monkey logo

Comments (4)

YunghuiHsu avatar YunghuiHsu commented on May 30, 2024

Hi Ayan:

What kind of results do you want to see and where?

I'm handling the meta information in def add_obj_meta()

def add_obj_meta(frame_meta, batch_meta, boxes, confs):
    pyds.nvds_acquire_meta_lock(batch_meta)
    for i, (box, conf) in enumerate(zip(boxes, confs)):
        new_object = pyds.nvds_acquire_obj_meta_from_pool(batch_meta)
        new_object.unique_component_id = 1
        new_object.class_id = 0
        new_object.confidence = conf
        new_object.obj_label = 'person'

from deepstream-yolo-pose.

phamminhhanhuet avatar phamminhhanhuet commented on May 30, 2024

Hi, I have the same problem here. I want to display frames on the screen with detected pose drawing on. The app run well and I can print the output boxes, confidences, etc, but I don't know how to display frames on screen. Could you show me how? Thank you for considering.

from deepstream-yolo-pose.

YunghuiHsu avatar YunghuiHsu commented on May 30, 2024

Hi phamminhhanhuet :

You need to acquire the display meta object to update the information to be displayed on the screen.

Refer to the flow in the sample code in deepstream_python_apps/apps/deepstream-test2
/deepstream_test_2.py

  • def osd_sink_pad_buffer_probe(pad,info,u_data):
  • Use pyds.nvds_acquire_display_meta_from_pool() to control the objects to be displayed.
def osd_sink_pad_buffer_probe(pad,info,u_data):
    batch_meta =  pyds.gst_buffer_get_nvds_batch_meta(hash(gst_buffer))
    l_frame = batch_meta.frame_meta_list
    frame_meta = pyds.NvDsFrameMeta.cast(l_frame.data)
    frame_number=frame_meta.frame_num
     ...
    display_meta=pyds.nvds_acquire_display_meta_from_pool(batch_meta)    
    py_nvosd_text_params = display_meta.text_params[0]

   # Setting display text to be shown on screen
   # Note that the pyds module allocates a buffer for the string, and the
   # memory will not be claimed by the garbage collector.
   # Reading the display_text field here will return the C address of the
   # allocated string. Use pyds.get_string() to get the string content.
   py_nvosd_text_params.display_text = f"Frame Number={frame_number}")

Don't forget to insert the Pad Probe into your nvdosd object before "Starting pipeline" to update the metadata in the buffer.


Pad Probe in `nvdosd` object
osdsinkpad = nvosd.get_static_pad("sink")
if not osdsinkpad:
        sys.stderr.write(" Unable to get sink pad of nvosd \n")    
osdsinkpad.add_probe(Gst.PadProbeType.BUFFER, osd_sink_pad_buffer_probe, 0)
   
 # start play back and listed to events    
pipeline.set_state(Gst.State.PLAYING)

from deepstream-yolo-pose.

phamminhhanhuet avatar phamminhhanhuet commented on May 30, 2024

Hi YunghuiHsu,

Thank you for instant reply. I carefully followed your guide but still there was nothing displayed on screen. Maybe the problem laid with my device. I will check it and find way to solve the problem.

from deepstream-yolo-pose.

Related Issues (7)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.