ORB-HD / deface

Video anonymization by face detection
MIT License
684 stars 95 forks source link

Consider switching model to centerface_bnmerged.onnx #39

Closed mdraw closed 1 year ago

mdraw commented 1 year ago

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:

mdraw commented 1 year ago

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.