add experimental mb3-centernet object detection

master
Vladimir Mandic 2021-05-19 08:27:14 -04:00
parent 534d4d77d9
commit fa896c5330
2 changed files with 22 additions and 28 deletions

@ -36,19 +36,13 @@ All configuration details can be changed in real-time!
```js ```js
const config: Config = { const config: Config = {
backend: 'webgl', // select tfjs backend to use backend: 'webgl', // select tfjs backend to use, leave empty to use default backend
// can be 'webgl', 'wasm', 'cpu', or 'humangl' which is a custom version of webgl // can be 'webgl', 'wasm', 'cpu', or 'humangl' which is a custom version of webgl
// leave as empty string to continue using default backend
// when backend is set outside of Human library
modelBasePath: '../models/', // base path for all models modelBasePath: '../models/', // base path for all models
wasmPath: '../assets/', // path for wasm binaries wasmPath: '../node_modules/@tensorflow/tfjs-backend-wasm/dist//', // path for wasm binaries, only used for backend: wasm
// only used for backend: wasm
debug: true, // print additional status messages to console debug: true, // print additional status messages to console
async: true, // execute enabled models in parallel async: true, // execute enabled models in parallel
// this disables per-model performance data but warmup: 'full', // what to use for human.warmup(), can be 'none', 'face', 'full'
// slightly increases performance
// cannot be used if profiling is enabled
warmup: 'face', // what to use for human.warmup(), can be 'none', 'face', 'full'
// warmup pre-initializes all models for faster inference but can take // warmup pre-initializes all models for faster inference but can take
// significant time on startup // significant time on startup
// only used for `webgl` and `humangl` backends // only used for `webgl` and `humangl` backends
@ -81,7 +75,7 @@ const config: Config = {
}, },
gesture: { gesture: {
enabled: true, // enable simple gesture recognition enabled: true, // enable gesture recognition based on model results
}, },
face: { face: {
@ -96,13 +90,11 @@ const config: Config = {
// this parameter is not valid in nodejs // this parameter is not valid in nodejs
maxDetected: 10, // maximum number of faces detected in the input maxDetected: 10, // maximum number of faces detected in the input
// should be set to the minimum number for performance // should be set to the minimum number for performance
skipFrames: 21, // how many frames to go without re-running the face bounding box detector skipFrames: 21, // how many max frames to go without re-running the face bounding box detector
// only used for video inputs // only used when cacheSensitivity is not zero
// e.g., if model is running st 25 FPS, we can re-use existing bounding // e.g., if model is running st 25 FPS, we can re-use existing bounding
// box for updated face analysis as the head probably hasn't moved much // box for updated face analysis as the head probably hasn't moved much
// in short time (10 * 1/25 = 0.25 sec) // in short time (10 * 1/25 = 0.25 sec)
skipInitial: false, // if previous detection resulted in no faces detected,
// should skipFrames be reset immediately to force new detection cycle
minConfidence: 0.2, // threshold for discarding a prediction minConfidence: 0.2, // threshold for discarding a prediction
iouThreshold: 0.1, // ammount of overlap between two detected objects before one object is removed iouThreshold: 0.1, // ammount of overlap between two detected objects before one object is removed
return: false, // return extracted face as tensor return: false, // return extracted face as tensor
@ -124,15 +116,16 @@ const config: Config = {
// recommended to enable detector.rotation and mesh.enabled // recommended to enable detector.rotation and mesh.enabled
modelPath: 'faceres.json', // face description model modelPath: 'faceres.json', // face description model
// can be either absolute path or relative to modelBasePath // can be either absolute path or relative to modelBasePath
skipFrames: 31, // how many frames to go without re-running the detector skipFrames: 31, // how many max frames to go without re-running the detector
// only used for video inputs // only used when cacheSensitivity is not zero
minConfidence: 0.1, // threshold for discarding a prediction minConfidence: 0.1, // threshold for discarding a prediction
}, },
emotion: { emotion: {
enabled: true, enabled: true,
minConfidence: 0.1, // threshold for discarding a prediction minConfidence: 0.1, // threshold for discarding a prediction
skipFrames: 32, // how many frames to go without re-running the detector skipFrames: 32, // how max many frames to go without re-running the detector
// only used when cacheSensitivity is not zero
modelPath: 'emotion.json', // face emotion model, can be absolute path or relative to modelBasePath modelPath: 'emotion.json', // face emotion model, can be absolute path or relative to modelBasePath
}, },
}, },
@ -144,23 +137,21 @@ const config: Config = {
maxDetected: 1, // maximum number of people detected in the input maxDetected: 1, // maximum number of people detected in the input
// should be set to the minimum number for performance // should be set to the minimum number for performance
// only valid for posenet as blazepose only detects single pose // only valid for posenet as blazepose only detects single pose
minConfidence: 0.2, // threshold for discarding a prediction minConfidence: 0.1, // threshold for discarding a prediction
}, },
hand: { hand: {
enabled: true, enabled: true,
rotation: false, // use best-guess rotated hand image or just box with rotation as-is rotation: false, // use best-guess rotated hand image or just box with rotation as-is
// false means higher performance, but incorrect finger mapping if hand is inverted // false means higher performance, but incorrect finger mapping if hand is inverted
skipFrames: 12, // how many frames to go without re-running the hand bounding box detector skipFrames: 32, // how many max frames to go without re-running the hand bounding box detector
// only used for video inputs // only used when cacheSensitivity is not zero
// e.g., if model is running st 25 FPS, we can re-use existing bounding // e.g., if model is running st 25 FPS, we can re-use existing bounding
// box for updated hand skeleton analysis as the hand probably // box for updated hand skeleton analysis as the hand probably
// hasn't moved much in short time (10 * 1/25 = 0.25 sec) // hasn't moved much in short time (10 * 1/25 = 0.25 sec)
skipInitial: false, // if previous detection resulted in no hands detected,
// should skipFrames be reset immediately to force new detection cycle
minConfidence: 0.1, // threshold for discarding a prediction minConfidence: 0.1, // threshold for discarding a prediction
iouThreshold: 0.1, // ammount of overlap between two detected objects before one object is removed iouThreshold: 0.1, // ammount of overlap between two detected objects before one object is removed
maxDetected: 1, // maximum number of hands detected in the input maxDetected: 2, // maximum number of hands detected in the input
// should be set to the minimum number for performance // should be set to the minimum number for performance
landmarks: true, // detect hand landmarks or just hand boundary box landmarks: true, // detect hand landmarks or just hand boundary box
detector: { detector: {
@ -173,14 +164,15 @@ const config: Config = {
object: { object: {
enabled: false, enabled: false,
modelPath: 'nanodet.json', // experimental: object detection model, can be absolute path or relative to modelBasePath modelPath: 'mb3-centernet.json', // experimental: object detection model, can be absolute path or relative to modelBasePath
// can be 'mb3-centernet' or 'nanodet'
minConfidence: 0.2, // threshold for discarding a prediction minConfidence: 0.2, // threshold for discarding a prediction
iouThreshold: 0.4, // ammount of overlap between two detected objects before one object is removed iouThreshold: 0.4, // ammount of overlap between two detected objects before one object is removed
maxDetected: 10, // maximum number of objects detected in the input maxDetected: 10, // maximum number of objects detected in the input
skipFrames: 41, // how many frames to go without re-running the detector skipFrames: 41, // how many max frames to go without re-running the detector
// only used when cacheSensitivity is not zero
}, },
}; };
export { config as defaults };
``` ```
<br> <br>

@ -11,7 +11,7 @@ Default models in Human library are:
- **Emotion Detection**: Oarriaga Emotion - **Emotion Detection**: Oarriaga Emotion
- **Body Analysis**: PoseNet (AtomicBits version MNv2-075-16) - **Body Analysis**: PoseNet (AtomicBits version MNv2-075-16)
- **Hand Analysis**: MediaPipe Hands - **Hand Analysis**: MediaPipe Hands
- **Object Detection**: NanoDet - **Object Detection**: MobileNet-v3 with CenterNet
## Notes ## Notes
@ -52,7 +52,8 @@ Default models in Human library are:
| Sirius-AI MobileFaceNet | 125K | mobilefacenet.json | 5.0M | mobilefacenet.bin | 139 | | Sirius-AI MobileFaceNet | 125K | mobilefacenet.json | 5.0M | mobilefacenet.bin | 139 |
| BecauseofAI MobileFace | 33K | mobileface.json | 2.1M | mobileface.bin | 75 | | BecauseofAI MobileFace | 33K | mobileface.json | 2.1M | mobileface.bin | 75 |
| FaceBoxes | 212K | faceboxes.json | 2.0M | faceboxes.bin | N/A | | FaceBoxes | 212K | faceboxes.json | 2.0M | faceboxes.bin | N/A |
| NanoDet | 255K | nanodet.json | 1.9M | nanodet.bin | 524 | | NanoDet | 255K | nanodet.json | 7.3M | nanodet.bin | 229 |
| MB3-CenterNet | 197K | nanodet.json | 1.9M | nanodet.bin | 267 |
| FaceRes | 70K | faceres.json | 6.7M | faceres.bin | 524 | | FaceRes | 70K | faceres.json | 6.7M | faceres.bin | 524 |
<br> <br>
@ -74,6 +75,7 @@ Default models in Human library are:
- Emotion Prediction: [**Oarriaga**](https://github.com/oarriaga/face_classification) - Emotion Prediction: [**Oarriaga**](https://github.com/oarriaga/face_classification)
- Face Embedding: [**BecauseofAI MobileFace**](https://github.com/becauseofAI/MobileFace) - Face Embedding: [**BecauseofAI MobileFace**](https://github.com/becauseofAI/MobileFace)
- ObjectDetection: [**NanoDet**](https://github.com/RangiLyu/nanodet) - ObjectDetection: [**NanoDet**](https://github.com/RangiLyu/nanodet)
- ObjectDetection: [**MB3-CenterNet**](https://github.com/610265158/mobilenetv3_centernet)
- Image Filters: [**WebGLImageFilter**](https://github.com/phoboslab/WebGLImageFilter) - Image Filters: [**WebGLImageFilter**](https://github.com/phoboslab/WebGLImageFilter)
- Pinto Model Zoo: [**Pinto**](https://github.com/PINTO0309/PINTO_model_zoo) - Pinto Model Zoo: [**Pinto**](https://github.com/PINTO0309/PINTO_model_zoo)