Git Product home page Git Product logo

openface-pytorch's People

Contributors

shenxiaolu1984 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

openface-pytorch's Issues

wrong in test.py

Hi,

I download your repo, and run the test.py, but there is a bug that lead to crash!

it shows: RuntimeError: in-place operations can be only used on variables that don't share storage with any other variables, but detected that there are 2 bojects sharing it.

layer/normalize.py: line 28 in forward
x[I].div_(norm.data[I][0]
torch/autograd/variable.py,line321 in div_
return DivConstant.apply(self, other, True)

Results for lennon - eric_clapton pics are wrong.

I have run the model against the lennon, eric_clapton test pics and the results are wrong.
The results should be https://cmusatyalab.github.io/openface/demo-2-comparison/

The model produces:

lennon-1 lennon-2 tensor(1.0710, device='cuda:0')
lennon-1 clapton-1 tensor(2.0752, device='cuda:0')
lennon-1 clapton-2 tensor(1.1153, device='cuda:0')
lennon-2 clapton-1 tensor(1.0742, device='cuda:0')
lennon-2 clapton-2 tensor(1.8671, device='cuda:0')
clapton-1 clapton-2 tensor(2.1628, device='cuda:0')

The pics that I have used for lennon2 and clapton2 are not exactly the same as in the web but anyway the results with both set of pics is not below 0.99 for the real matches.

How to convert custom FaceNet model

In the README, it says:

The conversion is mostly done by clarwin's convert_torch_to_pytorch, with some added layers, e.g. Inception.

Please can you explain what modifications are necessary to the convert_torch_to_pytorch script, or publish your patches, so that it is possible for others to convert their own custom FaceNet .t7 models into PyTorch format?

In the convert_torch_to_pytorch repo, they have explicitly stated that FaceNet models are not supported, because of the Inception layers:

clcarwin/convert_torch_to_pytorch#2
clcarwin/convert_torch_to_pytorch#5

It's great that you have found a way to get it to work. Please can you share how you did it? This is useful to know for those of us that want to convert our own custom FaceNet .t7 model rather than use nn4.small2.v1.t7

Thanks very much.

Tensor size mismatch

Running the accompanying test.py I get the following error:

RuntimeError                              Traceback (most recent call last)
<ipython-input-10-a0eb75f7e274> in <module>()
     11 
     12 # CPU
---> 13 output = model(Variable(input))
     14 print('CPU done')
     15 

~/envs/face-recognition/lib/python3.5/site-packages/torch/nn/modules/module.py in __call__(self, *input, **kwargs)
    323         for hook in self._forward_pre_hooks.values():
    324             hook(self, input)
--> 325         result = self.forward(*input, **kwargs)
    326         for hook in self._forward_hooks.values():
    327             hook_result = hook(self, input, result)

~/envs/face-recognition/lib/python3.5/site-packages/torch/nn/modules/container.py in forward(self, input)
     65     def forward(self, input):
     66         for module in self._modules.values():
---> 67             input = module(input)
     68         return input
     69 

~/envs/face-recognition/lib/python3.5/site-packages/torch/nn/modules/module.py in __call__(self, *input, **kwargs)
    323         for hook in self._forward_pre_hooks.values():
    324             hook(self, input)
--> 325         result = self.forward(*input, **kwargs)
    326         for hook in self._forward_hooks.values():
    327             hook_result = hook(self, input, result)

~/openface-pytorch/layer/spatialcrossmaplrn.py in forward(self, x)
     53         # y = x / { (k + alpha / size * sum)^beta }
     54         layer_square_sum = layer_square_sum * self.alpha / self.size + self.k
---> 55         output = x * torch.pow(layer_square_sum, -self.beta)
     56 
     57         # recover 3D

RuntimeError: The size of tensor a (64) must match the size of tensor b (384) at non-singleton dimension 1

This appears to result from the batch size. If this gets changed to 1, the tensors match, but the following error appears:

TypeError                                 Traceback (most recent call last)
<ipython-input-9-20a43768b30f> in <module>()
     11 
     12 # CPU
---> 13 output = model(Variable(input))
     14 print('CPU done')
     15 

~/envs/face-recognition/lib/python3.5/site-packages/torch/nn/modules/module.py in __call__(self, *input, **kwargs)
    323         for hook in self._forward_pre_hooks.values():
    324             hook(self, input)
--> 325         result = self.forward(*input, **kwargs)
    326         for hook in self._forward_hooks.values():
    327             hook_result = hook(self, input, result)

~/envs/face-recognition/lib/python3.5/site-packages/torch/nn/modules/container.py in forward(self, input)
     65     def forward(self, input):
     66         for module in self._modules.values():
---> 67             input = module(input)
     68         return input
     69 

~/envs/face-recognition/lib/python3.5/site-packages/torch/nn/modules/module.py in __call__(self, *input, **kwargs)
    323         for hook in self._forward_pre_hooks.values():
    324             hook(self, input)
--> 325         result = self.forward(*input, **kwargs)
    326         for hook in self._forward_hooks.values():
    327             hook_result = hook(self, input, result)

~/openface-pytorch/layer/normalize.py in forward(self, x)
     26 
     27             for i in range(x.size(0)):
---> 28                 x[i].div_(norm.data[i][0])
     29             return x
     30         else:

TypeError: 'float' object is not subscriptable

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.