face-recognition.js icon indicating copy to clipboard operation
face-recognition.js copied to clipboard

Error: load_image failed to open file: std::exception

Open djemrose opened this issue 7 years ago • 10 comments

No matter what image I try and load and even using the examples fr.loadImage always errors? Anybody else getting this?

djemrose avatar Jan 18 '18 07:01 djemrose

Probably occurs during a runtime exception calling libpng. Did you try upgrading libpng? What's your OS?

justadudewhohacks avatar Jan 18 '18 09:01 justadudewhohacks

OSX Sierra 10.12.6 libpng 1.6.34 node v8.6.0 npm 5.6.0

brew install libpng
Updating Homebrew...
==> Auto-updated Homebrew!
Updated 2 taps (homebrew/core, homebrew/php).
==> Updated Formulae
binaryen      chuck         git           idnits        libmonome     modules       serialosc     todoman
ccm           elixir        gjs           jenkins-lts   libre         paket         stress-ng     ttyd
certbot       elvish        hugo          libdvdread    libuv         postgis       svgcleaner
chakra        geoip         ibex          libmaxminddb  linkerd       rpm           tile38

Warning: libpng 1.6.34 is already installed

$ node index.js
/Volumes/Users/clpdxe/Sites/face-recognition/index.js:10
const lenna = fr.loadImage('./data/Lenna.png')
                ^
Error: load_image failed to open file: std::exception
    at Object.<anonymous> (/Volumes/Users/clpdxe/Sites/face-recognition/index.js:10:18)
    at Module._compile (module.js:624:30)
    at Object.Module._extensions..js (module.js:635:10)
    at Module.load (module.js:545:32)
    at tryModuleLoad (module.js:508:12)
    at Function.Module._load (module.js:500:3)
    at Function.Module.runMain (module.js:665:10)
    at startup (bootstrap_node.js:187:16)
    at bootstrap_node.js:607:3

djemrose avatar Jan 18 '18 22:01 djemrose

Okay then are you sure the path to your file is correct? Try also to use an absolute path e.g. path.resolve('./data/Lenna.png').

justadudewhohacks avatar Jan 19 '18 09:01 justadudewhohacks

I've got the same problem: Ubuntu 16.04.4 LTS libpng12-dev 1.2.54-1ubuntu1 node v9.5.0 npm 5.6.0

/home/stef/Documents/orbitstudios/recognize-api/src/test2.js:6
const img1 = fr.loadImage('../data/faces/niels1.png');
                ^

Error: load_image failed to open file: std::exception
    at Object.<anonymous> (/home/stef/Documents/orbitstudios/recognize-api/src/test2.js:6:17)
    at Module._compile (module.js:660:30)
    at Object.Module._extensions..js (module.js:671:10)
    at Module.load (module.js:573:32)
    at tryModuleLoad (module.js:513:12)
    at Function.Module._load (module.js:505:3)
    at Function.Module.runMain (module.js:701:10)
    at startup (bootstrap_node.js:190:16)
    at bootstrap_node.js:662:3

convert -list format | grep PNG gave me

      JNG* PNG       rw-   JPEG Network Graphics
      MNG* PNG       rw+   Multiple-image Network Graphics (libpng 1.2.54)
      PNG* PNG       rw-   Portable Network Graphics (libpng 1.2.54)
           See http://www.libpng.org/ for details about the PNG format.
    PNG00* PNG       rw-   PNG inheriting bit-depth and color-type from original
    PNG24* PNG       rw-   opaque or binary transparent 24-bit RGB (zlib 1.2.8)
    PNG32* PNG       rw-   opaque or transparent 32-bit RGBA
    PNG48* PNG       rw-   opaque or binary transparent 48-bit RGB
    PNG64* PNG       rw-   opaque or transparent 64-bit RGBA
    PNG8* PNG       rw-   8-bit indexed with optional binary transparency

This might tell you more.

stefgootzen avatar Mar 14 '18 10:03 stefgootzen

Not really. Another reason I could think of is missing media codecs.

justadudewhohacks avatar Mar 14 '18 20:03 justadudewhohacks

I am having the same problem. Open jpg is fine. but open png gave me the error above.

HarryF514 avatar Mar 18 '18 01:03 HarryF514

guest what?! i had found out a solution. There is some hidden files inside the image train folder!! After i deleted .DS_store, BOOM!

sooxt98 avatar Apr 21 '18 20:04 sooxt98

Can confirm same as @harryyuanfeng JPG works fine but PNG does not.

djemrose avatar Jun 27 '18 01:06 djemrose

I was having the same issue and then simply ran console.log(path.resolve('image.jpg')) and found I was looking in the wrong directory. I recommend doing this if anyone is still having issues.

botv avatar Jul 18 '18 01:07 botv

Also confirm JPG works but PNG does not

deathemperor avatar Jul 25 '18 02:07 deathemperor