You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I'm experimenting with the com.google.mlkit:segmentation-selfie:16.0.0-beta5 and the selfie segmentation sample code. Idk why sometimes 0.9 threshold below works and sometimes in different rooms I have to change it to 0.2. Apparently it is very prone to environment and lighting conditions.
Can you make it more stable and prone to lighting conditions in the future versions?
private int[] maskColorsFromByteBuffer(ByteBuffer byteBuffer) {
@ColorInt int[] colors = new int[maskWidth * maskHeight];
for (int i = 0; i < maskWidth * maskHeight; i++) {
float backgroundLikelihood = 1 - byteBuffer.getFloat();
if (backgroundLikelihood > 0.9) {
colors[i] = Color.argb(128, 255, 0, 255);
} else if (backgroundLikelihood > 0.2) {
// Linear interpolation to make sure when backgroundLikelihood is 0.2, the alpha is 0 and
// when backgroundLikelihood is 0.9, the alpha is 128.
// +0.5 to round the float value to the nearest int.
int alpha = (int) (182.9 * backgroundLikelihood - 36.6 + 0.5);
colors[i] = Color.argb(alpha, 255, 0, 255);
}
}
return colors;
}
The text was updated successfully, but these errors were encountered:
arianaa30
changed the title
[Bug report] Title for the bug
Selfie Segmentation confidence threshold
Apr 15, 2024
I'm experimenting with the
com.google.mlkit:segmentation-selfie:16.0.0-beta5
and the selfie segmentation sample code. Idk why sometimes0.9
threshold below works and sometimes in different rooms I have to change it to0.2
. Apparently it is very prone to environment and lighting conditions.Can you make it more stable and prone to lighting conditions in the future versions?
The text was updated successfully, but these errors were encountered: