Face Detection (Userscript Example)
Model Homepage
Use case examples
- Blur faces prior to annotation
- Annotate another feature on the face
Code
const model = await blazeface.load();
let canvas = diffgram.get_new_canvas()
const returnTensors = false; // Pass in `true` to get tensors back, rather than values.
const predictions = await model.estimateFaces(
canvas, returnTensors);
console.log(predictions)
if (predictions[0]) {
diffgram.create_box(
predictions[0].bottomRight[0],
predictions[0].bottomRight[1],
predictions[0].topLeft[0],
predictions[0].topLeft[1])
} else {
diffgram.show_snackbar("None found")
}
Updated over 3 years ago