-
Notifications
You must be signed in to change notification settings - Fork 5.1k
-
Notifications
You must be signed in to change notification settings - Fork 5.1k
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
Use button to switch over to another mode(PoseTrackingGpu/ObjectDetection) #2839
Comments
Hi @UnityDev1021, Have you tried any implementation and What is the error noticed while switching the models? |
Hi there @sgowroji, I have not yet tried to implement anything but I am thinking of making a single graph consisting of both PoseTracking and ObjectDetection subgraph and using a SwitchConatiner to switch between the two Subgraphs, as I cannot find any other way to stop and start a new graph as of now. The only problem is I do not know of any way to supply a value to the SwitchContainer Node at runtime(pretty new to Mediapipe). If there is a way to do it, I would really appreciate to know about it. Also, if I run the Single graph having the 2 sub-graphs, will the 2 sub-graphs run simultaneously or only the sub-graph that is being selected by the SwitchContainer? For eg:- If I pass a boolean value of FALSE to the Switch Container, then the PoseTracking sub-graph should run and vice-versa. I don't want both the sub-graphs to run at a time to reduce the load. If there is any alternate way to do the above things where I can just specify 2 main graphs and have the application switch between the 2, then it can also be helpful to me. Any help is appreciated. |
@sgowroji An update. So I wrote some sample code to try out the SwitchContainerCalculator strategy but unfortunately it does not work. I made a simple TestCalculator which accepts the "select" value of the SwitchContainerCalculator and based on that outputs a String which I can then display using a TextView. I used this code to change the input_side_packet of the SwitchContainerCalculator :-
I am using a button to call this method, and a TextView to check the output of the calculator. Unfortunately it gives me this error at runtime when I try to click the button:-
And now I am stuck again and don't know how to proceed further as I am out of ideas. I can see that the processor is responsible for calling the graph at this code :-
So, I was thinking of changing this at runtime. Again no idea as to how I can change it as I think that I would have to restart the whole thing including the camera and the graph, so yeah, awaiting for any help. |
To reroute packets through an already running graph, "SwitchContainerCalculator" must be controlled using an input stream rather than an input-side-packet. SwitchContainerCalculator does accept input streams similar to its input side packets. Also, a common design pattern for switching calculator options is to re-start the graph with a new configuration and/or new side-packets, so you can consider that design alternative. |
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you. |
Closing as stale. Please reopen if you'd like to work on this further. |
System information (Please provide as much relevant information as possible)
Hello, so I am currently building a project that integrates both PoseTrackingGpu and ObjectDetectionGpu. I have successfully build both the files using bazel, but now I would like to build both of them into one app and use a button to switch between the two modes. I can modify the PoseTrackingGpu graph to include both the graphs in one, but I only want one to work at a time to output a specific value and so I would like to keep both the graphs separate and switch between the 2 using a button. Is there any way to do this?
I have looked at the BUILD files but as there are 2 graphs and 1 "binaryGraphName" value, how can I switch between the 2 while the app is running, like when I press the switch button, then the current graph stops running and starts to run a new graph. Can I close the current graph and open a new one? For ex:- Open PoseTrackingGpu graph as primary, close it and start the ObjectDetectionGpu graph.
The text was updated successfully, but these errors were encountered: