apocaliss92's picture
Coral (Edge TPU) builds of yunet-2023mar and yolox-tiny-plate (CamStack D710 addendum)
afd88f9 verified
|
Raw History Blame Contribute Delete
3.76 kB
---
license: mit
library_name: onnx
tags:
- face-detection
- yunet
- camstack
---
# YuNet 2023mar — CamStack build
Face detector with 5 landmarks, re-packaged for the CamStack inference pool.
Selectable on the `face-detection` step as `yunet-2023mar`.
| Format | File | Precision |
| --- | --- | --- |
| ONNX | `onnx/camstack-yunet-2023mar.onnx` | fp32 |
| OpenVINO IR | `openvino/camstack-yunet-2023mar.{xml,bin}` | fp32 |
| CoreML | `coreml/camstack-yunet-2023mar.mlpackage` | fp16 |
| TFLite (Coral Edge TPU) | `tflite/camstack-yunet-2023mar_edgetpu.tflite` | int8 |
| TFLite (CPU, the Edge TPU file's source) | `tflite/camstack-yunet-2023mar_int8.tflite` | int8 |
## Source
- Model: `face_detection_yunet_2023mar.onnx` from OpenCV Zoo,
<https://github.com/opencv/opencv_zoo/tree/main/models/face_detection_yunet>
(mirrored at <https://huggingface.co/opencv/face_detection_yunet>),
sha256 `8f2383e4dd3cfbb4553ea8718107fc0423210dc964f9f4280604804ed2552fa4`.
- Training code: <https://github.com/ShiqiYu/libfacedetection.train> (BSD-3-Clause).
- Paper: Wu, Peng, Yu, "YuNet: A Tiny Millisecond-level Face Detector",
Machine Intelligence Research, 2023.
## Modifications
The only change to the upstream graph is a two-node prefix that adapts the
input contract: the input `image` takes **RGB float in [0,1]** (NCHW,
1×3×640×640); `Mul(255)` then `Gather([2,1,0], axis=1)` turn it into the
**BGR 0..255** tensor the upstream graph expects. Outputs are unchanged and
named `cls_{8,16,32}`, `obj_{8,16,32}`, `bbox_{8,16,32}`, `kps_{8,16,32}`.
The OpenVINO and CoreML files are converted from that patched ONNX. Built by
`scripts/build-yunet-model.py` in the CamStack repository.
The TFLite files are built by `scripts/build-yunet-edgetpu.py` from the patched
ONNX: the two-node prefix is folded into the first convolution (the same
function — the Edge TPU has no Gather), the graph is quantised to full integer
(int8, per-channel weights; input uint8 with scale 1/255, so raw RGB bytes are
the [0,1] tensor) on CamStack person crops, and the Edge TPU file is that graph
compiled with `edgetpu_compiler` 14.1. Output names are unchanged.
## Training data
YuNet was trained on **WIDER FACE** (<http://shuoyang1213.me/WIDERFACE/>),
whose images are distributed under a **Creative Commons BY-NC-ND** licence.
The model weights are released by their authors under MIT (below). Whether a
dataset's non-commercial terms extend to a model trained on it is not settled;
this caveat applies to essentially every public face detector trained on WIDER
FACE, and is stated here so it is not lost.
## Licence
The model weights are MIT-licensed:
```
MIT License
Copyright (c) 2020 Shiqi Yu <shiqi.yu@gmail.com>
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
```