Closed denisvmedyantsev closed 11 months ago
The bug can be reproduced with 2 elements: 1st is a pyfunc that adds some attribute to object X, 2nd is an inferring element with meta preprocessing of X object. We also can replace preprocessing with a second pyfunc.
name: test parameters: batch_size: 1 pipeline: source: element: videotestsrc properties: num-buffers: 1 elements: - element: pyfunc module: samples.test.test class_name: Test1 - element: pyfunc module: samples.test.test class_name: Test2
test.py
import pyds from savant.deepstream.meta.frame import NvDsFrameMeta from savant.deepstream.meta.object import _NvDsObjectMetaImpl, ObjectMeta from savant.deepstream.pyfunc import NvDsPyFuncPlugin from savant.deepstream.utils import ( nvds_frame_meta_iterator, nvds_get_all_obj_attrs, nvds_obj_meta_iterator, ) from savant.gstreamer import Gst class Test1(NvDsPyFuncPlugin): def process_frame(self, buffer: Gst.Buffer, frame_meta: NvDsFrameMeta): for obj_meta in frame_meta.objects: obj_meta.add_attr_meta('global_roi', 'is_inside', True) class Test2(NvDsPyFuncPlugin): def process_buffer(self, buffer: Gst.Buffer): nvds_batch_meta = pyds.gst_buffer_get_nvds_batch_meta(hash(buffer)) for nvds_frame_meta in nvds_frame_meta_iterator(nvds_batch_meta): for nvds_obj_meta in nvds_obj_meta_iterator(nvds_frame_meta): object_meta = _NvDsObjectMetaImpl.from_nv_ds_object_meta( nvds_obj_meta, nvds_frame_meta ) user_parent_object_meta = None user_object_meta = ObjectMeta( object_meta.element_name, object_meta.label, object_meta.bbox.copy(), object_meta.confidence, object_meta.track_id, user_parent_object_meta, attributes=nvds_get_all_obj_attrs( frame_meta=nvds_frame_meta, obj_meta=object_meta.ds_object_meta, ), )
Exception
ERROR insight::savant::pyfunc > Failed to process buffer/frame. Aliases for entries in sys.path: <pwd>: /opt/savant <pwd>: /opt/savant Traceback (most recent call last): <pwd> /gst_plugins/python/pyfunc.py:185 do_transform_ip self.pyfunc.instance.process_buffer(buffer) <pwd> /samples/test/test.py:36 process_buffer user_object_meta = ObjectMeta( <pwd> /savant/meta/object.py:105 __init__ if (attr.element_name, attr.name) not in self._attributes: AttributeError: 'list' object has no attribute 'element_name'
Original error from preprocessor
The bug can be reproduced with 2 elements: 1st is a pyfunc that adds some attribute to object X, 2nd is an inferring element with meta preprocessing of X object. We also can replace preprocessing with a second pyfunc.
test.py
Exception