PDA

View Full Version : How to use Multiprocessing


pradeep
06-23-2014, 03:31 AM
hi sir,

I am currently working in vizard where i try to develop an application in which it has to monitor blink detection of the user as well as the region of interest towards avatar face. I have both the functions done and working well. Now what i have to do its to make the two functions run at the same time using some MULTIPROCESSING. I try to use vizmultiprocess but still i could't get and idea how to work on it. Please kindly help me to resolve this problem

Jeff
06-23-2014, 04:04 AM
You can have multiple functions registered with different vizact.onupdate and vizact.ontimer commands running at the same time. That maybe all you need for your application. How are you currently calling these functions?

pradeep
06-23-2014, 07:38 AM
Now i simply try calling the functions using the multiprocessing in actual python code. but it doesn't works. and now i tried using vizmultiprocess but still i dono how to use it exactly. The blinkdetection() and regionofinterest() are my two functions which has to be run independently from each other and it should start at same time and end at same time when i try to execute where the blinkdetection() function has to run at the background. Is it possible to do here.

pradeep
06-24-2014, 12:09 AM
Even i tried with ontimer() function as given in help document of vizard. But i cant get any output from that. It was simply static

import vizact

def Blink_Detection()
print 'inside blink detection function'
............
some process...........
....................

vizact.ontimer2(3,3,Blink_Detection)


but this code does not give any output. Could you please correct me where i should change my mistakes in the code. And also help me to add another function along with my code (say RegionofInterest())

thank you,

pradeep
06-25-2014, 03:21 AM
Hello,

Can the scenario what i try to tell can be possible. If so please kindly help telling me as early as possible. I m struck out with my work because of this....


Thank you.

Jeff
06-30-2014, 09:53 AM
This is possible but it's difficult to know what the problem is without seeing more code. The Blink_Detection function should get called 4 times (1 + 3 repeats). Are you getting an error in your script?

pradeep
06-30-2014, 10:21 PM
I am not getting any error but when i use vizmultiprocess or multiprocessing option in python the functions are not running parallel rather one function get executed fully first and then second one starts.

Jeff
07-01-2014, 11:10 AM
In the following example code both functions get called once a second. Is this along the lines of what you're trying to do?

import viz
import vizact

viz.go()

def Blink_Detection():
print 'inside blink detection'

def Region_of_Interest():
print 'inside region of interest'

vizact.ontimer(1,Blink_Detection)
vizact.ontimer(1,Region_of_Interest)

pradeep
07-01-2014, 11:03 PM
Hi,
Ya Thanks a lot it works but still some real-time data that i get from the eye-tracker but since the time gap between the each function to be called.

I hope this might be sufficient if still more any other options available could you please tell me.


Thank you