Multi-thread with the same model
When I try to detect face using bob.ip.facedetect.detect_single_face
in a multithread program (2 threads here to make it simple) AND sharing the same cascade model, one of the threads raises the following exception.
self.extractor.extract_indexed(bounding_box, self.feature, self.indices[i])
RuntimeError: bob.ip.facedetect.FeatureExtractor - cannot extract indexed features: C++ exception caught: 'argument `x' = 50 is set outside the expected range [1, 48]'
Follow bellow the code that reproduces the issue (Image attached):
import bob.ip.facedetect
import bob.io.base
import threading
cascade = bob.ip.facedetect.default_cascade()
def worker(img):
print bob.ip.facedetect.detect_single_face(img, cascade=cascade)
threads = []
for i in range(2):
img = bob.io.base.load("Yoko_Ono_0001.jpg")
t = threading.Thread(target=worker, args=(img,))
threads.append(t)
t.start()
Cheers