How to use U^2-net in Tensorflow?
See original GitHub issueI am trying to use the u2netp_480x640_float32.pb model in Tensorflow 2.3.1 (through the Java bindings but that should not make much of a difference). However I am not sure if my use of that model is incorrect or maybe something else is wrong.
What I do: load a 640x480 RGB image into a [1, 480, 640, 3] tensor and I scale the values between -1 and 1. I feed the tensor to the inputs layer and I fetch from the Identity layer, which is [1, 480, 640, 1]
What I get:

I also tried to scale values between 0-1, 0-255, -127-127. The latter gives me:

But that is not what I expect U^2-net to do either.
Am I missing something, or am I reading from the wrong layers?
Thanks
Issue Analytics
- State:
- Created 3 years ago
- Comments:7 (5 by maintainers)
Top Results From Across the Web
patrickisroman/u2net-tensorflow - GitHub
A tensorflow implementation of the U2-Net: Going Deeper with Nested U-Structure for Salient Object Detection using Keras & Functional API.
Read more >Usage of U2Net Model in android - pytorch - Stack Overflow
Hey , the current version of code at their github which is tensorflow examples runs smooth . They have optimised i guess ....
Read more >U2Net : A machine learning model that performs object ...
U2Net is a machine learning model that allows you to crop objects in a single shot. Taking an image of a person, cat,...
Read more >Image Background Removal with U^2-Net and OpenVINO
This notebook demonstrates background removal in images using U2-Net and ... display from model.u2net import U2NET, U2NETP from openvino.runtime import Core
Read more >U$^2$-Net: Going Deeper with Nested U-Structure for Salient ...
Task Dataset Model Metric Name Metric Value Glo...
Dichotomous Image Segmentation DIS‑TE1 U2Net max F‑Measure 0.694 # 5
Dichotomous Image Segmentation DIS‑TE1 U2Net weighted F‑measure...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
@edwinRNDR It depends on the properties of the model and the properties of the framework before and after the conversion. My goal in working on the model transformation is to do integer quantization in Tensorflow Lite, but TFLite does not currently allow for variable input resolution. Without that constraint, I would prefer to generate the model with variable size inputs. I have been forced to keep the input resolution fixed in order to centralize the model conversion workflow.
@edwinRNDR Thank you for the validation. There seems to be a mistake in the conversion of the model, so I will review it. Please give me some time.