We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
Code:
class EmotionDetector(pr.Processor): def init(self): super(EmotionDetector, self).init() self.detect = HaarCascadeFrontalFace(draw=False) self.crop = pr.CropBoxes2D() self.classify = MiniXceptionFER() self.draw = pr.DrawBoxes2D(self.classify.class_names)
def call(self, image): boxes2d = self.detect(image)['boxes2D'] cropped_images = self.crop(image, boxes2d) results = [] for cropped_image, box2D in zip(cropped_images, boxes2d): result = self.classify(cropped_image) box2D.class_name = result['class_name'] box2D.score = np.amax(result['scores']) info = {"name": box2D.class_name, "score": float(box2D.score), "x": int(box2D.coordinates[0]), "y": int(box2D.coordinates[1]), "w": int(box2D.width), "h": int(box2D.height)} results.append(info) # print(f"result: {result} box2D: {box2D}") return results
detect = EmotionDetector() def emotion_classifier(image_bytes, width, height): numpy_array = np.asarray(image_bytes) json_detect = detect(numpy_array)
Sometimes it throws an error, and sometimes it is correct.
error1: boxes2d = self.detect(image)['boxes2D'] ^^^^^^^^^^^^^^^^^^ File "/Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/site-packages/paz/abstract/processor.py", line 54, in call return self.call(*args, **kwargs) ^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/site-packages/paz/pipelines/detection.py", line 454, in call boxes2D = self.predict(image) ^^^^^^^^^^^^^^^^^^^ File "/Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/site-packages/paz/abstract/processor.py", line 54, in call return self.call(*args, **kwargs) ^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/site-packages/paz/processors/standard.py", line 247, in call return predict(x, self.model, self.preprocess, self.postprocess) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/site-packages/paz/backend/standard.py", line 268, in predict y = model(x) ^^^^^^^^ File "/Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/site-packages/paz/models/detection/haar_cascade.py", line 47, in call boxes = self.model.detectMultiScale(*args) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ cv2.error: OpenCV(4.8.1) /Users/xperience/GHA-OpenCV-Python/_work/opencv-python/opencv-python/opencv/modules/objdetect/src/cascadedetect.hpp:46: error: (-215:Assertion failed) 0 <= scaleIdx && scaleIdx < (int)scaleData->size() in function 'getScaleData'
error2: json_detect = detect(numpy_array) ^^^^^^^^^^^^^^^^^^^ File "/Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/site-packages/paz/abstract/processor.py", line 54, in call return self.call(*args, **kwargs) ^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/Users/yuanych/research/ZLMediaKit-8.0/ZLMediaKit/Python/emotion_classifier.py", line 18, in call boxes2d = self.detect(image)['boxes2D'] ^^^^^^^^^^^^^^^^^^ File "/Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/site-packages/paz/abstract/processor.py", line 54, in call return self.call(*args, **kwargs) ^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/site-packages/paz/pipelines/detection.py", line 454, in call boxes2D = self.predict(image) ^^^^^^^^^^^^^^^^^^^ File "/Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/site-packages/paz/abstract/processor.py", line 54, in call return self.call(*args, **kwargs) ^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/site-packages/paz/processors/standard.py", line 247, in call return predict(x, self.model, self.preprocess, self.postprocess) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/site-packages/paz/backend/standard.py", line 268, in predict y = model(x) ^^^^^^^^ File "/Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/site-packages/paz/models/detection/haar_cascade.py", line 47, in call boxes = self.model.detectMultiScale(*args) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ cv2.error: vector
The text was updated successfully, but these errors were encountered:
I have similar errors, but mainly regarding the outdated argument 'lr' in the model file. Did you have such error?
Sorry, something went wrong.
No branches or pull requests
Code:
class EmotionDetector(pr.Processor):
def init(self):
super(EmotionDetector, self).init()
self.detect = HaarCascadeFrontalFace(draw=False)
self.crop = pr.CropBoxes2D()
self.classify = MiniXceptionFER()
self.draw = pr.DrawBoxes2D(self.classify.class_names)
detect = EmotionDetector()
def emotion_classifier(image_bytes, width, height):
numpy_array = np.asarray(image_bytes)
json_detect = detect(numpy_array)
Sometimes it throws an error, and sometimes it is correct.
error1:
boxes2d = self.detect(image)['boxes2D']
^^^^^^^^^^^^^^^^^^
File "/Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/site-packages/paz/abstract/processor.py", line 54, in call
return self.call(*args, **kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/site-packages/paz/pipelines/detection.py", line 454, in call
boxes2D = self.predict(image)
^^^^^^^^^^^^^^^^^^^
File "/Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/site-packages/paz/abstract/processor.py", line 54, in call
return self.call(*args, **kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/site-packages/paz/processors/standard.py", line 247, in call
return predict(x, self.model, self.preprocess, self.postprocess)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/site-packages/paz/backend/standard.py", line 268, in predict
y = model(x)
^^^^^^^^
File "/Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/site-packages/paz/models/detection/haar_cascade.py", line 47, in call
boxes = self.model.detectMultiScale(*args)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
cv2.error: OpenCV(4.8.1) /Users/xperience/GHA-OpenCV-Python/_work/opencv-python/opencv-python/opencv/modules/objdetect/src/cascadedetect.hpp:46: error: (-215:Assertion failed) 0 <= scaleIdx && scaleIdx < (int)scaleData->size() in function 'getScaleData'
error2:
json_detect = detect(numpy_array)
^^^^^^^^^^^^^^^^^^^
File "/Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/site-packages/paz/abstract/processor.py", line 54, in call
return self.call(*args, **kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Users/yuanych/research/ZLMediaKit-8.0/ZLMediaKit/Python/emotion_classifier.py", line 18, in call
boxes2d = self.detect(image)['boxes2D']
^^^^^^^^^^^^^^^^^^
File "/Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/site-packages/paz/abstract/processor.py", line 54, in call
return self.call(*args, **kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/site-packages/paz/pipelines/detection.py", line 454, in call
boxes2D = self.predict(image)
^^^^^^^^^^^^^^^^^^^
File "/Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/site-packages/paz/abstract/processor.py", line 54, in call
return self.call(*args, **kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/site-packages/paz/processors/standard.py", line 247, in call
return predict(x, self.model, self.preprocess, self.postprocess)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/site-packages/paz/backend/standard.py", line 268, in predict
y = model(x)
^^^^^^^^
File "/Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/site-packages/paz/models/detection/haar_cascade.py", line 47, in call
boxes = self.model.detectMultiScale(*args)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
cv2.error: vector
The text was updated successfully, but these errors were encountered: