This uses the excellent Annotorious annotation tool from Recogito in combination with face-api.js to detect faces in IIIF images in the browser.
Annotorious integrates into Openseadragon which is one of the IIIF Image API viewers.
The face-api.js uses a JavaScript version of tenserflow and in this version a Single Shot Multibox Detector machine learning model to identify faces and return x,y,width,heigh in the image. My code then converts them to W3C annotations and passes them to Annotorious to draw them on to Openseadragon.
Try your own IIIF Image URL (URL should end with info.json
):
IIIF Image URL:
View
This isn't a perfect solution but does work on the following images:
- National Library of Wales, Photograph by John Thomas - (Image at NLW)
- National Library of Wales, Photograph by Geoff Charles - multiple people in photo - (Image at NLW)
- National Library of Wales, Photograph by Geoff Charles - Men with hats - (Image at NLW)
The results for the following are not so great:
- Group portrait from Library of The Jewish Theological Seminary - (Image in Europeana)
- National Library of Wales, Photograph by Geoff Charles - multiple people some not looking at camera - (Image at NLW)