Instructions to use litert-community/U2Net-Portrait-Sketch-LiteRT with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- LiteRT
How to use litert-community/U2Net-Portrait-Sketch-LiteRT with LiteRT:
# No code snippets available yet for this library. # To use this model, check the repository files and the library's documentation. # Want to help? PRs adding snippets are welcome at: # https://github.com/huggingface/huggingface.js
- Notebooks
- Google Colab
- Kaggle
the result was not as expected
Hi @aiplayman
Thanks for sharing the screenshot! Based on the faint/washed-out look of your output sketch (and the missing hair details), it looks like the input pixels are not ImageNet-normalized. While you fixed the tensor shape to NCHW, could you please double-check your preprocessing code? Specifically, for every pixel, your math should look like this before writing to the input buffer:
- Divide the RGB values by 255.0 to scale them to [0.0, 1.0].
- Subtract the ImageNet mean: [0.485, 0.456, 0.406].
- Divide by the ImageNet standard deviation: [0.229, 0.224, 0.225].
If you only divide by 255 and skip the mean/std math, the model receives strictly positive numbers instead of values centered around zero. This causes the neural network to perceive the image as overly bright, which washes out all the dark shading and hair!
Please give that math a try! If you are still getting the same result after applying the ImageNet normalization, could you please share the reproduction steps so we can take a closer look? Thank you!

