keijiro / NNCam

Virtual background with Unity Barracuda
Apache License 2.0
249 stars 35 forks source link

Size of neural network input #2

Closed livingbeams closed 3 years ago

livingbeams commented 3 years ago

Congratulations on the great work.

This is more a question than an issue.

In the comment in InputStream.cs is said that the network input size is set to: const int Width = 640 + 1; const int Height = 352 + 1; Because 16 * n + 1 dimensions are required.

May I ask where do these constraint come from?

I've tried other arbitrary sizes such as 1280x720 or 1920x1080 and it seems to work properly.

Regards.

keijiro commented 3 years ago

It came from BodyPix: https://github.com/tensorflow/tfjs-models/blob/master/body-pix/src/util.ts#L72

You can safely use 1281x721 or 1281x1073, but 1280x720 and 1920x1080 may introduce degradation. In my experience, it introduces small offset in output.