vladmandic / human

Human: AI-powered 3D Face Detection & Rotation Tracking, Face Description & Recognition, Body Pose Tracking, 3D Hand & Finger Tracking, Iris Analysis, Age & Gender & Emotion Prediction, Gaze Tracking, Gesture Recognition
https://vladmandic.github.io/human/demo/index.html
MIT License
2.36k stars 323 forks source link

Increase FPS by decreasing Render Resolution #27

Closed djthegr8 closed 3 years ago

djthegr8 commented 3 years ago

How do I reduce the render resolution and resize the canvas into a smaller one (300 x 150)?

vladmandic commented 3 years ago

in the demo? ou have slider "image height" and "image width" in the UI itself

in the code?

djthegr8 commented 3 years ago

Yet the canvas size remains same and I just get a blurred image

On Tue, 10 Nov 2020, 17:00 Vladimir Mandic, notifications@github.com wrote:

in the demo? ou have slider "image height" and "image width" in the UI itself

in the code?

  • for camera resolution, change demo/browser.js

    resizeMode: 'none', width: { ideal: 300 }, height: { ideal: 150 }, },

  • for output resolution, change demo/browser.js

const userConfig = { filter: { width: 300, height: 150 } }

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/vladmandic/human/issues/27#issuecomment-724644026, or unsubscribe https://github.com/notifications/unsubscribe-auth/AKQZA73PZWCZIFBMSXA6HSLSPEP53ANCNFSM4TQEBX3Q .

vladmandic commented 3 years ago

It's just CSS, actual canvas gets smaller. Code in demo sets CSS style of canvas to to always be displayed at full screen width. Just remove that.

      canvas.style.width = canvas.width > canvas.height ? '100vw' : '';
      canvas.style.height = canvas.width > canvas.height ? '' : '100vh';
djthegr8 commented 3 years ago

Thanks a ton

djthegr8 commented 3 years ago

No significant FPS increase here

djthegr8 commented 3 years ago

Any other way?

vladmandic commented 3 years ago

@djthegr8 there is something in your implementation

your demo runs with 5FPS and mine with 10+FPS when I set it to run with 320p input resolution and WASM SIMD (all models enabled) - that's more than 100% difference

when did you fork the code? i did a lot of optimizations in the last few days

djthegr8 commented 3 years ago

I forked day before day before yesterday i think

djthegr8 commented 3 years ago

And like I'm running just one model, this is tremendous difference

djthegr8 commented 3 years ago

But, it may be because its using WASM instead of WebGL

vladmandic commented 3 years ago

my test above was with WASM SIMD, same as yours. huge difference.
here's the screenshot running with WASM at 700x1080 at 6.9FPS average with all models enabled.

image

djthegr8 commented 3 years ago

Okay, so do I need to re-fork and then again do all the adjustments :weary:

vladmandic commented 3 years ago

you should be able to roll foward your branch for the library itself and keep your demo app.
or copy your app to a separate folder, do a new fork and copy your demo app back.

all of the optimizations are in the library, so your app should be fine except to remove Githubissues.

  • Githubissues is a development platform for aggregating issues.