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

How can I receive metaconvert and jpegenc in one class? #814

Open
dhaval-zala-aivid opened this issue Jul 1, 2022 · 3 comments
Open

How can I receive metaconvert and jpegenc in one class? #814

dhaval-zala-aivid opened this issue Jul 1, 2022 · 3 comments

Comments

@dhaval-zala-aivid
Copy link

dhaval-zala-aivid commented Jul 1, 2022

Hii @nnshah1

{ "name": "staff-engm-det", "version": 2, "type": "GStreamer", "template": [ "rtspsrc udp-buffer-size=212992 name=\"source\" ", " ! queue ! rtph264depay ! h264parse ! video/x-h264 ", " ! tee name=t ! queue ! decodebin ! queue leaky=upstream ", " ! gvadetect ie-config=CPU_BIND_THREAD=NO model=\"{models[{{ input_model_0 }}][1][network]}\" model-proc=\"{models[{{ input_model_0 }}][1][proc]}\" name=\"detection\" threshold=0.40 ", " ! queue ! gvametaconvert add-empty-results=true name=\"metaconvert\" ! gvapython name=\"peoplecounting\" module=\"custom_transforms/staffEngmDet\" class=\"StaffEngagementTime\" ! queue ! gvametapublish name=\"destination\" ", " ! tee name = tt ! queue ! gvawatermark ! videoconvert ! jpegenc ! gvapython name=\"ImageCapture\" module=\"custom_transforms/staffEngmDet\" class=\"ImageCapture\" ", " ! queue ! appsink name=appsink t. ! queue ! splitmuxsink mux=\"mp4mux fragment-duration=1000\" max-size-time=300000000000 name=\"splitmuxsink\""], "description": "staff-engm-det Pipeline", "parameters": { "type": "object", "properties": { "inference-interval": { "element": "detection", "type": "integer", "minimum": 0, "maximum": 4294967295 }, "cpu-throughput-streams": { "element": "detection", "type": "string" }, "n-threads": { "element": "videoconvert", "type": "integer" }, "nireq": { "element": "detection", "type": "integer", "minimum": 1, "maximum": 64 }, "recording_prefix": { "type": "string", "element": { "name": "splitmuxsink", "property": "location" }, "default": "recording" } } } }

here is the pipeline that we are using where there are two python classes one which is StaffEngagementTime receives metaconvert and another class that is ImageCapture receives jpegenc to capture the image. How can I receive metaconvert and jpegenc in one class?

@divdaisymuffin
Copy link

divdaisymuffin commented Jul 6, 2022

@nnshah1 Any help in this will be great. Actually this is causing us problem that sometimes a frame passes through metaconvert and do post-processing via gvapython, and then the same frame miss to go to the jpegenc and hence the event metadata generates but image being not captured.

@dhaval-zala-aivid
Copy link
Author

As per our discussion in the last meet we have done this implementation with the same pipeline
Here is the code:

class PeopleCount:    
                                                            
    def __init__(self):
        self.object_id_list = []


    def process_frame(self, frame):
        print("frame1",(frame.data()))
        messages = list(frame.messages())
        try:

            with frame.data() as mat:
                print(mat)
        except Exception as error:
            print("Error",error)

        return True



class ImageCapture(object):
    def __init__(self):
        self.timestamp=0
        print("running")
        


    def process_frame(self,frame):

        print("frame2",(frame.video_meta()))
        messages = list(frame.messages())
        print("messages2",messages)

the mat variable in the PeopleCount class should be the image. But it shows an error.

Right now we get the analytics/metadata in PeopleCount and image in ImageCapture class. However, we want the image and analytics/metadata both in PeopleCount class only.

Error:

{"levelname": "INFO", "asctime": "2022-07-22 09:59:51,413", "message": "Loading Pipeline: algorithmName version: 1 type: GStreamer from /home/pipelines/algorithmName/1/pipeline.json", "module": "pipeline_manager"}
{"levelname": "INFO", "asctime": "2022-07-22 09:59:51,413", "message": "===========================", "module": "pipeline_manager"}
{"levelname": "INFO", "asctime": "2022-07-22 09:59:51,413", "message": "Completed Loading Pipelines", "module": "pipeline_manager"}
{"levelname": "INFO", "asctime": "2022-07-22 09:59:51,413", "message": "===========================", "module": "pipeline_manager"}
{"levelname": "INFO", "asctime": "2022-07-22 09:59:51,414", "message": "Creating Instance of Pipeline algorithmName/1", "module": "pipeline_manager"}
0:00:04.919655819     1      0x12c6850 ERROR                  libav :0:: SEI type 5 size 2216 truncated at 1928

@dhaval-zala-aivid
Copy link
Author

Pipeline and the yolov4 model with the proc-file are here

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

No branches or pull requests

2 participants