cocoa-xu / evision

Evision: An OpenCV-Erlang/Elixir binding
https://evision.app
Apache License 2.0
323 stars 22 forks source link

Unexpected crash without any errors during face detection #187

Closed lawik closed 1 year ago

lawik commented 1 year ago

I have this project for an upcoming talk and I was looking at integrating the face detection thing from Evision.

Project: https://github.com/lawik/lively/blob/face/lib/lively_web/live/media_live.ex#L403

That link takes you to the piece needed to restore Face detection functionality.

To run, just normal phoenix project. To start/trigger the transcription and the evision stuff, just click anywhere on the page at localhost:4000.

The Membrane Pipeline I use would crash whenever I successfully capture a face. I have no idea why, just quiet fail which triggers a LiveView reload.

cocoa-xu commented 1 year ago

Hi @lawik, in my experiment, writing to "priv/static/assets" seems to trigger the live reloading feature and Membrane.RawAudio (I'm not sure about the exact module, but you get it) won't reload properly causing this issue.

This can also be triggered if you edit any source code while it is running.

You can test this theory using my branch here: https://github.com/cocoa-xu/lively/tree/live-reload-cause-membrane-to-crash

The changes I made: https://github.com/cocoa-xu/lively/commit/17d63484210dee4174800e7a647e99f234e911de

cocoa-xu commented 1 year ago

For a possible solution to this issue, you can make a symbolic link "priv/static/assets/face.png" that points back to "../../face.png", and update the image at "../../face.png", but read from "priv/static/assets/face.png" (i.e., "assets/face.png").

# assume in root dir of lively
cd priv/static/assets
rm -f face.png && ln -s ../../face.png face.png
lawik commented 1 year ago

Thank you! Will try that. It was such a weird behavior with no errors. Makes sense it was triggering the reload.

Thank you so much for debugging my app for me 🙏❤️✨

cocoa-xu commented 1 year ago

No worries XD! (Just got back home from my Easter holidays)