Selfie segmentation: single-channel mask is passed through sigmoid twice

Đang mở
#1,660 0 bình luận 0 reaction 1 người được giao Xem trên GitHub

Maintainer thường phản hồi trong vòng 1 ngày

@barhanc đang làm issue này rồi.

Từ ngày 27/11/2026.

Đánh giá

Issue này chưa được đánh giá.

Mô tả

model
Description

For single-output-channel models the semantic segmentation task applies sigmoid -> x255 -> GRAY2RGBA (src/extensions/cv/tasks/semanticSegmentation.ts). The selfie segmentation XNNPACK export already ends in a sigmoid, so the returned mask is sigmoid(sigmoid(x)).

Observed mask values on a 1024x685 photo of three people:

  • grey values span only 116-199 instead of 0-255
  • the histogram is bimodal at ~128 (65 % of pixels, = sigmoid(0)) and ~186 (30 %, = sigmoid(1))
  • thresholding at 128 marks 98.8 % of the image as "person"; thresholding at sigmoid(0.5)*255 = 159 gives 32 %, which matches the picture

Effect for apps: overlaying the mask as alpha gives 0.5-0.73 everywhere instead of a 0/1 cut-out.

Expected: mask in the full 0-255 range (either the export returns logits, or the task skips the sigmoid for this model).

Steps to reproduce
  1. Load the selfie segmentation model from the registry, XNNPACK fp32 (file from the v0.10.0 tag).
  2. Run it on any photo with a person.
  3. Build a histogram of the returned mask (R channel).
  4. Values stay within about 116-199.
Snack or a link to a repository

No response

React Native Executorch version

0.11.0 (code path re-checked in the 0.11.1 npm package)

React Native version

0.88.1 (Expo 58)

Platforms

iOS, Android

JavaScript runtime

No response

Workflow

No response

Architecture

No response

Build type

No response

Device

No response

Device model

iPhone 17 (iOS 26.5.2), Galaxy S23 (Android 16)

AI model

Selfie segmentation XNNPACK fp32

Performance logs

No response

Acknowledgements

Yes

Ngôn ngữ chính
TypeScript
Star
1.8k
Fork
102
Merge trung bình
2 ngày 6 giờ
Pull request đã merge (30 ngày)
46

Chuẩn bị môi trường

Bắt đầu từ đâu

  1. Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
  2. Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
  3. Fork repository và làm thay đổi trên một nhánh.
  4. Mở pull request có tham chiếu số hiệu của issue.

Issue khác của software-mansion/react-native-executorch

Tất cả issue của software-mansion/react-native-executorch

Issue tương tự

Thêm issue về TypeScript

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.