This repository provides functionality for a 3 step conversion process to convert the U2Net model from its original PyTorch format to TensorFlowLite format.
- Install the required dependencies via
pip install -r requirements.txt
- Download the pre-trained u2net model here and place it in
content/
. - Place an image of choice(.jpg) in
content/
- Run the
pth_onnx
script. The output model should appear in the root directory. - Verify the successfulness of the conversion by examining the console statements.
- Run the
convert_onnx_tf
script. The converted model will appear in the root directory. - Run the
convert_tf_tflite
script. The converted model will appear in the root directory.
The repository also includes model-dimensions.py
, which is a python script that prints the input requirements of a model. This is to facilitiate ease of integration of the model into your program.
Source code taken from farmaker47, which can be found here