human/typedoc/modules/match.html

43 lines
18 KiB
HTML

<!DOCTYPE html><html class="default"><head><meta charSet="utf-8"/><meta http-equiv="x-ua-compatible" content="IE=edge"/><title>match | @vladmandic/human - v2.6.4</title><meta name="description" content="Documentation for @vladmandic/human - v2.6.4"/><meta name="viewport" content="width=device-width, initial-scale=1"/><link rel="stylesheet" href="../assets/style.css"/><link rel="stylesheet" href="../assets/highlight.css"/><script async src="../assets/search.js" id="search-script"></script></head><body><script>document.body.classList.add(localStorage.getItem("tsd-theme") || "os")</script><header><div class="tsd-page-toolbar"><div class="container"><div class="table-wrap"><div class="table-cell" id="tsd-search" data-base=".."><div class="field"><label for="tsd-search-field" class="tsd-widget search no-caption">Search</label><input type="text" id="tsd-search-field"/></div><ul class="results"><li class="state loading">Preparing search index...</li><li class="state failure">The search index is not available</li></ul><a href="../index.html" class="title">@vladmandic/human - v2.6.4</a></div><div class="table-cell" id="tsd-widgets"><div id="tsd-filter"><a href="#" class="tsd-widget options no-caption" data-toggle="options">Options</a><div class="tsd-filter-group"><div class="tsd-select" id="tsd-filter-visibility"><span class="tsd-select-label">All</span><ul class="tsd-select-list"><li data-value="public">Public</li><li data-value="protected">Public/Protected</li><li data-value="private" class="selected">All</li></ul></div> <input type="checkbox" id="tsd-filter-inherited" checked/><label class="tsd-widget" for="tsd-filter-inherited">Inherited</label></div></div><a href="#" class="tsd-widget menu no-caption" data-toggle="menu">Menu</a></div></div></div></div><div class="tsd-page-title"><div class="container"><ul class="tsd-breadcrumb"><li><a href="../index.html">@vladmandic/human - v2.6.4</a></li><li><a href="match.html">match</a></li></ul><h1>Namespace match</h1></div></div></header><div class="container container-main"><div class="row"><div class="col-8 col-content"><section class="tsd-panel tsd-comment"><div class="tsd-comment tsd-typography"><div class="lead">
<p>Class Human as default export</p>
</div></div></section><section class="tsd-panel-group tsd-index-group"><h2>Index</h2><section class="tsd-panel tsd-index-panel"><div class="tsd-index-content"><section class="tsd-index-section "><h3>Type aliases</h3><ul class="tsd-index-list"><li class="tsd-kind-type-alias tsd-parent-kind-namespace"><a href="match.html#Descriptor" class="tsd-kind-icon">Descriptor</a></li><li class="tsd-kind-type-alias tsd-parent-kind-namespace"><a href="match.html#MatchOptions" class="tsd-kind-icon">Match<wbr/>Options</a></li></ul></section><section class="tsd-index-section "><h3>Functions</h3><ul class="tsd-index-list"><li class="tsd-kind-function tsd-parent-kind-namespace"><a href="match.html#distance" class="tsd-kind-icon">distance</a></li><li class="tsd-kind-function tsd-parent-kind-namespace"><a href="match.html#match-1" class="tsd-kind-icon">match</a></li><li class="tsd-kind-function tsd-parent-kind-namespace"><a href="match.html#similarity" class="tsd-kind-icon">similarity</a></li></ul></section></div></section></section><section class="tsd-panel-group tsd-member-group "><h2>Type aliases</h2><section class="tsd-panel tsd-member tsd-kind-type-alias tsd-parent-kind-namespace"><a id="Descriptor" class="tsd-anchor"></a><h3 class="tsd-anchor-link">Descriptor<a href="#Descriptor" aria-label="Permalink" class="tsd-anchor-icon"><svg xmlns="http://www.w3.org/2000/svg" class="icon icon-tabler icon-tabler-link" viewBox="0 0 24 24" stroke-width="2" stroke="currentColor" fill="none" stroke-linecap="round" stroke-linejoin="round"><path stroke="none" d="M0 0h24v24H0z" fill="none"></path><path d="M10 14a3.5 3.5 0 0 0 5 0l4 -4a3.5 3.5 0 0 0 -5 -5l-.5 .5"></path><path d="M14 10a3.5 3.5 0 0 0 -5 0l-4 4a3.5 3.5 0 0 0 5 5l.5 -.5"></path></svg></a></h3><div class="tsd-signature tsd-kind-icon">Descriptor<span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">number</span><span class="tsd-signature-symbol">[]</span></div><aside class="tsd-sources"><ul><li>Defined in <a href="https://github.com/vladmandic/human/blob/main/src/face/match.ts#L2">src/face/match.ts:2</a></li></ul></aside><div class="tsd-comment tsd-typography"><div class="lead">
<p>Face descriptor type as number array</p>
</div></div></section><section class="tsd-panel tsd-member tsd-kind-type-alias tsd-parent-kind-namespace"><a id="MatchOptions" class="tsd-anchor"></a><h3 class="tsd-anchor-link">Match<wbr/>Options<a href="#MatchOptions" aria-label="Permalink" class="tsd-anchor-icon"><svg xmlns="http://www.w3.org/2000/svg" class="icon icon-tabler icon-tabler-link" viewBox="0 0 24 24" stroke-width="2" stroke="currentColor" fill="none" stroke-linecap="round" stroke-linejoin="round"><path stroke="none" d="M0 0h24v24H0z" fill="none"></path><path d="M10 14a3.5 3.5 0 0 0 5 0l4 -4a3.5 3.5 0 0 0 -5 -5l-.5 .5"></path><path d="M14 10a3.5 3.5 0 0 0 -5 0l-4 4a3.5 3.5 0 0 0 5 5l.5 -.5"></path></svg></a></h3><div class="tsd-signature tsd-kind-icon">Match<wbr/>Options<span class="tsd-signature-symbol">:</span> <span class="tsd-signature-symbol">{ </span>max<span class="tsd-signature-symbol">?: </span><span class="tsd-signature-type">number</span><span class="tsd-signature-symbol">; </span>min<span class="tsd-signature-symbol">?: </span><span class="tsd-signature-type">number</span><span class="tsd-signature-symbol">; </span>multiplier<span class="tsd-signature-symbol">?: </span><span class="tsd-signature-type">number</span><span class="tsd-signature-symbol">; </span>order<span class="tsd-signature-symbol">?: </span><span class="tsd-signature-type">number</span><span class="tsd-signature-symbol">; </span>threshold<span class="tsd-signature-symbol">?: </span><span class="tsd-signature-type">number</span><span class="tsd-signature-symbol"> }</span><span class="tsd-signature-symbol"> | </span><span class="tsd-signature-type">undefined</span></div><aside class="tsd-sources"><ul><li>Defined in <a href="https://github.com/vladmandic/human/blob/main/src/face/match.ts#L3">src/face/match.ts:3</a></li></ul></aside></section></section><section class="tsd-panel-group tsd-member-group "><h2>Functions</h2><section class="tsd-panel tsd-member tsd-kind-function tsd-parent-kind-namespace"><a id="distance" class="tsd-anchor"></a><h3 class="tsd-anchor-link">distance<a href="#distance" aria-label="Permalink" class="tsd-anchor-icon"><svg xmlns="http://www.w3.org/2000/svg" class="icon icon-tabler icon-tabler-link" viewBox="0 0 24 24" stroke-width="2" stroke="currentColor" fill="none" stroke-linecap="round" stroke-linejoin="round"><path stroke="none" d="M0 0h24v24H0z" fill="none"></path><path d="M10 14a3.5 3.5 0 0 0 5 0l4 -4a3.5 3.5 0 0 0 -5 -5l-.5 .5"></path><path d="M14 10a3.5 3.5 0 0 0 -5 0l-4 4a3.5 3.5 0 0 0 5 5l.5 -.5"></path></svg></a></h3><ul class="tsd-signatures tsd-kind-function tsd-parent-kind-namespace"><li class="tsd-signature tsd-kind-icon">distance<span class="tsd-signature-symbol">(</span>descriptor1<span class="tsd-signature-symbol">: </span><a href="match.html#Descriptor" class="tsd-signature-type" data-tsd-kind="Type alias">Descriptor</a>, descriptor2<span class="tsd-signature-symbol">: </span><a href="match.html#Descriptor" class="tsd-signature-type" data-tsd-kind="Type alias">Descriptor</a>, options<span class="tsd-signature-symbol">?: </span><a href="match.html#MatchOptions" class="tsd-signature-type" data-tsd-kind="Type alias">MatchOptions</a><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">number</span></li></ul><ul class="tsd-descriptions"><li class="tsd-description"><aside class="tsd-sources"><ul><li>Defined in <a href="https://github.com/vladmandic/human/blob/main/src/face/match.ts#L12">src/face/match.ts:12</a></li></ul></aside><div class="tsd-comment tsd-typography"><div class="lead">
<p>Calculates distance between two descriptors</p>
</div></div><h4 class="tsd-parameters-title">Parameters</h4><ul class="tsd-parameters"><li><h5>descriptor1: <a href="match.html#Descriptor" class="tsd-signature-type" data-tsd-kind="Type alias">Descriptor</a></h5></li><li><h5>descriptor2: <a href="match.html#Descriptor" class="tsd-signature-type" data-tsd-kind="Type alias">Descriptor</a></h5></li><li><h5>options: <a href="match.html#MatchOptions" class="tsd-signature-type" data-tsd-kind="Type alias">MatchOptions</a><span class="tsd-signature-symbol"> = ...</span></h5><div class="tsd-comment tsd-typography"><div class="lead">
<p>calculation options</p>
<ul>
<li>order - algorithm to use
Euclidean distance if <code>order</code> is 2 (default), Minkowski distance algorithm of nth order if <code>order</code> is higher than 2</li>
<li>multiplier - by how much to enhance difference analysis in range of 1..100
default is 20 which normalizes results to similarity above 0.5 can be considered a match</li>
</ul>
</div></div></li></ul><h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">number</span></h4></li></ul></section><section class="tsd-panel tsd-member tsd-kind-function tsd-parent-kind-namespace"><a id="match-1" class="tsd-anchor"></a><h3 class="tsd-anchor-link">match<a href="#match-1" aria-label="Permalink" class="tsd-anchor-icon"><svg xmlns="http://www.w3.org/2000/svg" class="icon icon-tabler icon-tabler-link" viewBox="0 0 24 24" stroke-width="2" stroke="currentColor" fill="none" stroke-linecap="round" stroke-linejoin="round"><path stroke="none" d="M0 0h24v24H0z" fill="none"></path><path d="M10 14a3.5 3.5 0 0 0 5 0l4 -4a3.5 3.5 0 0 0 -5 -5l-.5 .5"></path><path d="M14 10a3.5 3.5 0 0 0 -5 0l-4 4a3.5 3.5 0 0 0 5 5l.5 -.5"></path></svg></a></h3><ul class="tsd-signatures tsd-kind-function tsd-parent-kind-namespace"><li class="tsd-signature tsd-kind-icon">match<span class="tsd-signature-symbol">(</span>descriptor<span class="tsd-signature-symbol">: </span><a href="match.html#Descriptor" class="tsd-signature-type" data-tsd-kind="Type alias">Descriptor</a>, descriptors<span class="tsd-signature-symbol">: </span><a href="match.html#Descriptor" class="tsd-signature-type" data-tsd-kind="Type alias">Descriptor</a><span class="tsd-signature-symbol">[]</span>, options<span class="tsd-signature-symbol">?: </span><a href="match.html#MatchOptions" class="tsd-signature-type" data-tsd-kind="Type alias">MatchOptions</a><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span><span class="tsd-signature-symbol">{ </span>distance<span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">number</span><span class="tsd-signature-symbol">; </span>index<span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">number</span><span class="tsd-signature-symbol">; </span>similarity<span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">number</span><span class="tsd-signature-symbol"> }</span></li></ul><ul class="tsd-descriptions"><li class="tsd-description"><aside class="tsd-sources"><ul><li>Defined in <a href="https://github.com/vladmandic/human/blob/main/src/face/match.ts#L56">src/face/match.ts:56</a></li></ul></aside><div class="tsd-comment tsd-typography"><div class="lead">
<p>Matches given descriptor to a closest entry in array of descriptors</p>
</div></div><h4 class="tsd-parameters-title">Parameters</h4><ul class="tsd-parameters"><li><h5>descriptor: <a href="match.html#Descriptor" class="tsd-signature-type" data-tsd-kind="Type alias">Descriptor</a></h5><div class="tsd-comment tsd-typography"><div class="lead">
<p>face descriptor</p>
</div></div></li><li><h5>descriptors: <a href="match.html#Descriptor" class="tsd-signature-type" data-tsd-kind="Type alias">Descriptor</a><span class="tsd-signature-symbol">[]</span></h5><div class="tsd-comment tsd-typography"><div class="lead">
<p>array of face descriptors to commpare given descriptor to</p>
</div></div></li><li><h5>options: <a href="match.html#MatchOptions" class="tsd-signature-type" data-tsd-kind="Type alias">MatchOptions</a><span class="tsd-signature-symbol"> = ...</span></h5><div class="tsd-comment tsd-typography"><div class="lead">
<p>see <code>similarity</code> method for options description
Returns</p>
<ul>
<li><code>index</code> index array index where best match was found or -1 if no matches</li>
<li><code>distance</code> calculated <code>distance</code> of given descriptor to the best match</li>
<li><code>similarity</code> calculated normalized <code>similarity</code> of given descriptor to the best match</li>
</ul>
</div></div></li></ul><h4 class="tsd-returns-title">Returns <span class="tsd-signature-symbol">{ </span>distance<span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">number</span><span class="tsd-signature-symbol">; </span>index<span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">number</span><span class="tsd-signature-symbol">; </span>similarity<span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">number</span><span class="tsd-signature-symbol"> }</span></h4><ul class="tsd-parameters"><li class="tsd-parameter"><h5>distance<span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">number</span></h5></li><li class="tsd-parameter"><h5>index<span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">number</span></h5></li><li class="tsd-parameter"><h5>similarity<span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">number</span></h5></li></ul></li></ul></section><section class="tsd-panel tsd-member tsd-kind-function tsd-parent-kind-namespace"><a id="similarity" class="tsd-anchor"></a><h3 class="tsd-anchor-link">similarity<a href="#similarity" aria-label="Permalink" class="tsd-anchor-icon"><svg xmlns="http://www.w3.org/2000/svg" class="icon icon-tabler icon-tabler-link" viewBox="0 0 24 24" stroke-width="2" stroke="currentColor" fill="none" stroke-linecap="round" stroke-linejoin="round"><path stroke="none" d="M0 0h24v24H0z" fill="none"></path><path d="M10 14a3.5 3.5 0 0 0 5 0l4 -4a3.5 3.5 0 0 0 -5 -5l-.5 .5"></path><path d="M14 10a3.5 3.5 0 0 0 -5 0l-4 4a3.5 3.5 0 0 0 5 5l.5 -.5"></path></svg></a></h3><ul class="tsd-signatures tsd-kind-function tsd-parent-kind-namespace"><li class="tsd-signature tsd-kind-icon">similarity<span class="tsd-signature-symbol">(</span>descriptor1<span class="tsd-signature-symbol">: </span><a href="match.html#Descriptor" class="tsd-signature-type" data-tsd-kind="Type alias">Descriptor</a>, descriptor2<span class="tsd-signature-symbol">: </span><a href="match.html#Descriptor" class="tsd-signature-type" data-tsd-kind="Type alias">Descriptor</a>, options<span class="tsd-signature-symbol">?: </span><a href="match.html#MatchOptions" class="tsd-signature-type" data-tsd-kind="Type alias">MatchOptions</a><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">number</span></li></ul><ul class="tsd-descriptions"><li class="tsd-description"><aside class="tsd-sources"><ul><li>Defined in <a href="https://github.com/vladmandic/human/blob/main/src/face/match.ts#L42">src/face/match.ts:42</a></li></ul></aside><div class="tsd-comment tsd-typography"><div class="lead">
<p>Calculates normalized similarity between two face descriptors based on their <code>distance</code></p>
</div></div><h4 class="tsd-parameters-title">Parameters</h4><ul class="tsd-parameters"><li><h5>descriptor1: <a href="match.html#Descriptor" class="tsd-signature-type" data-tsd-kind="Type alias">Descriptor</a></h5></li><li><h5>descriptor2: <a href="match.html#Descriptor" class="tsd-signature-type" data-tsd-kind="Type alias">Descriptor</a></h5></li><li><h5>options: <a href="match.html#MatchOptions" class="tsd-signature-type" data-tsd-kind="Type alias">MatchOptions</a><span class="tsd-signature-symbol"> = ...</span></h5><div class="tsd-comment tsd-typography"><div class="lead">
<p>calculation options</p>
<ul>
<li>order - algorithm to use
Euclidean distance if <code>order</code> is 2 (default), Minkowski distance algorithm of nth order if <code>order</code> is higher than 2</li>
<li>multiplier - by how much to enhance difference analysis in range of 1..100
default is 20 which normalizes results to similarity above 0.5 can be considered a match</li>
<li>min - normalize similarity result to a given range</li>
<li>max - normalzie similarity resutl to a given range
default is 0.2...0.8
Returns similarity between two face descriptors normalized to 0..1 range where 0 is no similarity and 1 is perfect similarity</li>
</ul>
</div></div></li></ul><h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">number</span></h4></li></ul></section></section></div><div class="col-4 col-menu menu-sticky-wrap menu-highlight"><nav class="tsd-navigation primary"><ul><li class=""><a href="../index.html">Exports</a></li><li class=" tsd-kind-namespace"><a href="Tensor.html">Tensor</a></li><li class=" tsd-kind-namespace"><a href="draw.html">draw</a></li><li class="current tsd-kind-namespace"><a href="match.html">match</a></li><li class=" tsd-kind-namespace"><a href="models.html">models</a></li></ul></nav><nav class="tsd-navigation secondary menu-sticky"><ul><li class="tsd-kind-type-alias tsd-parent-kind-namespace"><a href="match.html#Descriptor" class="tsd-kind-icon">Descriptor</a></li><li class="tsd-kind-type-alias tsd-parent-kind-namespace"><a href="match.html#MatchOptions" class="tsd-kind-icon">Match<wbr/>Options</a></li><li class="tsd-kind-function tsd-parent-kind-namespace"><a href="match.html#distance" class="tsd-kind-icon">distance</a></li><li class="tsd-kind-function tsd-parent-kind-namespace"><a href="match.html#match-1" class="tsd-kind-icon">match</a></li><li class="tsd-kind-function tsd-parent-kind-namespace"><a href="match.html#similarity" class="tsd-kind-icon">similarity</a></li></ul></nav></div></div></div><footer class=""><div class="container"><h2>Legend</h2><div class="tsd-legend-group"><ul class="tsd-legend"><li class="tsd-kind-constructor tsd-parent-kind-class"><span class="tsd-kind-icon">Constructor</span></li><li class="tsd-kind-property tsd-parent-kind-class"><span class="tsd-kind-icon">Property</span></li><li class="tsd-kind-method tsd-parent-kind-class"><span class="tsd-kind-icon">Method</span></li></ul><ul class="tsd-legend"><li class="tsd-kind-property tsd-parent-kind-interface"><span class="tsd-kind-icon">Property</span></li><li class="tsd-kind-method tsd-parent-kind-interface"><span class="tsd-kind-icon">Method</span></li></ul></div><h2>Settings</h2><p>Theme <select id="theme"><option value="os">OS</option><option value="light">Light</option><option value="dark">Dark</option></select></p></div></footer><div class="overlay"></div><script src="../assets/main.js"></script></body></html>