breaking change : multithreading on windows
An issue appear since the multithreading update on windows 10.
cv2.dnn cant be pickle during the thread creation.
in mark_detector.py : self.face_net = cv2.dnn.readNetFromCaffe(dnn_proto_text, dnn_model)
Related stackoverflow : https://stackoverflow.com/a/11985056
Yes, multithreading is imported to speed up the entire process. However it seems not working on macOS High Sierra which I've tried, and the issue seems to be with OpenCV itself, maybe TBB related.
As there is no Windows PC at hand, I'm afraid Windows users need to figure it out by themselves. Or, this commit without multithreading could be helpful.
Yes, I posted the issue to help futur users to find the commit you indicated below more than getting a support/solution.
Maybe an OS checking or flag to activate or not multithreading will be a easy solution to put on.
PS: Thanks for your work, it helped me a lot! 👍
OS checking is a great idea which I should have thought of!
This feature will be added in the next commit. Also please feel free to send any pull request.
Hi everyone. In advance, I'm sorry for bad English. What about creating a thread instead of a process? Something like this (It works on windows):
import threading
#...
img_queue.put(sample_frame)
thread = threading.Thread(target=get_face, args=(mark_detector, img_queue, box_queue))
thread.daemon = True
thread.start()
@ins2718 Glad you make it work! I'm sure this is helpful for other Windows users.
The "multiprocess" does not work on Windows. ins2718's code work well.
@flyyufenfei123 @yinguobing Since as ins2718 said we can replace process with thread. But in the code, there still exists Queue from multiprocessing, and how should we deal with it?
I guess a pull request will make everybody happy😃
@ins2718 your Thread solution is working, I also got an error in mark_detector.py in
self.face_net.setInput(cv2.dnn.blobFromImage( image, 1.0, (300, 300), (104.0, 177.0, 123.0), False))
I removed the last parameter. I don't know what it does, I just read online that this method takes max 5 params.
and I commented in estimate_head_pose.py the line print(tm.getTimeSec()/tm.count())