Giter Club home page Giter Club logo

Comments (16)

delebash avatar delebash commented on May 18, 2024 1

Thanks it works as expected. Suggestion would it not be better to just have a config.json file that can be loaded at runtime? I am testing the demo and in my case I only want the hand enabled when I open the page and everything else disabled. I also may want to start it with hand and face enabled but then I have to rebuild. I am running this in an IDE that has its own web server and importing browser.js so I don't actually need to build anything unless I change human.js I can just refresh the page.

By the way human is awesome thank you very very much for the hard work!!!

from human.

delebash avatar delebash commented on May 18, 2024 1

Works perfectly.

from human.

vladmandic avatar vladmandic commented on May 18, 2024

demo has default configuration overrides set in demo/browser.js:config - simply for purpose of having a local variable so menu can bind something to directly

if those are removed, then defaults from config.js are used

how it works is that any override is deep-merged with values from config.js

from human.

delebash avatar delebash commented on May 18, 2024

Great thanks for the explanation

from human.

delebash avatar delebash commented on May 18, 2024

Did not mean to close since this is outstanding :)

from human.

vladmandic avatar vladmandic commented on May 18, 2024

i've updated the docs, will be up in the next publish, it's ok to close now.

from human.

delebash avatar delebash commented on May 18, 2024

I still do not see any changes in the gui after changing config.js. Per your comment I do not see a config object in browser.js. I do see variables in the setupMenu function as menu.addBool('Face Detect', human.config.face, 'enabled');. My expectation would be that the gui would reflect the changes made in config.js so if I have in my config
face: {
enabled: false
}

Than the gui slider FACE DETECT would load as disabled. Am I doing something wrong?

from human.

delebash avatar delebash commented on May 18, 2024

Off Topic:

When I push commit's to my fork do you get notified on github. The reason I am asking is that I don't want to bother you when I am making changes to my fork.

from human.

vladmandic avatar vladmandic commented on May 18, 2024

i removed config object from browser.js earlier today, demo should now link directly to config from main library, meaning config.js.

but if you change anything in config.js directly, you do need to do a library rebuild, either using npm run rebuild or use dev-server i wrote yesterday, npm run dev

and no, i don't get notifications for separate forks.

from human.

delebash avatar delebash commented on May 18, 2024

npm run rebuild is not a valid script. Did you mean npm rebuild? Also is there a way to use the config without running npm rebuild? I am using the demo/browser.js not the dist/demo-browser-index.js

from human.

vladmandic avatar vladmandic commented on May 18, 2024

it's npm run build (sorry, my typo)
and no, config.js is included in human.js (esm/node/whatever) library, so library needs to be rebuild before it's even exposed to client.

from human.

vladmandic avatar vladmandic commented on May 18, 2024

you could import config.js into your app directly and then use human with your version passing it as override.
something like

const myConfig = require('config.js).default;
human.detect(image, myconfig);

(or equivalent import statement if you're using esm and not node)

from human.

delebash avatar delebash commented on May 18, 2024

Ok importing config.js works fine for me. Thanks.

from human.

vladmandic avatar vladmandic commented on May 18, 2024

that's the whole points of having second param to human.load() or human.detect() - to pass user configuration.
then it's merged with defaults that come from config.js.

why is config.js linked into human during build to start with? because i want it have sane default values in case something in user config is missing or invalid.

user configuration can be single flag or entire config or anything in-between. and no harm if user config is entire config.js as it's just going to be merged into single object anyhow.

and yes, it can be a json or js as well.

from human.

delebash avatar delebash commented on May 18, 2024

I understand about the defaults and overriding. I have tried the override and it does not seem to be working

browser.js

import myConfig from './config.js'

function main ....
console.log(myConfig.backend) // = webgl
await human.detect(warmup, myConfig);

No change in gui sliders

from human.

vladmandic avatar vladmandic commented on May 18, 2024

in demo, setupMenu() is called before human.load() or human.detect(), so it menu binds to default values - your values have not yet been merged at that time.
if you want to directly bind menu to your values regardless, change setupMenu parameters to use your object instead of human.config.

from human.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.