Skip to content
Permalink
Browse files

v5.1.0 - 2019.11.14:

BRFv5 is now 40% faster than v5.0.x.

Model files are now structured in chunks. Load any number from 4 to 8 (lower is possible, but the accuracy won't be great).
  • Loading branch information
Marcel Klammer
Marcel Klammer committed Nov 14, 2019
1 parent 0197e3a commit 6eb9b698b6b32bf321d0c695d3e2073e98e6376e
Showing with 276 additions and 273 deletions.
  1. +7 −4 js/brfv5/brfv5__init.js
  2. +0 −128 js/brfv5/brfv5_js_tk101119_v5.0.2_trial.js
  3. +0 −127 js/brfv5/brfv5_js_tk101119_v5.0.2_trial_no_modules.js
  4. +122 −0 js/brfv5/brfv5_js_tk141119_v5.1.0_trial.js
  5. +121 −0 js/brfv5/brfv5_js_tk141119_v5.1.0_trial_no_modules.js
  6. BIN js/brfv5/models/42l_c0.brfv5
  7. BIN js/brfv5/models/42l_c1.brfv5
  8. BIN js/brfv5/models/42l_c2.brfv5
  9. BIN js/brfv5/models/42l_c3.brfv5
  10. BIN js/brfv5/models/42l_c4.brfv5
  11. BIN js/brfv5/models/42l_c5.brfv5
  12. BIN js/brfv5/models/42l_c6.brfv5
  13. BIN js/brfv5/models/42l_c7.brfv5
  14. BIN js/brfv5/models/68l_c0.brfv5
  15. BIN js/brfv5/models/68l_c1.brfv5
  16. BIN js/brfv5/models/68l_c2.brfv5
  17. BIN js/brfv5/models/68l_c3.brfv5
  18. BIN js/brfv5/models/68l_c4.brfv5
  19. BIN js/brfv5/models/68l_c5.brfv5
  20. BIN js/brfv5/models/68l_c6.brfv5
  21. BIN js/brfv5/models/68l_c7.brfv5
  22. BIN js/brfv5/models/brfv5_js_tk101119_v5.0.2_trial_42l_max.brfv5
  23. BIN js/brfv5/models/brfv5_js_tk101119_v5.0.2_trial_42l_medium.brfv5
  24. BIN js/brfv5/models/brfv5_js_tk101119_v5.0.2_trial_42l_min.brfv5
  25. BIN js/brfv5/models/brfv5_js_tk101119_v5.0.2_trial_68l_max.brfv5
  26. BIN js/brfv5/models/brfv5_js_tk101119_v5.0.2_trial_68l_medium.brfv5
  27. BIN js/brfv5/models/brfv5_js_tk101119_v5.0.2_trial_68l_min.brfv5
  28. BIN js/brfv5/models/brfv5_js_tk101119_v5.0.2_trial_fd_only.brfv5
  29. BIN js/brfv5/models/brfv5_js_tk141119_v5.1.0_trial.brfv5
  30. +2 −1 js/examples/face_tracking__choose_model.js
  31. +2 −1 js/examples/face_tracking__threejs_overlay.js
  32. +2 −1 js/examples/face_tracking__track_one_face.js
  33. +5 −3 js/examples/setup__example.js
  34. +6 −1 js/ui/ui__optional__preloader.js
  35. +1 −1 minimal__modules__png_overlay.html
  36. +1 −1 minimal__modules__track_one_face.html
  37. +7 −5 minimal__no_modules__track_one_face.html
@@ -1,17 +1,18 @@
// Set the BRFv5 import and library name here.
// Also set your own appId for reference.

import { brfv5Module } from './brfv5_js_tk101119_v5.0.2_trial.js'
import { brfv5Module } from './brfv5_js_tk141119_v5.1.0_trial.js'

const _libraryName = 'brfv5_js_tk101119_v5.0.2_trial'
const _libraryName = 'brfv5_js_tk141119_v5.1.0_trial.brfv5'
const _appId = 'brfv5.browser.examples' // (mandatory): 8 to 64 characters, a-z . 0-9 allowed

export const brfv5 = {}

let _brfv5Manager = null
let _brfv5Config = null

export const loadBRFv5Model = (modelName, pathToModels = '', appId = null, onProgress = null) => {
// numChunksToLoad: can be anything from 4 to 8.
export const loadBRFv5Model = (modelName, numChunksToLoad, pathToModels = '', appId = null, onProgress = null) => {

if(!modelName) { throw 'Please provide a modelName.' }

@@ -26,7 +27,9 @@ export const loadBRFv5Model = (modelName, pathToModels = '', appId = null, o
try {

brfv5.appId = appId ? appId : _appId
brfv5.binaryLocation = pathToModels + _libraryName + '_' + modelName + '.brfv5'
brfv5.binaryLocation = pathToModels + _libraryName
brfv5.modelLocation = pathToModels + modelName + '_c'
brfv5.modelChunks = numChunksToLoad // 4, 6, 8
brfv5.binaryProgress = onProgress
brfv5.binaryError = (e) => { reject(e) }
brfv5.onInit = (brfv5Manager, brfv5Config) => {

This file was deleted.

This file was deleted.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@@ -42,7 +42,8 @@ const exampleConfig = {
// That's why we only load 68l. min for mobile, max for desktop.
// BRFv5 can't reinitialize with a different model, so choose wisely.

modelName: SystemUtils.isMobileOS ? '68l_min' : '68l_max'
modelName: '68l',
numChunksToLoad: SystemUtils.isMobileOS ? 4 : 8,
}

// run() will be called automatically after 1 second, if run isn't called immediately after the script was loaded.
@@ -130,7 +130,8 @@ const exampleConfig = {

// See face_tracking__choose_model.js for more info about the models.

modelName: SystemUtils.isMobileOS ? '42l_min' : '42l_max',
modelName: '42l',
numChunksToLoad: SystemUtils.isMobileOS ? 4 : 8,

// If true, numTrackingPasses and enableFreeRotation will be set depending
// on the apps CPU usage. See brfv5__dynamic_performance.js for more insights.
@@ -60,7 +60,8 @@ export const handleTrackingResults = (brfv5Manager, brfv5Config, canvas) => {
const exampleConfig = {

// See face_tracking__choose_model.js for more info about the models.
modelName: SystemUtils.isMobileOS ? '68l_min' : '68l_max',
modelName: '68l',
numChunksToLoad: SystemUtils.isMobileOS ? 4 : 8,

// If true, numTrackingPasses and enableFreeRotation will be set dynamically depending
// on the app's CPU usage. See brfv5__dynamic_performance.js for more insights.
@@ -50,11 +50,12 @@ const _name = 'BRFv5Example'
// the use of the 68l model type, but the 42l is only really
// suitable for the ThreeJS example and other examples
// will fail to work properly.
const _modelType = getURLParameter(window.location.search, 'type') === '42l' ? '42l' : '68l'

// _modelName might be overwritten by the example config,
// but is only loaded once for the first example.
let _modelName = SystemUtils.isMobileOS ? _modelType + '_min' : _modelType + '_max'

let _modelName = getURLParameter(window.location.search, 'type') === '42l' ? '42l' : '68l'
let _numChunksToLoad = SystemUtils.isMobileOS ? 4 : 8

// _brfv5Manager and _brfv5Config will be set once after the
// library was loaded successfully.
@@ -144,7 +145,7 @@ export const setupExample = (config = null) => {
mountLogo(stage)
mountFullscreen(stage)

loadBRFv5Model(_modelName, './js/brfv5/models/', null, onProgress)
loadBRFv5Model(_modelName, _numChunksToLoad, './js/brfv5/models/', null, onProgress)
.then(({ brfv5Manager, brfv5Config }) => {

log(_name + ': loadBRFv5Model: done')
@@ -168,6 +169,7 @@ export const setExampleConfigValues = (config) => {
const modelType = getURLParameter(window.location.search, 'type')

if(!modelType && config.modelName) { _modelName = config.modelName }
if(config.numChunksToLoad >= 4) { _numChunksToLoad = config.numChunksToLoad }
if(config.numFacesToTrack >= 0) { _numFacesToTrack = config.numFacesToTrack }
if(config.enableDynamicPerformance) { _enableDynamicPerformance = config.enableDynamicPerformance }
if(config.numTrackingPasses) { _numTrackingPasses = config.numTrackingPasses }
@@ -84,8 +84,12 @@ export const setProgress = (url, loaded, total) => {

export const getProgress = () => { return _progress.target }

let idHidePreloader = -1;

export const onProgress = (progress) => {

clearTimeout(idHidePreloader)

// log(_name + ': onProgress:', progress)

setProgress(progress.currentTarget.responseURL, progress.loaded, progress.total)
@@ -96,7 +100,8 @@ export const onProgress = (progress) => {

if(overallProgress >= 1.00) {

hidePreloader()
setTimeout(hidePreloader, 500)

}
}

@@ -83,7 +83,7 @@

}).catch((e) => { if(e) { console.error('Camera failed: ', e) } })

loadBRFv5Model('68l_max', './js/brfv5/models/', _appId,
loadBRFv5Model('68l', 8, './js/brfv5/models/', _appId,
(progress) => { console.log(progress) }).then(({ brfv5Manager, brfv5Config }) => {

console.log('loadBRFv5Model: done')
@@ -63,7 +63,7 @@

}).catch((e) => { if(e) { console.error('Camera failed: ', e) } })

loadBRFv5Model('68l_max', './js/brfv5/models/', _appId,
loadBRFv5Model('68l', 8, './js/brfv5/models/', _appId,
(progress) => { console.log(progress) }).then(({ brfv5Manager, brfv5Config }) => {

console.log('loadBRFv5Model: done')
@@ -30,13 +30,13 @@
<video id="_webcam" style="display: none;" playsinline></video>
<canvas id="_imageData"></canvas>

<script src="./js/brfv5/brfv5_js_tk101119_v5.0.2_trial_no_modules.js"></script>
<script src="./js/brfv5/brfv5_js_tk141119_v5.1.0_trial_no_modules.js"></script>

<script>

// Set the BRFv5 library name here, also set your own appId for reference.

const _libraryName = 'brfv5_js_tk101119_v5.0.2_trial'
const _libraryName = 'brfv5_js_tk141119_v5.1.0_trial.brfv5'
const _appId = 'brfv5.browser.minimal.nomodules' // (mandatory): 8 to 64 characters, a-z . 0-9 allowed
const brfv5 = {} // The library namespace.

@@ -54,7 +54,7 @@
// configureTracking which only gets executed once both Promises were successful. Once configured
// trackFaces will do the tracking work and draw the results.

const loadBRFv5Model = (modelName, pathToModels = '', appId = null, onProgress = null) => {
const loadBRFv5Model = (modelName, numChunksToLoad, pathToModels = '', appId = null, onProgress = null) => {

console.log('loadBRFv5Model')

@@ -71,7 +71,9 @@
try {

brfv5.appId = appId ? appId : _appId
brfv5.binaryLocation = pathToModels + _libraryName + '_' + modelName + '.brfv5'
brfv5.binaryLocation = pathToModels + _libraryName
brfv5.modelLocation = pathToModels + modelName + '_c'
brfv5.modelChunks = numChunksToLoad // 4, 6, 8
brfv5.binaryProgress = onProgress
brfv5.binaryError = (e) => { reject(e) }
brfv5.onInit = (brfv5Manager, brfv5Config) => {
@@ -239,7 +241,7 @@

}).catch((e) => { if(e) { console.error('Camera failed: ', e) } })

loadBRFv5Model('68l_max', './js/brfv5/models/', _appId,
loadBRFv5Model('68l', 8, './js/brfv5/models/', _appId,
(progress) => { console.log(progress) }).then(({ brfv5Manager, brfv5Config }) => {

console.log('loadBRFv5Model: done')

0 comments on commit 6eb9b69

Please sign in to comment.
You can’t perform that action at this time.