v0.0.2 #4
samhaswon
announced in
Announcements
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
Changes
Roughly doubled dataset size to 1,216 samples (1,134 training)
Added 2 new data augments
Added more dataset information
Added dlmv model (DeepLabV3 + MobileNetV3 backbone)
deeplabv3_mobilenet_v3_largefromtorchvisionAdded BiRefNet_lite
Added StraightU2Net
Added U2NetP chunk refiner model
Added quantitative testing results
mIoU, mIoU@0.5, MAE, and HCE.
Inference time (CPU) with PyTorch and ONNX Runtime.
Added various other traditional methods
Usage
(batch, channels, height, width)
birefnet*(1, 3, 1728, 1728)(1, 1, 1728, 1728)u2net*(1, 3, 1024, 1024)(1, 1, 1024, 1024)u2netp*(1, 3, 512, 512)(1, 1, 512, 512)u2netp_chunks(1, 4, 512, 512)(1, 1, 512, 512)sunet*(1, 3, 320, 320)(1, 1, 320, 320)dlmv*(1, 3, 256, 256)(1, 1, 256, 256)For the U2Net models, you want the 0th item of the list or tuple as demonstrated in the included Session class. Inputs should be normed to [0, 1] by dividing by 255, and the outputs should be normed then multiplied by 255 for usage in uint8.
This release contains a fair number of files with a variety of names. Here's the idea behind the naming scheme.
Prefix:
u2net: The big U2Net modelu2netp: The smaller, more mobile-friendly U2NetP modeldlmv: The DeepLabV3 + MobileNetV3 backbone modelbirefnet: BiRefNet_litebirefnet_22.onnxuses opset version 22, namely DeformConv, which might not be available in your runtime.sunet: StraightU2Net_quant: Indicates a quantized model:Note: PyTorch exports of quantized models have not been tested by me.
_fbgemmuses PyTorch'sfbgemmbackend_qnnpackuses PyTorch'sqnnpackbackendu2netp_chunks: The refiner modelFile extension
.onnx: ONNX model.pth: PyTorch model.pth.tar: Training checkpoint with complete state["state"]["state_dict"]for model weightsThis repo includes an example session class in
u2net/that should work for both U2Net Models, the DeepLabV3 + MobileNetV3 backbone model, and StraightU2Net.For torch inference, grab the U2Net/dlmv/StraightU2Net/BiRefNet files from here: https://github.com/samhaswon/rembg-trainer-cuda/tree/segmentation-gradients/model
Then import the model and torch. Then:
You could probably set
weights_only=Trueand be fine, this is just what I do in my code. It should just be weights in there.Results
Base models/methods:
Training Set
Time: 89343.20s (~24.8 hours)
Evaluation Set
Time: 11442.24s
Quantized models:
*Note: BiRefNet in FP32 takes ~14GB of memory with PyTorch, but ~40GB with ONNX Runtime at 1728x1728.
Chunked Inference
Checksums
u2net.onnxac44f925c222a842d51d60f336e766621fc3593bced20a3624663dc0022c97edu2net.pth84ebf1d09899e1b2d4d02532f1d5287027d12cf3b09bbfb133bcfc17c6f8be10u2net_quant_fbgemm.onnxec50b4863b85b320d477402ec1a0a5d785440b6297aa87c6f6c6ecb6f751a555u2net_quant_fbgemm.ptha40ed1292fbf9b7b1b6f3aea319cb5fb8aa4563bb4fa90ba616ca6ab8a136e0fu2net_quant_qnnpack.onnx912cb9700569f9f0cff51f0988a31bb44ae554406d5565d0c1ca892eb7a90018u2net_quant_qnnpack.pth65146c2a7a1a175f87653c4ed3648ef1ee84b9d9deaf5898033ee983db6b6e5cu2net_state.pth.tar119e06f99ceb7cf424caa922aae429db444d435c19985662b1f92e4f0098f03cu2netp.onnxb6d2e3ecb212d66ce53144de6db9b75ec8b6adfa787bde4143674491bc012f02u2netp.pthb52eb0bb45841554a07b88c4d7a3099868b1e6a7f8da9c562ae2e937486c28a1u2netp_state.pth.tara2162d851f6d98d4d8b0469a86e650bf7741d96a01fb1f4cf0066b4bde608d55u2netp_quant_fbgemm.onnxc4f7b3fa4fd9d9693e3a666505ca84311a93191eb67cdb138abbdb3aba6a1a4eu2netp_quant_fbgemm.pth6396354288987c49c4597864843fc7259c2c11ade5a7fc6608b7eec5305fd25du2netp_quant_qnnpack.onnxdd5f2e310e847793714947492f98b5f15b7d49319f85df5cb195b540e70379f9u2netp_quant_qnnpack.pth248eeecad19d0bd26890540882477f6abaec9f71ce76463c75eb8087dae54cfdu2netp_chunks.onnx657bdf94e7f1a66d8f0d36b645023cb06368c48b48b47f7c6502d835d5457b49u2netp_chunks.pth270b41eccde731a259c13e08928b12d5288c74202f7791171fc90830b93e50f9u2netp_chunks_state.pth.tar8c5019504142155aacd6184aa82274eef68525b14d5ef589c8b0d45067e78f06dlmv.onnx5ac700f23396ea285abb1ec5193ab647b3a8e25a04cb1f8244584df228c548f7dlmv.pth8ab3d1352d428e7c8f918b48dcf48485df9ac5d2b90599cf8bdf27710f683dbedlmv_quant_fbgemm.onnx3e6e602405f9ddbda6b2aa0b30ed60987b62d5f1c36c7385d79eea530fb75117dlmv_quant_fbgemm.pth4f48d4e2d3397b046ea57a3267c927206d15f5cf940b13741e20306e94a9b561dlmv_quant_qnnpack.onnx654608c0265f5458dd867aa61a2fe874a18095e853a344c68a6b65707c5b4d84dlmv_quant_qnnpack.pthc15ebcb68c3a40fac467cdddbbe9b5f5837c2a47164bdc55bdb221dfbaada586dlmv_state.pth.tar3f6acb2a8ba3fbb78019c93f3880bb2460f23120374ac0eca4f914a502acd6c0birefnet.onnx290db14e4f924b9125d17bc2aa4153827981d4cdef20d7ce88117fb8f36301cfbirefnet_22.onnx35105318e23cf4d1985ed3454a5580f44d5362070e0794db73056f402475f8a4birefnet.pth07928b2232666e0fe79469ea2a7ebed56cecd9a704a537d75488501230f8c277birefnet_state.pth.tar7d0c74209f091c216e1fa6e81b9ac59bcf5d5374b822fb426b033dcec31fa063sunet.onnxe5ca8d698ee782c12bb150c2725d16b0dbe072b9d82dcd04d45e653c22a6e0a0sunet.pth2140cadf30033e87b40b5a33d97490ae0a7f944ff53988a45c8cbac8cd6f9906sunet_state.pth.tar1fe5ec7d899f8a1bc5cb8e12578ae711db10b2271affd10c4dbd14ee79b09469Full Changelog: v0.0.1...v0.0.2
This discussion was created from the release v0.0.2.
Beta Was this translation helpful? Give feedback.
All reactions