question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Issue when using m.draw

See original GitHub issue

Hello.

THank you for your code. I’ve installed your rmn with pip install rmn. It works fine when i’m using this

video_capture = cv2.VideoCapture(0)
m = RMN()
_, frame = video_capture.read()
results = m.detect_emotion_for_single_frame(frame)
frame = m.draw(frame, results)

But, i’ve wanted to try using your model with pre-detected face image (since i’ll probably use another face detector). SO, for that case i’ve changed code like this

video_capture = cv2.VideoCapture(0)
m = RMN()
_, frame = video_capture.read()

face = m.detect_faces(frame)
xmin = face[0]["xmin"]
ymin = face[0]["ymin"]
xmax = face[0]["xmax"]
ymax = face[0]["ymax"]

frame = cv2.cvtColor(frame, cv2.COLOR_BGR2GRAY)
face_image = frame[ymin:ymax, xmin:xmax]
results = m.detect_emotion_for_single_face_image(face_image)
frame = m.draw(frame, results)

And i’ve got error on m.draw


Traceback (most recent call last):
  File "/home/daddywesker/EmotionRecognition/RMN/testing_rmn.py", line 20, in <module>
    frame = m.draw(frame, results)
  File "/home/daddywesker/anaconda3/envs/rmn/lib/python3.7/site-packages/rmn/__init__.py", line 208, in draw
    xmin = r["xmin"]
TypeError: string indices must be integers

Process finished with exit code 1

which is kinda understandable, since result in that case doesn’t contain all the necessary fields for drawing and it’s structure is slightly different. So, maybe you should add some “if” check to avoid that error? Or just let now user what he should send to m.draw.

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Comments:5 (3 by maintainers)

github_iconTop GitHub Comments

3reactions
DaddyWeskercommented, Jul 13, 2021

=) Done

1reaction
phamquiluancommented, Jul 13, 2021

@DaddyWesker Thank you for reporting the issue, I’ve pushed some docstring, hope it helps 😂

Read more comments on GitHub >

github_iconTop Results From Across the Web

Draw feature issues in Word and One Note
When trying to use the draw feature in Word and One Note on the Interactive Panel the writing freezes and then starts again....
Read more >
Drawing Basics: When It Hurts to Draw - Artists Network
The bad news: for many, the pain is chronic and often interferes severely with their passion for drawing. The good news: everyone can...
Read more >
Clicking instead of Dragging Messes up the Drawing #861
I'm reporting a bug, not asking for help; I've looked at the documentation to make sure the behaviour is documented and expected
Read more >
Triple strength utility of the Modified Drug Adherence Work-Up ...
The M-DRAW tool is shown to be reliable and valid. A tailored intervention reduced the number of barriers contributing to medication nonadherence and...
Read more >
Canvas draw behind div issue - javascript - Stack Overflow
I'm using a javascript to draw inside a canvas, but I'm getting this weird issue where I cant "draw behind" the div of...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found