Skip to content
New issue

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

added mp_selfie_segmentation (MediaPipe) filter #140

Merged
merged 11 commits into from
Jul 4, 2021
Merged

Conversation

de-code
Copy link
Owner

@de-code de-code commented Jul 3, 2021

Added a segmentation filter using MediaPipe's Selfie Segmentation.

Had to drop Python 3.6 for this.
As the Selfie Segmentation is only in MediaPipe 0.8.5 and above. But the last MediaPipe version with Python 3.6 support is 0.8.3.

@de-code de-code self-assigned this Jul 3, 2021
@de-code
Copy link
Owner Author

de-code commented Jul 3, 2021

Seem to segfault occasionally:

logs
Fatal Python error: PyEval_SaveThread: NULL tstate
Python runtime state: initialized

Thread 0x00007fd2b157d700 (most recent call first):
  File "/path/to/layered-vision/layered_vision/utils/opencv.py", line 261 in iter_delay_video_images_to_fps
  File "/path/to/layered-vision/layered_vision/utils/opencv.py", line 164 in read_all_loop
  File "/usr/lib/python3.8/threading.py", line 870 in run
  File "/usr/lib/python3.8/threading.py", line 932 in _bootstrap_inner
  File "/usr/lib/python3.8/threading.py", line 890 in _bootstrap

Thread 0x00007fd2d366c700 (most recent call first):
  File "/path/to/layered-vision/layered_vision/utils/opencv.py", line 62 in read
  File "/path/to/layered-vision/layered_vision/utils/opencv.py", line 185 in iter_read_raw_video_images
  File "/path/to/layered-vision/layered_vision/utils/opencv.py", line 245 in iter_delay_video_images_to_fps
  File "/path/to/layered-vision/layered_vision/utils/opencv.py", line 164 in read_all_loop
  File "/usr/lib/python3.8/threading.py", line 870 in run
  File "/usr/lib/python3.8/threading.py", line 932 in _bootstrap_inner
  File "/usr/lib/python3.8/threading.py", line 890 in _bootstrap

Thread 0x00007fd2e9ad0740 (most recent call first):
  File "/path/to/layered-vision/venv/lib/python3.8/site-packages/mediapipe/python/solution_base.py", line 307 in process
  File "/path/to/layered-vision/venv/lib/python3.8/site-packages/mediapipe/python/solutions/selfie_segmentation.py", line 76 in process
  File "/path/to/layered-vision/layered_vision/filters/mp_selfie_segmentation.py", line 94 in get_segmentation_mask
  File "/path/to/layered-vision/layered_vision/filters/mp_selfie_segmentation.py", line 101 in do_filter
  File "/path/to/layered-vision/layered_vision/filters/api.py", line 64 in filter
  File "/path/to/layered-vision/layered_vision/app.py", line 394 in get_filter_image
  File "/path/to/layered-vision/layered_vision/app.py", line 400 in get_next_image
  File "/path/to/layered-vision/layered_vision/app.py", line 285 in __next__
  File "/path/to/layered-vision/layered_vision/utils/lazy_image.py", line 41 in get_image
  File "/path/to/layered-vision/layered_vision/utils/lazy_image.py", line 17 in image
  File "/path/to/layered-vision/layered_vision/utils/lazy_image.py", line 53 in get_image
  File "/path/to/layered-vision/layered_vision/utils/lazy_image.py", line 17 in image
  File "/path/to/layered-vision/layered_vision/utils/lazy_image.py", line 58 in resolve_lazy_image
  File "/path/to/layered-vision/layered_vision/filters/api.py", line 64 in filter
  File "/path/to/layered-vision/layered_vision/app.py", line 394 in get_filter_image
  File "/path/to/layered-vision/layered_vision/app.py", line 400 in get_next_image
  File "/path/to/layered-vision/layered_vision/app.py", line 285 in __next__
  File "/path/to/layered-vision/layered_vision/utils/lazy_image.py", line 41 in get_image
  File "/path/to/layered-vision/layered_vision/utils/lazy_image.py", line 17 in image
  File "/path/to/layered-vision/layered_vision/utils/lazy_image.py", line 53 in get_image
  File "/path/to/layered-vision/layered_vision/utils/lazy_image.py", line 17 in image
  File "/path/to/layered-vision/layered_vision/utils/lazy_image.py", line 58 in resolve_lazy_image
  File "/path/to/layered-vision/layered_vision/filters/api.py", line 64 in filter
  File "/path/to/layered-vision/layered_vision/app.py", line 394 in get_filter_image
  File "/path/to/layered-vision/layered_vision/app.py", line 400 in get_next_image
  File "/path/to/layered-vision/layered_vision/app.py", line 285 in __next__
  File "/path/to/layered-vision/layered_vision/utils/lazy_image.py", line 41 in get_image
  File "/path/to/layered-vision/layered_vision/utils/lazy_image.py", line 17 in image
  File "/path/to/layered-vision/layered_vision/utils/lazy_image.py", line 53 in get_image
  File "/path/to/layered-vision/layered_vision/utils/lazy_image.py", line 17 in image
  File "/path/to/layered-vision/layered_vision/utils/lazy_image.py", line 58 in resolve_lazy_image
  File "/path/to/layered-vision/layered_vision/filters/api.py", line 64 in filter
  File "/path/to/layered-vision/layered_vision/app.py", line 394 in get_filter_image
  File "/path/to/layered-vision/layered_vision/app.py", line 400 in get_next_image
  File "/path/to/layered-vision/layered_vision/app.py", line 285 in __next__
  File "/path/to/layered-vision/layered_vision/utils/lazy_image.py", line 41 in get_image
  File "/path/to/layered-vision/layered_vision/utils/lazy_image.py", line 17 in image
  File "/path/to/layered-vision/layered_vision/utils/lazy_image.py", line 53 in get_image
  File "/path/to/layered-vision/layered_vision/utils/lazy_image.py", line 17 in image
  File "/path/to/layered-vision/layered_vision/utils/lazy_image.py", line 58 in resolve_lazy_image
  File "/path/to/layered-vision/layered_vision/filters/api.py", line 64 in filter
  File "/path/to/layered-vision/layered_vision/app.py", line 394 in get_filter_image
  File "/path/to/layered-vision/layered_vision/app.py", line 400 in get_next_image
  File "/path/to/layered-vision/layered_vision/app.py", line 285 in __next__
  File "/path/to/layered-vision/layered_vision/utils/lazy_image.py", line 41 in get_image
  File "/path/to/layered-vision/layered_vision/utils/lazy_image.py", line 17 in image
  File "/path/to/layered-vision/layered_vision/filters/composite.py", line 16 in <listcomp>
  File "/path/to/layered-vision/layered_vision/filters/composite.py", line 15 in do_filter
  File "/path/to/layered-vision/layered_vision/filters/composite.py", line 24 in filter
  File "/path/to/layered-vision/layered_vision/app.py", line 394 in get_filter_image
  File "/path/to/layered-vision/layered_vision/app.py", line 400 in get_next_image
  File "/path/to/layered-vision/layered_vision/app.py", line 285 in __next__
  File "/path/to/layered-vision/layered_vision/app.py", line 588 in get_frame_for_layer
  File "/path/to/layered-vision/layered_vision/app.py", line 597 in next_frame
  File "/path/to/layered-vision/layered_vision/app.py", line 610 in run
  File "/path/to/layered-vision/layered_vision/cli.py", line 102 in run
  File "/path/to/layered-vision/layered_vision/cli.py", line 130 in run
  File "/path/to/layered-vision/layered_vision/cli.py", line 138 in main
  File "/path/to/layered-vision/layered_vision/__main__.py", line 7 in <module>
  File "/usr/lib/python3.8/runpy.py", line 87 in _run_code
  File "/usr/lib/python3.8/runpy.py", line 194 in _run_module_as_main
Aborted (core dumped)

@de-code de-code merged commit 9d7ebc7 into develop Jul 4, 2021
@de-code de-code deleted the mp-segmentation branch July 4, 2021 00:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant