-
Notifications
You must be signed in to change notification settings - Fork 76
[DLStreamer] New DLS sample for usage of valve element in DLS pipeline. #1498
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
base: main
Are you sure you want to change the base?
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Remaining comments which cannot be posted as a review comment to avoid GitHub Rate Limit
pylint
libraries/dl-streamer/samples/gstreamer/python/open_close_valve/open_close_valve_sample.py|183 col 19| C0123: Use isinstance() rather than type() for a typecheck. (unidiomatic-typecheck)
libraries/dl-streamer/samples/gstreamer/python/open_close_valve/open_close_valve_sample.py|157 col 39| W0613: Unused argument 'pad' (unused-argument)
libraries/dl-streamer/samples/gstreamer/python/open_close_valve/open_close_valve_sample.py|157 col 50| W0613: Unused argument 'u_data' (unused-argument)
libraries/dl-streamer/samples/gstreamer/python/open_close_valve/open_close_valve_sample.py|234| C0116: Missing function or method docstring (missing-function-docstring)
libraries/dl-streamer/samples/gstreamer/python/open_close_valve/open_close_valve_sample.py|243| C0116: Missing function or method docstring (missing-function-docstring)
libraries/dl-streamer/samples/gstreamer/python/open_close_valve/open_close_valve_sample.py|285 col 11| W0718: Catching too general exception Exception (broad-exception-caught)
libraries/dl-streamer/samples/gstreamer/python/open_close_valve/open_close_valve_sample.py|280 col 26| W1309: Using an f-string that does not have any interpolated variables (f-string-without-interpolation)
libraries/dl-streamer/samples/gstreamer/python/open_close_valve/open_close_valve_sample.py|243| R1710: Either all return statements in a function should return an expression, or none of them should. (inconsistent-return-statements)
libraries/dl-streamer/samples/gstreamer/python/open_close_valve/open_close_valve_sample.py|274 col 20| W0612: Unused variable 'err' (unused-variable)
libraries/dl-streamer/samples/gstreamer/python/open_close_valve/open_close_valve_sample.py|10| C0411: standard import "sys" should be placed before third party imports "gi", "gi.repository.Gst" (wrong-import-order)
libraries/dl-streamer/samples/gstreamer/python/open_close_valve/open_close_valve_sample.py|11| C0411: standard import "sys" should be placed before third party imports "gi", "gi.repository.Gst" (wrong-import-order)
libraries/dl-streamer/samples/gstreamer/python/open_close_valve/open_close_valve_sample.py|12| C0411: standard import "time" should be placed before third party imports "gi", "gi.repository.Gst" (wrong-import-order)
libraries/dl-streamer/samples/gstreamer/python/open_close_valve/open_close_valve_sample.py|13| C0411: standard import "contextlib.contextmanager" should be placed before third party imports "gi", "gi.repository.Gst" (wrong-import-order)
libraries/dl-streamer/samples/gstreamer/python/open_close_valve/open_close_valve_sample.py|13| W0611: Unused contextmanager imported from contextlib (unused-import)
| print("Error: Could not find control_valve element") | ||
| return False | ||
| else: | ||
| print("Found control_valve element") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[pylint] reported by reviewdog 🐶
C0303: Trailing whitespace (trailing-whitespace)
| return False | ||
| else: | ||
| print("Found control_valve element") | ||
|
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[pylint] reported by reviewdog 🐶
C0303: Trailing whitespace (trailing-whitespace)
| return False | ||
| else: | ||
| print("Found pre_view_classify element") | ||
|
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[pylint] reported by reviewdog 🐶
C0303: Trailing whitespace (trailing-whitespace)
| return False | ||
| else: | ||
| print("Got sink pad of pre_view_classify") | ||
|
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[pylint] reported by reviewdog 🐶
C0303: Trailing whitespace (trailing-whitespace)
| print("Got sink pad of pre_view_classify") | ||
|
|
||
| # and add probe/callback | ||
| pre_view_classify_pad.add_probe(Gst.PadProbeType.BUFFER, self.object_detector_callback, 0) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[pylint] reported by reviewdog 🐶
C0301: Line too long (102/100) (line-too-long)
|
|
||
| try: | ||
| self.pipeline = Gst.parse_launch(pipeline_str) | ||
| if not self.pipeline: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[pylint] reported by reviewdog 🐶
R1705: Unnecessary "else" after "return", remove the "else" and de-indent the code inside it (no-else-return)
|
|
||
| # Get valve element from pipeline | ||
| self.valve = self.pipeline.get_by_name("control_valve") | ||
| if not self.valve: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[pylint] reported by reviewdog 🐶
R1705: Unnecessary "else" after "return", remove the "else" and de-indent the code inside it (no-else-return)
| # Get pre_view_classify element from pipeline | ||
| # Below we add a probe to the sink pad of pre_view_classify to monitor detected objects | ||
| self.pre_view_classify = self.pipeline.get_by_name("pre_view_classify") | ||
| if not self.pre_view_classify: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[pylint] reported by reviewdog 🐶
R1705: Unnecessary "else" after "return", remove the "else" and de-indent the code inside it (no-else-return)
|
|
||
| # Get sink pad of pre_view_classify | ||
| pre_view_classify_pad = self.pre_view_classify.get_static_pad("sink") | ||
| if not pre_view_classify_pad: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[pylint] reported by reviewdog 🐶
R1705: Unnecessary "else" after "return", remove the "else" and de-indent the code inside it (no-else-return)
| return Gst.PadProbeReturn.OK | ||
|
|
||
| rmeta = GstAnalytics.buffer_get_analytics_relation_meta(buffer) | ||
| if not rmeta: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[pylint] reported by reviewdog 🐶
R1705: Unnecessary "else" after "return", remove the "else" and de-indent the code inside it (no-else-return)
| return Gst.PadProbeReturn.OK | ||
| else: | ||
| for mtd in rmeta: | ||
| if type(mtd) == GstAnalytics.ODMtd: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[pylint] reported by reviewdog 🐶
C0123: Use isinstance() rather than type() for a typecheck. (unidiomatic-typecheck)
| return False | ||
| return True | ||
|
|
||
| def object_detector_callback(self, pad, info, u_data): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[pylint] reported by reviewdog 🐶
W0613: Unused argument 'pad' (unused-argument)
| return False | ||
| return True | ||
|
|
||
| def object_detector_callback(self, pad, info, u_data): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[pylint] reported by reviewdog 🐶
W0613: Unused argument 'u_data' (unused-argument)
| except KeyboardInterrupt as e: | ||
| print(f"Interrupted by user. Stopping pipeline...[{e}]") | ||
| terminate = True | ||
| except Exception as e: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[pylint] reported by reviewdog 🐶
W0718: Catching too general exception Exception (broad-exception-caught)
| print(f"Debug info: {debug_info}") | ||
| terminate = True | ||
| if msg.type == Gst.MessageType.EOS: | ||
| print(f"Pipeline complete.") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[pylint] reported by reviewdog 🐶
W1309: Using an f-string that does not have any interpolated variables (f-string-without-interpolation)
| print("# DL Streamer Open/Close Valve Sample #") | ||
| print("# ====================================== #\n") | ||
|
|
||
| def main(): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[pylint] reported by reviewdog 🐶
R1710: Either all return statements in a function should return an expression, or none of them should. (inconsistent-return-statements)
| Gst.MessageType.EOS | Gst.MessageType.ERROR) | ||
| if msg: | ||
| if msg.type == Gst.MessageType.ERROR: | ||
| err, debug_info = msg.parse_error() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[pylint] reported by reviewdog 🐶
W0612: Unused variable 'err' (unused-variable)
| * [Draw Face Attributes C++ Sample](./cpp/draw_face_attributes/README.md) - constructs pipeline and sets "C" callback to access frame metadata and visualize inference results | ||
| 3. Python samples | ||
| * [Draw Face Attributes Python Sample](./python/draw_face_attributes/README.md) - constructs pipeline and sets Python callback to access frame metadata and visualize inference results | ||
| * [Open Close Valve Sample](./python/open_close_valve/README.md) - constructs pipeline with two sinks. On of them has valve element, which is managed based object detection result and opened/closed by callback. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
add web link to the 'valve' element gstreamer description
New DLStreamer sample to show how to use valve element in DLS pipeline.