Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Consider switching model to centerface_bnmerged.onnx #39

Closed
3 tasks done
mdraw opened this issue Jun 1, 2023 · 1 comment
Closed
3 tasks done

Consider switching model to centerface_bnmerged.onnx #39

mdraw opened this issue Jun 1, 2023 · 1 comment
Labels
enhancement New feature or request

Comments

@mdraw
Copy link
Member

mdraw commented Jun 1, 2023

Judging from the file name, https://github.com/Star-Clouds/CenterFace/blob/master/models/onnx/centerface_bnmerged.onnx is probably a model that is equivalent to the currently included one, with batch normalization ops merged into the adjacent convolution layers - a cheap and straightforward optimization for inference. Replacing the current model with the "bnmerged" version, deface runs a few percent faster than earlier in preliminary tests (CPU execution with opencv and onnxruntime backends).

TODO:

  • Measure performance improvement with longer running tests
    • Neglegible impact on OpenCV-based inference but ONNX-Runtime was about 10% to 20% faster in most tests.
  • Verify that results are comparable.
  • If above results are positive, replace the model file, update the credits section in the readme and make a new release.
@mdraw mdraw added the enhancement New feature or request label Jun 1, 2023
@mdraw
Copy link
Member Author

mdraw commented Jun 1, 2023

Comparing the two onnx models in https://netron.app/ the network structures indeed look the same (even including node IDs, so we don't have to do any code changes), except for the eliminated batch norm layers in the "bnmerged" model.

@mdraw mdraw closed this as completed in a023f97 Jul 4, 2023
StealUrKill pushed a commit to StealUrKill/anonfaces that referenced this issue Sep 21, 2023
commit 1976ac5
Author: mdraw <martin.drawitsch@gmail.com>
Date:   Wed Jul 19 16:06:50 2023 +0200

    readme: Add docs for mosaic filter

commit 4a91126
Merge: 7082b35 d9393c6
Author: Martin Drawitsch <martin.drawitsch@gmail.com>
Date:   Wed Jul 19 16:01:07 2023 +0200

    Merge pull request ORB-HD#42 from Shazi199/master

    add replace with mosaic option

commit d9393c6
Author: shazi199 <shazi199@gmail.com>
Date:   Fri Jul 14 16:40:00 2023 +0800

    add replace with mosaic option

commit 7082b35
Author: mdraw <martin.drawitsch@gmail.com>
Date:   Tue Jul 4 15:36:59 2023 +0200

    Use LRU cache for shape transformation

    Only cache transform if shapes are actually the same

commit 814e6a2
Author: mdraw <martin.drawitsch@gmail.com>
Date:   Tue Jul 4 15:22:23 2023 +0200

    Don't cache input shapes because they can vary

    Input shape transforms were previously only calculated once (i.e. for
    one frame / one image) and then cached for all subsequent calls.
    This is fine in 99% of use cases but if you want to process differently
    shaped inputs in the same deface process (given multiple input paths),
    this leads to crashes or even silently incorrect outputs.

    Transforms now have to be recalculated for each frame but this is
    very cheap, so it's okay to do this for the sake of better stability.

    Fixes ORB-HD#41

commit a023f97
Author: mdraw <martin.drawitsch@gmail.com>
Date:   Mon Jul 3 22:54:34 2023 +0200

    Switch model to bn-optimized version, update docs

    Slightly improves resource usage. End results are the same.
    Closes ORB-HD#39.

commit c555264
Author: mdraw <martin.drawitsch@gmail.com>
Date:   Mon Jun 5 03:24:33 2023 +0200

    Auto-select optimal ORT Execution Provider

    Accelerated onnxruntime execution providers like OpenVINO are now
    automatically selected for inference if available. The presumably fastest
    provider is chosen by default. To override this choice you can use the new
    --execution-provider CLI argument.

    Fixes ORB-HD#40.

commit ca5c651
Author: Martin Drawitsch <martin.drawitsch@gmail.com>
Date:   Tue May 2 01:05:37 2023 +0200

    readme: Add links to badges

commit 5647935
Author: Martin Drawitsch <martin.drawitsch@gmail.com>
Date:   Mon May 1 22:34:42 2023 +0200

    readme: Add badges for PyPI and build

commit f80dfaa
Author: mdraw <martin.drawitsch@gmail.com>
Date:   Mon May 1 22:19:12 2023 +0200

    readme: Update description

commit 79f4cb4
Author: Martin Drawitsch <martin.drawitsch@gmail.com>
Date:   Mon May 1 14:44:15 2023 +0200

    Use github workflow for publishing

    Publish on PyPI automatically when a tagged release is detected.

commit 5ae6ded
Author: mdraw <martin.drawitsch@gmail.com>
Date:   Mon Apr 24 02:32:55 2023 +0200

    Switch to pyproject.toml for meta data and build

    Eliminating the need for many setup files and versioneer

commit 48b655e
Author: mdraw <martin.drawitsch@gmail.com>
Date:   Mon Apr 24 01:44:02 2023 +0200

    Add --keep-audio option

    With --keep-audio the audio track is carried over to the output file if
    the input is a video.

    Fixes ORB-HD#4

commit 0d2eba8
Merge: 852286e d013a08
Author: Martin Drawitsch <martin.drawitsch@gmail.com>
Date:   Tue Jan 10 17:47:42 2023 +0100

    Merge pull request ORB-HD#28 from mysablehats/master

    Fixes inconsistent fps issues (fps reading vs fps writing)

commit 852286e
Author: mdraw <martin.drawitsch@gmail.com>
Date:   Tue Jan 10 17:25:40 2023 +0100

    Automatically convert images to RGB color space

    Inference only works in RGB, so RGBA and grayscale images need to be
    transformed first. Output is always RGB, regardless of input format.

commit edfe190
Author: mdraw <martin.drawitsch@gmail.com>
Date:   Tue Jan 10 17:11:56 2023 +0100

    Fix centerface type hint

commit d013a08
Author: Frederico B. K <frekle@kth.se>
Date:   Thu Jun 9 10:36:07 2022 +0200

    fix 25fps issue

commit b1f0656
Author: Frederico B. K <frekle@kth.se>
Date:   Thu Jun 9 10:34:37 2022 +0200

    fix 25fps issue

commit b80a601
Author: mdraw <martin.drawitsch@gmail.com>
Date:   Wed May 18 15:48:53 2022 +0200

    Support overriding fps in --ffmpeg-config flag

    fps value still defaults to source fps, but you can now override it
    to e.g. 15 through --ffmpeg-config='{"fps": 15}'.

    Thanks for the report @Karl48071

    Closing ORB-HD#24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant