question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Big Size Images makes computer slow

See original GitHub issue

I am not sure if this is a library issue or machine issue (tried it on 2 powerful computers with different OS windows + ubuntu but same result). Anyways, the first try with a simple images 600x400, size around 100kb-250kb and the detecting faces result was just after 7sec which is a lot for me since I am going to detect thousands of faces.

  • Using sizes like 500-999kb takes 1-2min to detect the faces
  • Over 1MB, huge problems computer get slower and for an image 2-3MB the computer stopped working.

Well, I know I can resize the image before detecting the face, I just wanted to know this issue where is coming from, is it normal or just me … note this only detecting fr.FaceDetector() I didn’t even start to recognize faces

Issue Analytics

  • State:open
  • Created 6 years ago
  • Comments:8 (4 by maintainers)

github_iconTop GitHub Comments

2reactions
Zwimbercommented, Mar 26, 2018

To be honest I think most of the taks are rather CPU intensive regardless of using OpenBLAS or not. On my Macbook Pro I get the following results with this script:

const detector = fr.FaceDetector()
const faceRectangles = detector.locateFaces(image)
  • 256 x 256px about 200ms
  • 512 x 512px about 800ms
  • 1024 x 1024px about 2000ms
  • 2048 x 2048px about 9000ms (not even a really big image)

Which all are too slow for any realtime application. I’ve found several ways to improve the speed:

  1. Accept the fact that for the realtime part of your application you will use downscaled versions of the original image. You can store the original image for later use.
  2. Create a smaller copy of the image (e.g. 128px) then use locateFaces. Then use locateFaces on the larger image only on the area’s where an face has been found.
  3. Use a haarclassifier (either from opencv or from this library), then use locateFaces on the larger image only on this area. The haarclassifier is much faster (about 200ms on 1024x1024) on my device. (Added downside: you’ll only find frontalfaces, added upside: this haar detector has a lot of recall which is fixed by then using locateFaces)
let detectorOpenCV = new cv.CascadeClassifier(cv.HAAR_FRONTALFACE_DEFAULT);
let imageGray = imageCvMat.bgrToGray()
let detect = detectorOpenCV.detectMultiScale(imageGray)
// Note: there is an async variant for these functions!
// Note: I've found this to often throw errors, so please use the version below

let detectorFr = new fr.FrontalFaceDetector() // Built in frontal detector
detectorFr.detect(imageRgb)
// Note: no async variant
1reaction
justadudewhohackscommented, Jul 4, 2018

The CascadeClassifier comes from opencv4nodejs. You can find some examples here, how to use face-recognition.js with opencv4nodejs.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Can having a large amount of photos on my computer make it ...
It can cause your computer to slow down. It isn't guaranteed that it will slow down your system and probably not in the...
Read more >
Computer Running Slow with Your Photos? Here Are Some ...
Computer running slow when trying to work with your photos? Here are some great ways to troubleshoot and speed it up!
Read more >
Computer Slow With Photos? 3 Simple Ways to Speed It Up
There are several ways to do this, but the simplest and most effective methods are to 1) resize the image resolution, 2) crop...
Read more >
How Images are Slowing Down Page Load Time ... - Snipcart
Large sized images, high-resolution images, and uncompressed images can drastically reduce the page load speed.
Read more >
Computer is slow when Windows Photo Gallery displays TIFF ...
... depending on the size of the TIFF file. This behavior causes slow system performance and a significant increase in the memory usage...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found