allo- / virtual_webcam_background

Use a virtual webcam background and overlays with body-pix and v4l2loopback
GNU General Public License v3.0
306 stars 48 forks source link

Collect working model parameters #12

Open allo- opened 4 years ago

allo- commented 4 years ago

Current default:

Table for the internal resolution:

(source)

To get other models use the simple_bodypix_python get-model.sh script.

Parameters:

For resnet you need to change the preprocessing in the source. The quant2 and quant1 models do not work with this script (I am not sure why).

What parameters are working best for you?

allo- commented 4 years ago

Use this bug for discussion and add your parameters here: https://github.com/allo-/virtual_webcam_background/wiki/model-parameters

fangfufu commented 4 years ago

Sorry, but I can't edit your wiki. I think you have set the permission wrong. There are wiki pages which I can edit, e.g. https://github.com/libfuse/libfuse/wiki/Filesystems

Anyways, the parameters for https://github.com/fangfufu/Linux-Fake-Background-Webcam are:

segmentation_threshold: 0.75
blur: 30
erode: 0
dilate: 20
virtual_video_device: "/dev/video2"
real_video_device: "/dev/video0"
average_masks: 3
layers:
- "empty": [["image", "background.jpg"]]
- "foreground": []
multiplier: 0.75

I am wonder if it is better to have a separate config file for segmentation parameters only, so people can copy and paste things without worrying about other hardware / image related parameters.

allo- commented 4 years ago

I think you should be able to edit now.

I am wonder if it is better to have a separate config file for segmentation parameters only, so people can copy and paste things without worrying about other hardware / image related parameters.

My config already has a few parameter on top and a few on bottom and a lot of commented out layer sections in the middle and is quite chaotic as well. For frequent editing some kind of frontend would be useful.

For including config snippets with image packs and similar addons (e.g. the fog image may have a config snippet defining the parameters for the roll filter) some more modular structure would be useful, but on the other hand it adds complexity and can make it harder to tell which configs will be loaded in which order.

I wonder how frequent most people will change the config. In the first version, everything was in the code and autoreloading was a feature for replacing background.jpg without restarting the program with a new filename parameter, so it did not even need a config for the default use-case. Now it can become quite complex, even when most options should have sensible defaults when they are not present in the config.

fangfufu commented 4 years ago

I don't like the abrupt transition between the edge of the foreground and background, hence the dilation to make the mask bigger, follow by blur to smooth things out.

allo- commented 4 years ago

My current parameters are:

blur: 5
erode: 12
dilate: 10

With a difference between dilate and erode you get rid of a few artifacts from under-/oversegmentation. I think these are parameters that you probably need to tune for every different webcam/background by looking at the result.