mirror of https://github.com/vladmandic/human
distance based on minkowski space and limited euclidean space
parent
8de79a92b2
commit
75f3e3c269
|
@ -9,6 +9,9 @@ Repository: **<git+https://github.com/vladmandic/human.git>**
|
|||
|
||||
## Changelog
|
||||
|
||||
### **HEAD -> main** 2021/03/12 mandic00@live.com
|
||||
|
||||
|
||||
### **1.1.1** 2021/03/12 mandic00@live.com
|
||||
|
||||
- switched face embedding to mobileface
|
||||
|
|
24
TODO.md
24
TODO.md
|
@ -1,7 +1,25 @@
|
|||
# To-Do list for Human library
|
||||
|
||||
- Strong typing
|
||||
- Automated testing
|
||||
- Explore EfficientPose
|
||||
## Big Ticket Items
|
||||
|
||||
- Strong(er) typing
|
||||
- Automated testing framework
|
||||
|
||||
## Explore Models
|
||||
|
||||
- EfficientPose
|
||||
<https://github.com/daniegr/EfficientPose>
|
||||
<https://github.com/PINTO0309/PINTO_model_zoo/tree/main/084_EfficientPose>
|
||||
- ArcFace
|
||||
- RetinaFace
|
||||
- CenterFace
|
||||
|
||||
## WiP Items
|
||||
|
||||
- Embedding:
|
||||
- Try average of flipped image
|
||||
- Try with variable aspect ratio
|
||||
|
||||
## Issues
|
||||
|
||||
*N/A*
|
||||
|
|
|
@ -24,7 +24,7 @@ const userConfig = {
|
|||
|
||||
const human = new Human(userConfig); // new instance of human
|
||||
|
||||
const samples = ['../assets/sample-me.jpg', '../assets/sample6.jpg', '../assets/sample1.jpg', '../assets/sample4.jpg', '../assets/sample5.jpg', '../assets/sample3.jpg', '../assets/sample2.jpg'];
|
||||
// const samples = ['../assets/sample-me.jpg', '../assets/sample6.jpg', '../assets/sample1.jpg', '../assets/sample4.jpg', '../assets/sample5.jpg', '../assets/sample3.jpg', '../assets/sample2.jpg'];
|
||||
// const samples = ['../assets/sample-me.jpg', '../assets/sample6.jpg', '../assets/sample1.jpg', '../assets/sample4.jpg', '../assets/sample5.jpg', '../assets/sample3.jpg', '../assets/sample2.jpg',
|
||||
// '../private/me (1).jpg', '../private/me (2).jpg', '../private/me (3).jpg', '../private/me (4).jpg', '../private/me (5).jpg', '../private/me (6).jpg', '../private/me (7).jpg', '../private/me (8).jpg',
|
||||
// '../private/me (9).jpg', '../private/me (10).jpg', '../private/me (11).jpg', '../private/me (12).jpg', '../private/me (13).jpg'];
|
||||
|
@ -57,7 +57,7 @@ async function analyze(face) {
|
|||
const canvases = document.getElementsByClassName('face');
|
||||
for (const canvas of canvases) {
|
||||
// calculate simmilarity from selected face to current one in the loop
|
||||
const res = human.simmilarity(face.embedding, all[canvas.tag.sample][canvas.tag.face].embedding);
|
||||
const res = human.simmilarity(face.embedding, all[canvas.tag.sample][canvas.tag.face].embedding, 3);
|
||||
// draw the canvas and simmilarity score
|
||||
canvas.title = res;
|
||||
await human.tf.browser.toPixels(all[canvas.tag.sample][canvas.tag.face].tensor, canvas);
|
||||
|
@ -98,8 +98,8 @@ async function faces(index, res) {
|
|||
}
|
||||
}
|
||||
|
||||
async function add(index) {
|
||||
log('Add image:', samples[index]);
|
||||
async function add(index, image) {
|
||||
log('Add image:', index + 1, image);
|
||||
return new Promise((resolve) => {
|
||||
const img = new Image(100, 100);
|
||||
img.onload = () => { // must wait until image is loaded
|
||||
|
@ -107,14 +107,27 @@ async function add(index) {
|
|||
document.getElementById('images').appendChild(img); // and finally we can add it
|
||||
resolve(true);
|
||||
};
|
||||
img.title = samples[index];
|
||||
img.src = samples[index];
|
||||
img.title = image;
|
||||
img.src = encodeURI(image);
|
||||
});
|
||||
}
|
||||
|
||||
async function main() {
|
||||
await human.load();
|
||||
for (const i in samples) await add(i); // download and analyze all images
|
||||
// enumerate all sample images in /assets
|
||||
let res = await fetch('/assets');
|
||||
let dir = (res && res.ok) ? await res.json() : [];
|
||||
let images = dir.filter((img) => (img.endsWith('.jpg') && img.includes('sample')));
|
||||
|
||||
// enumerate additional private test images in /private, not includded in git repository
|
||||
res = await fetch('/private');
|
||||
dir = (res && res.ok) ? await res.json() : [];
|
||||
images = images.concat(dir.filter((img) => (img.endsWith('.jpg'))));
|
||||
|
||||
// download and analyze all images
|
||||
log('Enumerated:', images.length, 'images');
|
||||
for (const i in images) await add(i, images[i]);
|
||||
|
||||
log('Ready');
|
||||
}
|
||||
|
||||
|
|
11
src/human.ts
11
src/human.ts
|
@ -394,17 +394,6 @@ class Human {
|
|||
// combine results
|
||||
faceRes.push({
|
||||
...face,
|
||||
/*
|
||||
confidence: face.confidence,
|
||||
faceConfidence: face.faceConfidence,
|
||||
boxConfidence: face.boxConfidence,
|
||||
box: face.box,
|
||||
mesh: face.mesh,
|
||||
boxRaw: face.boxRaw,
|
||||
meshRaw: face.meshRaw,
|
||||
offsetRaw: face.offsetRaw,
|
||||
annotations: face.annotations,
|
||||
*/
|
||||
age: ageRes.age,
|
||||
gender: genderRes.gender,
|
||||
genderConfidence: genderRes.confidence,
|
||||
|
|
2
wiki
2
wiki
|
@ -1 +1 @@
|
|||
Subproject commit cef8c9cc9f09f8709cd4bd1daff817a59df4b4d1
|
||||
Subproject commit ac5d01255f2f02de6b308b82976c5866c458f149
|
Loading…
Reference in New Issue