Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Creating a Tensor Object in Python from a List like structure #395

Open
mschreil opened this issue Dec 13, 2023 · 7 comments
Open

Creating a Tensor Object in Python from a List like structure #395

mschreil opened this issue Dec 13, 2023 · 7 comments
Labels
question Further information is requested

Comments

@mschreil
Copy link

Hello,
I have seen that there were already ambitions to create a Tensor object from a list with the python interface. Are there any plans to fix this part of the code?

elif type(item) is list:
# code below doesn't work though it's very similar to C code used in GVA which works
# gvalue_array = GObject.Value()
# libgobject.g_value_init(hash(gvalue), ctypes.c_size_t(24)) # 24 is G_TYPE_INT
# libgobject.g_value_init(hash(gvalue_array), libgst.gst_value_array_get_type())
# for i in item:
# libgobject.g_value_set_int(hash(gvalue),i)
# libgst.gst_value_array_append_value(hash(gvalue_array),hash(gvalue))
# libgst.gst_structure_set_value(self.__structure, key.encode('utf-8'), hash(gvalue_array))

More general, what I want to do is to use the gavinference element to get the raw model output tensors, post-process them and write them back to the Gstreamer pipeline as part of the RegionOfIntreset Object in the VideoFrame, such that my other elements can directly use the post-processed tensor.

Or are there any workarounds / suggestions how to accomplish this in python. I am kind of stuck here. Would be really appreciated if someone could help me out.

@akwrobel akwrobel added the question Further information is requested label Dec 18, 2023
@mschreil
Copy link
Author

mschreil commented Jan 29, 2024

@akwrobel can you help here?

@pmalatyn
Copy link

@mschreil can you please check if it works or you on newest version of DL Streamer (2024.0)?

@mschreil
Copy link
Author

@pmalatyn
https://github.com/dlstreamer/dlstreamer/blob/v2024.0/python/gstgva/tensor.py#L333-L341

The code is still commented and a NotImplementedError is raised. So no it is not working on DLStreamer 2024-0 with this approach.

Or is there any workaround?

@pmalatyn
Copy link

thanks for fast response, you are right, code is commented so we did not improve that part yet, so far such use case was also not planned to be implemented. Let me check with the team how (if) we can help here.

@pmalatyn
Copy link

@mschreil ...plus can you give us more background about your use case? Do you want to import unsupported model, do inference with DL Streamer and export it?

@mschreil
Copy link
Author

@pmalatyn: sorry for the late response.

Here is some more information:
You already guessed it right. I am using RTMdet which is currently not supported. RTMdet is able to predict instance segmentation masks. However, they need some post-processing. After inference, I would like to apply the post-processing to the masks and write them back to the buffer such that they can be used by other elements.

@pmalatyn
Copy link

pmalatyn commented Apr 19, 2024

@mschreil thanks! it looks like feature request for me not a bug, we will need to discuss how and when we can implement it. In the meantime are you able to share your pipeline? It would be easiest way for us to understand exactly in details your use case

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question Further information is requested
Projects
None yet
Development

No branches or pull requests

3 participants