Giter VIP home page Giter VIP logo

openface's Introduction

OpenFace • Build Status Release License Gitter

Free and open source face recognition with deep neural networks.



This research was supported by the National Science Foundation (NSF) under grant number CNS-1518865. Additional support was provided by the Intel Corporation, Google, Vodafone, NVIDIA, and the Conklin Kistler family fund. Any opinions, findings, conclusions or recommendations expressed in this material are those of the authors and should not be attributed to their employers or funding sources.

What's in this repository?

Citations

Please cite OpenFace in your publications if it helps your research. The following is a BibTeX and plaintext reference for our OpenFace tech report.

@techreport{amos2016openface,
  title={OpenFace: A general-purpose face recognition
    library with mobile applications},
  author={Amos, Brandon and Bartosz Ludwiczuk and Satyanarayanan, Mahadev},
  year={2016},
  institution={CMU-CS-16-118, CMU School of Computer Science},
}

B. Amos, B. Ludwiczuk, M. Satyanarayanan,
"Openface: A general-purpose face recognition library with mobile applications,"
CMU-CS-16-118, CMU School of Computer Science, Tech. Rep., 2016.

Licensing

Unless otherwise stated, the source code and trained Torch and Python model files are copyright Carnegie Mellon University and licensed under the Apache 2.0 License. Portions from the following third party sources have been modified and are included in this repository. These portions are noted in the source files and are copyright their respective authors with the licenses listed.

Project Modified License
Atcold/torch-TripletEmbedding No MIT
facebook/fbnn Yes BSD
dlib-models (68 face landmark detector) No CC0

openface's People

Contributors

adipascu avatar alexx-g avatar bakercp avatar bakwc avatar bamos avatar gabrfarina avatar gisdev01 avatar godrek avatar haroenv avatar harshjv avatar heman4t avatar lextoumbourou avatar melgor avatar mminer237 avatar montag avatar neuraldomi avatar nma83 avatar pschanely avatar qacollective avatar rasbt avatar sbalk avatar thart310 avatar vijayenthiran avatar vortexmind avatar wangg12 avatar zhihengcv avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

openface's Issues

Error while loading 'nn4.v1.t7'

...an/software/torch_build/share/lua/5.1/torch/File.lua:294: unknown object
stack traceback:
...an/software/torch_build/share/lua/5.1/trepl/init.lua:480: in function <...an/software/torch_build/share/lua/5.1/trepl/init.lua:473>
[C]: in function 'error'
...an/software/torch_build/share/lua/5.1/torch/File.lua:294: in function 'readObject'
...an/software/torch_build/share/lua/5.1/torch/File.lua:240: in function 'readObject'
...an/software/torch_build/share/lua/5.1/torch/File.lua:288: in function 'readObject'
...an/software/torch_build/share/lua/5.1/torch/File.lua:272: in function 'readObject'
...an/software/torch_build/share/lua/5.1/torch/File.lua:288: in function 'readObject'
...an/software/torch_build/share/lua/5.1/torch/File.lua:288: in function 'readObject'
...an/software/torch_build/share/lua/5.1/torch/File.lua:272: in function 'readObject'
...an/software/torch_build/share/lua/5.1/torch/File.lua:311: in function 'load'
[string "torch.load('nn4.v1.t7');"]:1: in main chunk
[C]: in function 'xpcall'
...an/software/torch_build/share/lua/5.1/trepl/init.lua:648: in function 'repl'
...re/torch_build/lib/luarocks/rocks/trepl/scm-1/bin/th:185: in main chunk
[C]: ?

Semi-hard negative bug?

@bamos
I recently read the semi-hard negative code. I am not sure, but I think it may not work as assumed.
I am talking about that fragment from traininig/train.lua

if posDist < negDist and negDist < selNegDist and negDist < alpha then
                selNegDist = negDist
                selNegIdx = k
 end

The main concert is connected with negDist < alpha
Alpha is set to 0.2 and negDist would be never lower than that (and in the same time bigger than posDist), I think that condition is wrong.
I make a quick test and never this condition was satisfied.

Suggestion 1

I think, that based on TripletLoss, the condition should looks like that:

if posDist < negDist and negDist < selNegDist and math.abs(posDist-negDist) < alpha then

It choose that negative example which distance is higher than from positive one, but in other hand, no further than alpha.

Suggestion 2

But, after some test, I think that this condition should be better. Sometimes for person no negative example satisfy the conditions, then it is chosen the random negative example. I am proposing sth like that:

if posDist < negDist and negDist < selNegDist then 
          selNegDist = negDist 
          selNegIdx = k 
          if math.abs(posDist-negDist) < alpha then 
            break 
          end 
end

It take negative example, which are better than previous one and additionally break when "alpha" condition is satisfied. I think that we do not need to have best negative example, which satisfy condition (this is similar way to Oxford-Face algorithm for Triplet selection). Additional, it will speed up all process.

But first of all, am I right claiming that current semi-hard negative condition does not work as should and now it choose only random negative example?

Facing issues in forwardPath

I am trying to use the exemplar code given under 'Usage' in the readme document. This is the code which I'm using.

parser.add_argument('--dlibFaceMean', type=str, help="Path to dlib's face predictor.",
                    default=os.path.join(dlibModelDir, "mean.csv"))
parser.add_argument('--dlibFacePredictor', type=str, help="Path to dlib's face predictor.",
                    default=os.path.join(dlibModelDir, "shape_predictor_68_face_landmarks.dat"))
parser.add_argument('--networkModel', type=str, help="Path to Torch network model.",
                    default=os.path.join(openfaceModelDir, 'nn4.v1.t7'))
parser.add_argument('--imgDim', type=int,
                    help="Default image dimension.", default=96)
parser.add_argument('--cuda', action='store_true')
args = parser.parse_args()
print args

align = NaiveDlib(args.dlibFaceMean, args.dlibFacePredictor)
print args.dlibFaceMean
print args.dlibFacePredictor
net = openface.TorchWrap(args.networkModel, imgDim=args.imgDim, cuda=args.cuda)
print align
img = cv2.imread('Andrew-Ng-Photo.jpg')
bb = align.getLargestFaceBoundingBox(img)
alignedFace = align.alignImg("affine", args.imgDim, img, bb)

print args.imgDim
print alignedFace.shape
print bb
rep1 = net.forwardImage(alignedFace)

But I'm getting error in this line.
rep1 = net.forwardImage(alignedFace)

This is the error:

 rep1 = net.forwardImage(alignedFace)
  File "/home/prithviraj/openface/openface/__init__.py", line 80, in forwardImage
    rep = np.array(self.forwardPath(t))
  File "/home/prithviraj/openface/openface/__init__.py", line 73, in forwardPath
    return [float(x) for x in self.p.stdout.readline().strip().split(',')]
ValueError: could not convert string to float:

I traced it back and found that the problem is in /openface/openface/init.py.

So I decided to modify the forwardPath and forwardImage functions in init.py.

def forwardPath(self, imgPath):
        print imgPath
        self.p.stdin.write(imgPath + "\n")
        print [(x) for x in self.p.stdout.readline().strip().split(',')]
        return [float(x) for x in self.p.stdout.readline().strip().split(',')]

    def forwardImage(self, rgb):
        print rgb.shape
        t = '/tmp/openface-torchwrap-{}.png'.format(
            binascii.b2a_hex(os.urandom(8)))
        cv2.imwrite(t, rgb)
        rep = np.array(self.forwardPath(t))
        os.remove(t)
        return rep

Here, I found out that this line

print [(x) for x in self.p.stdout.readline().strip().split(',')]

returns an empty list, which results in the error. Please help me with this isssue.
TIA

problem torch load

i try to load the model nn4.v1.t7 in torch because the compare-demo throw a error when i run this :

th '/openface/openface_server.lua' -model '/models/openface/nn4.v1.t7' -imgDim '96'

i got that :

[C]: in function 'dofile'
/usr/local/lib/luarocks/rocks/trepl/scm-1/bin/th:133: in main chunk
[C]: at 0x0804d6d0

i need a little of help :(

Error getting result from Torch subprocess

Error getting result from Torch subprocess.

Line read:

Exception:

could not convert string to float:

stdout:

stderr: /root/torch/install/bin/luajit: inconsistent tensor size at /root/torch/pkg/torch/lib/TH/generic/THTensorCopy.c:7
stack traceback:
[C]: at 0x7fc6874ae020
[C]: in function '__newindex'
/root/openface/openface/openface_server.lua:63: in main chunk
[C]: in function 'dofile'
/root/torch/install/lib/luarocks/rocks/trepl/scm-1/bin/th:133: in main chunk
[C]: at 0x00406670

This happens with attached picture (when align fails).
last

Fatal Python error: PyThreadState_Get: no current thread

Hi, thanks for the project.
When I try to use the classifier, I get an python error:

% ./demos/classifier.py infer ./models/openface/celeb-classifier.nn4.v1.pkl foo.jpg
Fatal Python error: PyThreadState_Get: no current thread
[1]    25105 abort      ./demos/classifier.py infer ./models/openface/celeb-classifier.nn4.v1.pkl

I'm on a mac and using a virtualenv environment to install the python dependencies,
so those are available. It does not matter if I'm using the self-compiled dlib as documented
or the one you can install with pip.

Any idea what might be the problem here?
Thanks!

Architecture issues with Torch.load

From @ananghudaya in #26:

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  

saving faces after learning

Hello,
I don't know if this is an issue or a non developed option. i am trying to recognize faces, but when i did make the learn process, and refrech the page, all data get lost.
Thanks

Web demo: Reduce data transfers

Suggested by @anguoyang:

Such as:

  • Compression
  • Doing detection in the browser and only sending cropped faces
  • Only sending bounding boxes and labels back from the server to the browser

ImportError: numpy.core.multiarray failed to import

I am trying to setup this project for hours on Mac OS. Could anyone please help me to resolve this import error in server.py.

ImportError: numpy.core.multiarray failed to import
Traceback (most recent call last):
File "./server.py", line 28, in
import cv2
ImportError: numpy.core.multiarray failed to import

net:forward bug in openface_server.lua

Im not sure if its my personal Torch installation bug, but when i launch lua server and put test PNG to it, it raises following exception:

/home/igor/torch/install/bin/luajit: /home/igor/torch/install/share/lua/5.1/nn/Normalize.lua:20: attempt to index field '_output' (a nil value)
stack traceback:
    /home/igor/torch/install/share/lua/5.1/nn/Normalize.lua:20: in function 'updateOutput'
    /home/igor/torch/install/share/lua/5.1/nn/Sequential.lua:44: in function 'forward'
    /home/igor/openface/openface/openface_server.lua:70: in main chunk
    [C]: in function 'dofile'
    ...igor/torch/install/lib/luarocks/rocks/trepl/scm-1/bin/th:131: in main chunk
    [C]: at 0x00406510

nn4.v2 Training Progress

  • Alignment issues: #50
  • Use outer eyes and nose
  • Normalization in early layers
  • Try removing 5x5 kernels in the last 2 layers (pointed out by @melgor)
  • Batch normalization - is it harmful?
  • Switch from fbcunn's CrossMapNormalization to torch/nn#413 if LRN improves performance
  • Add celeba dataset (identities not yet available)

CLI for training and classifying without expertise

The web demo seems to have a similar function already, but I'd like a command-line interface to train and classify people like in the web demo.

This would allow easy integration into other apps, and inevitably lead more people to use this system.

Example interface:

openface_train img.png Name
openface_train *.png Name
openface_classify img.png [output: Name 0.63]

Thanks for the work, and the choice of a good license.

Try adding normalization back to the models.

2015/11/17, mailing list

The only information the FaceNet paper gives is just norm for these portions,
so I'm not sure what kind of normalization they're using.
Maybe something like Torch's SpatialContrastiveNormalization?

Please explain the structure of the raw-data directory

Hi,
this is not a real issue but rather a question.
Maybe I have not seen this or am a bit overwhelmed because this is all new to me,
but can you explain how the images should be structured when training a new classifier?
So, when calling ./util/align-dlib.py which structure must the raw-data directory have?
Do I need to create a folder for each person with N photos, where the folder name is later used
as a label?

Thanks

Training: inconsistent tensor size

training(master*)$ ./main.lua -data ~/openface/data/casia-facescrub/dlib-affine-224-split/ -imgDim 224 -batchSize 20 -nDonkeys -1

==> doing epoch on training data:
==> online epoch # 1

/home/bamos/torch/install/bin/luajit: inconsistent tensor size at /home/bamos/torch/pkg/torch/lib/TH/generic/THTensorCopy.c:7
stack traceback:
        [C]: at 0x7fecb5c9aa60
        [C]: in function '__newindex'
        /home/bamos/openface/training/train.lua:132: in function 'f2'
        /home/bamos/openface/training/data.lua:36: in function 'addjob'
        /home/bamos/openface/training/train.lua:48: in function 'train'
        ./main.lua:35: in main chunk
        [C]: in function 'dofile'
        ...amos/torch/install/lib/luarocks/rocks/trepl/scm-1/bin/th:131: in main chunk
        [C]: at 0x00406670

Broken Pipe

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?

Add simple tests

  • Python alignment
  • Torch network
  • Python -> Torch Communication (depends on better solution from #4)
  • Demos on example images
  • DNN training pipeline
  • util scripts

getting the wrong person id in the callback

Hello,
Any idea what is causing this, AFAIK it's from server.py sending the -1 index instead of 0, in the meantime, the rendered picture is correct, while the detected faces IDs shown in the #peopleInVideo are wrong.

ID Issue

Hosting A Web Demo

I'd be happy to get a heroku or AWS version of the web demo up.

Based on my actual behavioral evidence, "web demo" was the first link I clicked. Going on that data (the Human-Computer Interaction department at CMU might appreciate this), I think setting up a simple heroku deployment is worthwhile.

Only obstacle is hosting fees, if you guys have a budget, or someone's server space.

Error running util/prune-dataset.py

When running the following command on a set of aligned images

$ ./util/prune-dataset.py data/test/aligned/ --numImagesThreshold 2

The following error is reported:

Traceback (most recent call last):
  File "./util/prune-dataset.py", line 27, in <module>
    if nImgs < args.numImagesThreshold:
TypeError: unorderable types: int() < str()

Solution:

On line 12 of 'util/prune-dataset.py', change str to int

Docker install problem: luarocks install nn?

I just found this project and tried the docker-image.
After most of the installation process is done, the following error occurs:

...
Step 8 : RUN ~/torch/install/bin/luarocks install nn
 ---> Running in 8bd952a0406e

Error: LuaRocks 2.2.0beta1 bug (please report at [email protected]).
/torch/install/share/lua/5.1/luarocks/manif.lua:489: Assertion failed: '/torch/install/share/lua/5.1/nn/Log.lua' is not a deployed file.
stack traceback:
    [C]: in function 'assert'
    /torch/install/share/lua/5.1/luarocks/manif.lua:489: in function 'find_providers'
    /torch/install/share/lua/5.1/luarocks/manif.lua:511: in function 'find_next_provider'
    /torch/install/share/lua/5.1/luarocks/repos.lua:292: in function 'action'
    /torch/install/share/lua/5.1/luarocks/repos.lua:49: in function 'do_recurse_rock_manifest_tree'
    /torch/install/share/lua/5.1/luarocks/repos.lua:46: in function 'delete_deployed_file_tree'
    /torch/install/share/lua/5.1/luarocks/repos.lua:315: in function 'delete_version'
    /torch/install/share/lua/5.1/luarocks/build.lua:191: in function 'do_build'
    /torch/install/share/lua/5.1/luarocks/build.lua:398: in function </torch/install/share/lua/5.1/luarocks/build.lua:386>
    [C]: in function 'xpcall'
    /torch/install/share/lua/5.1/luarocks/command_line.lua:208: in function 'run_command'
    //torch/install/bin/luarocks:34: in main chunk
    [C]: at 0x00406670
Installing https://raw.githubusercontent.com/torch/rocks/master/nn-scm-1.rockspec...
Using https://raw.githubusercontent.com/torch/rocks/master/nn-scm-1.rockspec... switching to 'build' mode
2015/11/15 04:27:47 The command [/bin/sh -c ~/torch/install/bin/luarocks install nn] returned a non-zero code: 1

I tried to install it manually in the shell but i had no luck (maybe i was doing it wrong; first time of contact with luarocks).

I'm using Linux Mint Rebecca based on Ubuntu 14.04 LTS,
Is anyone experiencing the same problem? Any tips?

Thanks!

CMake Error

When I run demo1,the first I can not find "src" folder,so I build src document,and then I run " cmake ../../tools/python",it disply"CMake Error at /usr/share/cmake-3.0/Modules/FindBoost.cmake:1278 (message):
Unable to find the requested Boost libraries.

Unable to find the Boost header files. Please set BOOST_ROOT to the root
directory containing Boost or BOOST_INCLUDEDIR to the directory containing
Boost's headers.CMake Error: The following variables are used in this project, but they are set to NOTFOUND."

but I can not solve this error,someone who can help me ,thank you very much!

Issue with Popen in __init__.py

I tried to run the demo2: "./demos/compare.py images/examples/{lennon_,clapton_}"

But got this error msg:
Traceback (most recent call last):
File "./demos/compare.py", line 113, in
d = getRep(img1) - getRep(img2)
File "./demos/compare.py", line 104, in getRep
rep = net.forwardImage(alignedFace)
File "/mnt/brain1/scratch/xcyan/random/openface/demos/../openface/init.py", line 81, in forwardImage
rep = np.array(self.forwardPath(t))
File "/mnt/brain1/scratch/xcyan/random/openface/demos/../openface/init.py", line 75, in forwardPath
return [float(x) for x in self.p.stdout.readline().strip().split(',')]
ValueError: could not convert string to float: {

I traced the error and found it was line 43 in init.py:
"self.p = Popen(cmd, stdin=PIPE, stdout=PIPE, stderr=PIPE, bufsize=0)"

Basically, this line seems not working (calling torch in python program). Do you have any suggestions? Thanks!

Speed-up Training

I was thinking about speeding up learning process. I think that in current version of code too many forward propagation is done for each triplet. So far the process looks like that:

  1. Get batch
  2. Forward all batch, get embeddings
  3. Choose randomly anchor and positive example
  4. Based on embeddings, choose negative example
  5. Create pairs of triplet
  6. In OptimTriplet, forward again all the examples, some of the images even more that ones (as the occur in several triplets)

I think, that it is possible to process the data less time. We can calculate, that for batch size=100, we process 400 images (100 for emb, 300 for learning).The idea is taken from here: https://github.com/Atcold/torch-TripletEmbedding/blob/master/data/data-test.lua , commented code at the bottom of file.

So, the idea is following:

  1. Firstly choose randomly positive images for each anchor.
  2. Then, using model.module[1].forward[anchors] process anchor images and positive (for positive change module from 1 to 2). As I understand torch, the model will remember value in each layer, which will be used for backward propagation.
  3. Having emending for anchor images, choose negative images.
  4. Process it by model.module[3]
  5. Then, the OptimTriplet does not do forward propagation of data (we provide all embedding for anchor, positive and negative), just only forward by criterion and all backward.

This is not maybe great speed up, but reduce computation from 400 to 300, so it is 25% faster.

Do you think, that my idea is correct?

Documentation Fix - "Please Use Responsibly!"

This documentation is fantastic. I really like all the pictures and I'm just making an effort to improve it further.

"Please use responsibly!" section possibly violates the TOS for open source software. I think one of the definitions of "open" is not limiting people's ability to use the software, depending on the license you use.

Training appears to have CUDA dependency

There seems to be references to cutorch and cunn in the training directory. This is problematic when running the docker container.

Full trace to document the issue:

root@c0280b956f59:/openface# ./training/main.lua -data data/test/aligned/
/root/torch/install/bin/luajit: /root/torch/install/share/lua/5.1/trepl/init.lua:363: module 'cutorch' not found:No LuaRocks module found for cutorch
        no field package.preload['cutorch']
        no file '/root/.luarocks/share/lua/5.1/cutorch.lua'
        no file '/root/.luarocks/share/lua/5.1/cutorch/init.lua'
        no file '/root/torch/install/share/lua/5.1/cutorch.lua'
        no file '/root/torch/install/share/lua/5.1/cutorch/init.lua'
        no file './cutorch.lua'
        no file '/root/torch/install/share/luajit-2.1.0-alpha/cutorch.lua'
        no file '/usr/local/share/lua/5.1/cutorch.lua'
        no file '/usr/local/share/lua/5.1/cutorch/init.lua'
        no file '/root/.luarocks/lib/lua/5.1/cutorch.so'
        no file '/root/torch/install/lib/lua/5.1/cutorch.so'
        no file './cutorch.so'
        no file '/usr/local/lib/lua/5.1/cutorch.so'
        no file '/usr/local/lib/lua/5.1/loadall.so'
stack traceback:
        [C]: in function 'error'
        /root/torch/install/share/lua/5.1/trepl/init.lua:363: in function 'require'
        ./training/main.lua:4: in main chunk
        [C]: in function 'dofile'
        /root/torch/install/lib/luarocks/rocks/trepl/scm-1/bin/th:133: in main chunk
        [C]: at 0x00406670

Is there a way to train a new model without CUDA? If there is not, perhaps it would be best to specify in the readme that CUDA is indeed needed for training.

socket errors

Hello,
when running ./server.py i get the following output
/usr/bin/env: th: No such file or directory
2015-10-16 03:25:57+0200 [-] Log opened.
2015-10-16 03:25:57+0200 [-] WebSocketServerFactory starting on 9000
2015-10-16 03:25:57+0200 [-] Starting factory <autobahn.twisted.websocket.WebSocketServerFactory object at 0x7f4c7cb7a850>

then when i open the localhost:8000 in the browser, the ./server.py will produce this :

2015-10-16 03:27:38+0200 [-] Client connecting: tcp4:127.0.0.1:47696
2015-10-16 03:27:38+0200 [-] WebSocket connection open.
2015-10-16 03:27:38+0200 [-] Received NULL message of length 15.
2015-10-16 03:27:38+0200 [-] Received NULL message of length 15.
2015-10-16 03:27:38+0200 [-] Received NULL message of length 15.
2015-10-16 03:27:38+0200 [-] Received NULL message of length 15.
2015-10-16 03:27:38+0200 [-] Received NULL message of length 15.
2015-10-16 03:27:38+0200 [-] Received NULL message of length 15.
2015-10-16 03:27:38+0200 [-] Received NULL message of length 15.
2015-10-16 03:27:38+0200 [-] Received NULL message of length 15.
2015-10-16 03:27:38+0200 [-] Received NULL message of length 15.
2015-10-16 03:27:38+0200 [-] Received NULL message of length 15.
2015-10-16 03:27:38+0200 [-] Received NULL message of length 15.
2015-10-16 03:27:38+0200 [-] Received NULL message of length 15.
2015-10-16 03:27:38+0200 [-] Received NULL message of length 15.
2015-10-16 03:27:38+0200 [-] Received NULL message of length 15.
2015-10-16 03:27:38+0200 [-] Received NULL message of length 15.
2015-10-16 03:27:38+0200 [-] Received NULL message of length 15.
2015-10-16 03:27:38+0200 [-] Received NULL message of length 15.
2015-10-16 03:27:38+0200 [-] Received NULL message of length 15.
2015-10-16 03:27:38+0200 [-] Received NULL message of length 15.
2015-10-16 03:27:38+0200 [-] Received NULL message of length 15.
2015-10-16 03:27:38+0200 [-] Received ALL_STATE message of length 61.
2015-10-16 03:27:38+0200 [-] + Training SVM on 0 labeled images.
2015-10-16 03:27:41+0200 [-] Received FRAME message of length 3438.
2015-10-16 03:27:41+0200 [-] Received FRAME message of length 4742.
2015-10-16 03:27:42+0200 [-] Received FRAME message of length 7454.
2015-10-16 03:27:42+0200 [OpenFaceServerProtocol,0,127.0.0.1] Unhandled Error
Traceback (most recent call last):
File "/usr/local/lib/python2.7/dist-packages/twisted/python/log.py", line 101, in callWithLogger
return callWithContext({"system": lp}, func, _args, *_kw)
File "/usr/local/lib/python2.7/dist-packages/twisted/python/log.py", line 84, in callWithContext
return context.call({ILogContext: newCtx}, func, _args, *_kw)
File "/usr/local/lib/python2.7/dist-packages/twisted/python/context.py", line 118, in callWithContext
return self.currentContext().callWithContext(ctx, func, _args, *_kw)
File "/usr/local/lib/python2.7/dist-packages/twisted/python/context.py", line 81, in callWithContext
return func(args,*kw)
--- ---
File "/usr/local/lib/python2.7/dist-packages/twisted/internet/posixbase.py", line 597, in _doReadOrWrite
why = selectable.doRead()
File "/usr/local/lib/python2.7/dist-packages/twisted/internet/tcp.py", line 209, in doRead
return self._dataReceived(data)
File "/usr/local/lib/python2.7/dist-packages/twisted/internet/tcp.py", line 215, in _dataReceived
rval = self.protocol.dataReceived(data)
File "/usr/local/lib/python2.7/dist-packages/autobahn/twisted/websocket.py", line 135, in dataReceived
self._dataReceived(data)
File "/usr/local/lib/python2.7/dist-packages/autobahn/websocket/protocol.py", line 1315, in _dataReceived
self.consumeData()
File "/usr/local/lib/python2.7/dist-packages/autobahn/websocket/protocol.py", line 1330, in consumeData
while self.processData() and self.state != WebSocketProtocol.STATE_CLOSED:
File "/usr/local/lib/python2.7/dist-packages/autobahn/websocket/protocol.py", line 1482, in processData
return self.processDataHybi()
File "/usr/local/lib/python2.7/dist-packages/autobahn/websocket/protocol.py", line 1793, in processDataHybi
fr = self.onFrameEnd()
File "/usr/local/lib/python2.7/dist-packages/autobahn/websocket/protocol.py", line 1920, in onFrameEnd
self._onMessageEnd()
File "/usr/local/lib/python2.7/dist-packages/autobahn/twisted/websocket.py", line 163, in _onMessageEnd
self.onMessageEnd()
File "/usr/local/lib/python2.7/dist-packages/autobahn/websocket/protocol.py", line 735, in onMessageEnd
self._onMessage(payload, self.message_is_binary)
File "/usr/local/lib/python2.7/dist-packages/autobahn/twisted/websocket.py", line 166, in _onMessage
self.onMessage(payload, isBinary)
File "./server.py", line 121, in onMessage
self.processFrame(msg['dataURL'], msg['identity'])
File "./server.py", line 285, in processFrame
rep = net.forwardImage(alignedFace)
File "/home/xxxx/openface/demos/web/../../openface/init.py", line 50, in forwardImage
rep = np.array(self.forwardPath(t))
File "/home/xxxx/openface/demos/web/../../openface/init.py", line 43, in forwardPath
self.p.stdin.write(imgPath + "\n")
exceptions.IOError: [Errno 32] Broken pipe

2015-10-16 03:27:42+0200 [-] Connection to/from tcp4:127.0.0.1:47696 lost (<type 'exceptions.IOError'>): [Errno 32] Broken pipe)
2015-10-16 03:27:42+0200 [OpenFaceServerProtocol,0,127.0.0.1] Unhandled Error
Traceback (most recent call last):
File "./server.py", line 352, in
reactor.run()
File "/usr/local/lib/python2.7/dist-packages/twisted/internet/base.py", line 1194, in run
self.mainLoop()
File "/usr/local/lib/python2.7/dist-packages/twisted/internet/base.py", line 1206, in mainLoop
self.doIteration(t)
File "/usr/local/lib/python2.7/dist-packages/twisted/internet/epollreactor.py", line 396, in doPoll
log.callWithLogger(selectable, _drdw, selectable, fd, event)
--- ---
File "/usr/local/lib/python2.7/dist-packages/twisted/python/log.py", line 101, in callWithLogger
return callWithContext({"system": lp}, func, _args, *_kw)
File "/usr/local/lib/python2.7/dist-packages/twisted/python/log.py", line 84, in callWithContext
return context.call({ILogContext: newCtx}, func, _args, *_kw)
File "/usr/local/lib/python2.7/dist-packages/twisted/python/context.py", line 118, in callWithContext
return self.currentContext().callWithContext(ctx, func, _args, *_kw)
File "/usr/local/lib/python2.7/dist-packages/twisted/python/context.py", line 81, in callWithContext
return func(args,*kw)
File "/usr/local/lib/python2.7/dist-packages/twisted/internet/posixbase.py", line 610, in _doReadOrWrite
self._disconnectSelectable(selectable, why, inRead)
File "/usr/local/lib/python2.7/dist-packages/twisted/internet/posixbase.py", line 258, in _disconnectSelectable
selectable.connectionLost(failure.Failure(why))
File "/usr/local/lib/python2.7/dist-packages/twisted/internet/tcp.py", line 293, in connectionLost
protocol.connectionLost(reason)
File "/usr/local/lib/python2.7/dist-packages/autobahn/twisted/websocket.py", line 132, in connectionLost
self._connectionLost(reason)
File "/usr/local/lib/python2.7/dist-packages/autobahn/websocket/protocol.py", line 2758, in _connectionLost
WebSocketProtocol._connectionLost(self, reason)
File "/usr/local/lib/python2.7/dist-packages/autobahn/websocket/protocol.py", line 1236, in _connectionLost
txaio.resolve(self.is_closed, self)
exceptions.AttributeError: 'OpenFaceServerProtocol' object has no attribute 'is_closed'

Can you tell me what i am missing ?

Docker automated build?

For some reason, building the docker image is failing on my Mac.
To make things even easier, did you consider setting up a Docker-Hub automated build?
https://docs.docker.com/docker-hub/builds/

With this in place, running openface would be just a matter of

$ docker pull openface/openface 
$ docker run openface/openface ...

This would also ensure that the Docker image is always up-to-date with the latest GitHub commit.

batch-represent fails on an image of a single person

  • Hacky workaround: Duplicate the image.
openface(master*)$ ./batch-represent/main.lua -outDir single-reps -model models/openface/nn4.v1.t7 -data single-aligned
{
  data : "single-aligned"
  imgDim : 96
  outDir : "single-reps"
  model : "models/openface/nn4.v1.t7"
  cuda : false
}
{
  sampleSize : 
    {
      1 : 3
      2 : 96
      3 : 96
    }
}
running "find" on each class directory, and concatenate all those filenames into a single file containing all image paths for a given class
now combine all the files to a single large file
load the large concatenated list of sample paths to self.imagePath
1 samples found............................................. 0/1 .............................................................] ETA: 0ms | Step: 0ms          
Updating classList and imageClass appropriately
 [========================================================== 1/1 ============================================================>] ETA: 0ms | Step: 0ms          
Cleaning up temporary files
Splitting training and test sets to a ratio of 0/100
nImgs:  1
/home/bamos/torch/install/bin/luajit: /home/bamos/openface/batch-represent/batch-represent.lua:42: attempt to index local 'labels' (a number value)
stack traceback:
        /home/bamos/openface/batch-represent/batch-represent.lua:42: in function 'repBatch'
        /home/bamos/openface/batch-represent/batch-represent.lua:28: in function 'batchRepresent'
        ./batch-represent/main.lua:42: in main chunk
        [C]: in function 'dofile'
        ...amos/torch/install/lib/luarocks/rocks/trepl/scm-1/bin/th:131: in main chunk
        [C]: at 0x00406670

Load or call forward pass of the network in Python. [100% Python implementation]

This is nontrivial.

Possibility 1: Completely in Python

  • Create a separate Python library to load a Torch model from disk based on Torch's implementation then map the classes to a Python-based deep learning library.

Possibility 2: Through an FFI

Alignment improvements

From @hbredin: df40fa2#commitcomment-14206211

do we really need to detect the same face twice (once in the original image, once in the warped image)?
wouldn't it be less error-prone to directly warp the original image into a 96x96 normalized thumbnail?
I do not understand why we need to do that in two steps -- I must have missed something...

Perform alignment transform in Lua [100% Lua Implementation]

Related to #1 - the current implementation splits code between Python and Lua and requires nontrivial fixes to have a complete Lua implementation and complete Python implementation. This one might be slightly easier to solve than the Python implementation by porting the dlib and opencv Python code to C++, since their Python interfaces wrap C++ API's. Then call the C++ library from Lua.

Slow Classification

@bamos Hey Brandon, nice project! Our team are really interested and currently we are developing a real time video analyzing tool.

One question i have is that when i try to use the classifier.py to make a prediction, it may take couple of seconds to get the result, and i noticed it is slower than the web demo.

Are those two classification methods different? Is there any way to speed up calling classifier.py, like small photos for example?

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.