cmusatyalab / openface

Face recognition with deep neural networks.
http://cmusatyalab.github.io/openface/
Apache License 2.0
15.09k stars 3.6k forks source link

Broken Pipe #26

Closed ananghudaya closed 8 years ago

ananghudaya commented 8 years ago

Hi, I'm having a problem to run the compare.py as prescribed in the README. it keeps showing the broken pipe error. I'm running this on Ubuntu 14.04. Here are the errors that appear on the screen.

/home/ananghudaya/torch/install/bin/luajit: ...e/ananghudaya/torch/install/share/lua/5.1/torch/File.lua:289: table index is nil
stack traceback:
    ...e/ananghudaya/torch/install/share/lua/5.1/torch/File.lua:289: in function 'readObject'
    ...e/ananghudaya/torch/install/share/lua/5.1/torch/File.lua:272: in function 'readObject'
    ...e/ananghudaya/torch/install/share/lua/5.1/torch/File.lua:311: in function 'load'
    ...Documents/openface/openface/openface/openface_server.lua:45: in main chunk
    [C]: in function 'dofile'
    ...daya/torch/install/lib/luarocks/rocks/trepl/scm-1/bin/th:131: in main chunk
    [C]: at 0x0804d6d0
Traceback (most recent call last):
  File "./demos/compare.py", line 113, in <module>
    d = getRep(img1) - getRep(img2)
  File "./demos/compare.py", line 104, in getRep
    rep = net.forwardImage(alignedFace)
  File "/home/ananghudaya/Documents/openface/openface/demos/../openface/__init__.py", line 50, in forwardImage
    rep = np.array(self.forwardPath(t))
  File "/home/ananghudaya/Documents/openface/openface/demos/../openface/__init__.py", line 43, in forwardPath
    self.p.stdin.write(imgPath + "\n")
IOError: [Errno 32] Broken pipe

Any advice?

bamos commented 8 years ago

Hi @ananghudaya - thanks for reporting. It looks like the model is failing to load. Can you make sure the checksums match?

openface(master)$ md5sum models/{dlib/*.dat,openface/*.{pkl,t7}}
73fde5e05226548677a050913eed4e04  models/dlib/shape_predictor_68_face_landmarks.dat
c0675d57dc976df601b085f4af67ecb9  models/openface/celeb-classifier.nn4.v1.pkl
a59a5ec1938370cd401b257619848960  models/openface/nn4.v1.t7
northeastsquare commented 8 years ago

I met the same problem, md5sum is correct. silva@silva-XPS-8300:~/src/openface$ md5sum models/dlib/shape_predictor_68_face_landmarks.dat 73fde5e05226548677a050913eed4e04 models/dlib/shape_predictor_68_face_landmarks.dat silva@silva-XPS-8300:~/src/openface$ md5sum models/openface/celeb-classifier.nn4.v1.pkl c0675d57dc976df601b085f4af67ecb9 models/openface/celeb-classifier.nn4.v1.pkl silva@silva-XPS-8300:~/src/openface$ md5sum models/openface/nn4.v1.t7 a59a5ec1938370cd401b257619848960 models/openface/nn4.v1.t7

northeastsquare commented 8 years ago

open the page first time got error: File "/home/silva/src/openface/demos/web/../../openface/init.py", line 77, in forwardImage rep = np.array(self.forwardPath(t)) File "/home/silva/src/openface/demos/web/../../openface/init.py", line 71, in forwardPath return [float(x) for x in self.p.stdout.readline().strip().split(',')] exceptions.ValueError: could not convert string to float:

But fresh the page , get error : File "/home/silva/src/openface/demos/web/../../openface/init.py", line 77, in forwardImage rep = np.array(self.forwardPath(t)) File "/home/silva/src/openface/demos/web/../../openface/init.py", line 70, in forwardPath self.p.stdin.write(imgPath + "\n") exceptions.IOError: [Errno 32] Broken pipe

northeastsquare commented 8 years ago

I tried resize image to 96*96, as https://github.com/cmusatyalab/openface/issues/24 but no help return [float(x) for x in self.p.stdout.readline().strip().split(',')] ValueError: could not convert string to float:

bamos commented 8 years ago

Hi @northeastsquare - can you try running the comparison demo? It doesn't have as many moving parts as the web demo and might give us a better idea of what's causing the error.

./demos/compare.py images/examples/{lennon*,clapton*}.

-Brandon.

bamos commented 8 years ago

Also @ananghudaya and @northeastsquare - can you try importing the model from the Torch repl from the openface directory?

$ th

th> import 'nn'
th> import 'dpnn'
th> net = torch.load('./models/openface/nn4.v1.t7')
th> net:size()
25
harshhemani commented 8 years ago

I figured it out. Here is what I did:

  1. Replace img[1] = image.load(imgPath, opt.imgDim) with img[1] = image.load(imgPath, 3, byte) on line 63 in openface/openface_server.lua file
  2. In file Normalize.lua in nn directory of your lua installation, you need to initialize self._output before you resize it, for example I added line self._output = torch.Tensor() before calling self._output:resizeAs(input).
bamos commented 8 years ago

Hi @harshhemani - thanks for looking into this! I've corrected the usage of image.load, and the nn.Normalize problem looks like it was caused by a PR merged into nn's master branch 14 hours ago: https://github.com/torch/nn/pull/432

I haven't been able to look into this to know if I need to change something, or if this is a change that needs to go into nn.Normalize.

bamos commented 8 years ago

The commit causing this was just reverted in nn's master branch, so I think this is resolved. The fix relevant here is to update nn with luarocks. Please re-open or file a new issue if you still see this.

ananghudaya commented 8 years ago

Dear All, Sorry. I was away for the last 3 days. Still no luck at my side. It gives the same error, even though i have updated nn via luarocks and update the contents of Normalize.lua and openface_server.lua.

bamos commented 8 years ago

@ananghudaya - can you verify your Normalize.lua has the following md5sum?

~$ md5sum ~/torch/install/share/lua/5.1/nn/Normalize.lua
80668e9a8bfceaed6c19913660830d07  /home/bamos/torch/install/share/lua/5.1/nn/Normalize.lua
ananghudaya commented 8 years ago

@bamos - Yes. md5sum verified. it is similar.

bamos commented 8 years ago

I think you might be seeing a different issue, can you post the output of:

$ th

th> import 'nn'
th> import 'dpnn'
th> net = torch.load('./models/openface/nn4.v1.t7')
ananghudaya commented 8 years ago

Thanks @bamos

It gives an error:

th> net = torch.load('./models/openface/nn4.v1.t7')
...e/ananghudaya/torch/install/share/lua/5.1/torch/File.lua:289: table index is nil
stack traceback:
    ...e/ananghudaya/torch/install/share/lua/5.1/torch/File.lua:289: in function 'readObject'
    ...e/ananghudaya/torch/install/share/lua/5.1/torch/File.lua:272: in function 'readObject'
    ...e/ananghudaya/torch/install/share/lua/5.1/torch/File.lua:311: in function 'load'
    [string "net = torch.load('./models/openface/nn4.v1.t7')"]:1: in main chunk
    [C]: in function 'xpcall'
    ...e/ananghudaya/torch/install/share/lua/5.1/trepl/init.lua:648: in function 'repl'
    ...daya/torch/install/lib/luarocks/rocks/trepl/scm-1/bin/th:185: in main chunk
    [C]: at 0x0804d6d0  
bamos commented 8 years ago

Hi @ananghudaya - I think this is an architecture issue, let's move this discussion to #42.