Published
Edited
Jul 27, 2018
1 star
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Detect_DrawFace = {
const { width, height } = myImg
const canvas = await faceapi.createCanvasFromMedia(myImg)
const input = await faceapi.toNetInput(myImg)
const locations = await faceapi.locateFaces(input, minConfidence)
faceapi.drawDetection(canvas, locations.map(det => det.forSize(width, height)))
const faceImages = await faceapi.extractFaces(input, locations)
input.dispose()
return faceImages
}
Insert cell
Download_DrawFace = Detect_DrawFace[0]
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
fullFaceDescriptions = await faceapi.allFaces(myImg, minConfidence)
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Dectect_DrawLandmarks_fn(canvasHtml)
Insert cell
Insert cell
Insert cell
Detect_DrawFace_canvas = Detect_DrawFace_fn_upload(canvasHtml)
Insert cell
Detect_DrawFace_for_download = Detect_DrawFace_canvas[0]
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
uploadedImageCanvas = {
const div = html`<div>`;
for (var j = 0; j < uploadedImage.length; j++) {
let file = uploadedImage[j];
let img = html`<img height="500px" />`
img.src = await Files.url(uploadedImage[j]);
div.append(img);
}
return div;
}
Insert cell
Detect_DrawFace_fn_upload(faceapi.createCanvasFromMedia(uploadedImageCanvas))
Insert cell
faceapi.getMediaDimensions(canvasHtml)
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
// create box for typing names
Insert cell
classes = ['BradleyCooper','KevinSpacey','BradPitt','JuliaRoberts', 'EllenDeGeneres', 'AngelinaJolie', 'ChanningTatum','JenniferLawrence','LupitaNyongio', 'MerylStreep', 'PeterNyongioJr']
Insert cell
trainDescriptorsByClass = await initTrainDescriptorsByClass(faceapi.recognitionNet)
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
canvas_temp = detectAndRecognizeFaces(input_temp)
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell

Purpose-built for displays of data

Observable is your go-to platform for exploring data and creating expressive data visualizations. Use reactive JavaScript notebooks for prototyping and a collaborative canvas for visual data exploration and dashboard creation.
Learn more