using of center_loss #5644
Open
Commits
Show all changes
8 commits
Select commit
Hold shift + click to select a range
0437af5
v1.0
ydwen fd13bed
fix error in readme
ydwen 8c2f109
update readme
ydwen dcb8c1e
mnist
ydwen 8d7da24
readme update
ydwen a23a640
a demo for extracting deep feature
ydwen b79a3c4
update readme
ydwen 9f0ad5c
update readme
ydwen
Jump to file or symbol
Failed to load files and symbols.
| @@ -1,44 +1,25 @@ | ||
| -COPYRIGHT | ||
| +Caffe-face | ||
| -All contributions by the University of California: | ||
| -Copyright (c) 2014, 2015, The Regents of the University of California (Regents) | ||
| -All rights reserved. | ||
| +Copyright (c) Yandong Wen | ||
| -All other contributions: | ||
| -Copyright (c) 2014, 2015, the respective contributors | ||
| All rights reserved. | ||
| -Caffe uses a shared copyright model: each contributor holds copyright over | ||
| -their contributions to Caffe. The project versioning records all such | ||
| -contribution and copyright details. If a contributor wants to further mark | ||
| -their specific copyright on a particular contribution, they should indicate | ||
| -their copyright solely in the commit message of the change when it is | ||
| -committed. | ||
| - | ||
| -LICENSE | ||
| - | ||
| -Redistribution and use in source and binary forms, with or without | ||
| -modification, are permitted provided that the following conditions are met: | ||
| - | ||
| -1. Redistributions of source code must retain the above copyright notice, this | ||
| - list of conditions and the following disclaimer. | ||
| -2. Redistributions in binary form must reproduce the above copyright notice, | ||
| - this list of conditions and the following disclaimer in the documentation | ||
| - and/or other materials provided with the distribution. | ||
| - | ||
| -THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND | ||
| -ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED | ||
| -WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE | ||
| -DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR | ||
| -ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES | ||
| -(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; | ||
| -LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND | ||
| -ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | ||
| -(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS | ||
| -SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | ||
| - | ||
| -CONTRIBUTION AGREEMENT | ||
| - | ||
| -By contributing to the BVLC/caffe repository through pull-request, comment, | ||
| -or otherwise, the contributor releases their content to the | ||
| -license and copyright terms herein. | ||
| +MIT License | ||
| + | ||
| +Permission is hereby granted, free of charge, to any person obtaining a | ||
| +copy of this software and associated documentation files (the "Software"), | ||
| +to deal in the Software without restriction, including without limitation | ||
| +the rights to use, copy, modify, merge, publish, distribute, sublicense, | ||
| +and/or sell copies of the Software, and to permit persons to whom the | ||
| +Software is furnished to do so, subject to the following conditions: | ||
| + | ||
| +The above copyright notice and this permission notice shall be included | ||
| +in all copies or substantial portions of the Software. | ||
| + | ||
| +THE SOFTWARE IS PROVIDED *AS IS*, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
| +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
| +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL | ||
| +THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR | ||
| +OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, | ||
| +ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR | ||
| +OTHER DEALINGS IN THE SOFTWARE. |
| @@ -0,0 +1,44 @@ | ||
| +COPYRIGHT | ||
| + | ||
| +All contributions by the University of California: | ||
| +Copyright (c) 2014, 2015, The Regents of the University of California (Regents) | ||
| +All rights reserved. | ||
| + | ||
| +All other contributions: | ||
| +Copyright (c) 2014, 2015, the respective contributors | ||
| +All rights reserved. | ||
| + | ||
| +Caffe uses a shared copyright model: each contributor holds copyright over | ||
| +their contributions to Caffe. The project versioning records all such | ||
| +contribution and copyright details. If a contributor wants to further mark | ||
| +their specific copyright on a particular contribution, they should indicate | ||
| +their copyright solely in the commit message of the change when it is | ||
| +committed. | ||
| + | ||
| +LICENSE | ||
| + | ||
| +Redistribution and use in source and binary forms, with or without | ||
| +modification, are permitted provided that the following conditions are met: | ||
| + | ||
| +1. Redistributions of source code must retain the above copyright notice, this | ||
| + list of conditions and the following disclaimer. | ||
| +2. Redistributions in binary form must reproduce the above copyright notice, | ||
| + this list of conditions and the following disclaimer in the documentation | ||
| + and/or other materials provided with the distribution. | ||
| + | ||
| +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND | ||
| +ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED | ||
| +WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE | ||
| +DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR | ||
| +ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES | ||
| +(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; | ||
| +LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND | ||
| +ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | ||
| +(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS | ||
| +SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | ||
| + | ||
| +CONTRIBUTION AGREEMENT | ||
| + | ||
| +By contributing to the BVLC/caffe repository through pull-request, comment, | ||
| +or otherwise, the contributor releases their content to the | ||
| +license and copyright terms herein. |
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
| @@ -0,0 +1,4 @@ | ||
| +# Ignore everything in this directory | ||
| +* | ||
| +# Except this file | ||
| +!.gitignore |
| @@ -0,0 +1,44 @@ | ||
| +clear;clc; | ||
| +addpath('path_to_matCaffe/matlab'); | ||
| +caffe.reset_all(); | ||
| + | ||
| +% load face model and creat network | ||
| +caffe.set_device(0); | ||
| +caffe.set_mode_gpu(); | ||
| +model = 'path_to_deploy/face_deploy.prototxt'; | ||
| +weights = 'path_to_model/face_model.caffemodel'; | ||
| +net = caffe.Net(model, weights, 'test'); | ||
| + | ||
| +% load face image, and align to 112 X 96 | ||
| +imgSize = [112, 96]; | ||
| +coord5points = [30.2946, 65.5318, 48.0252, 33.5493, 62.7299; ... | ||
| + 51.6963, 51.5014, 71.7366, 92.3655, 92.2041]; | ||
| + | ||
| +image = imread('path_to_image/Jennifer_Aniston_0016.jpg'); | ||
| +facial5points = [105.8306, 147.9323, 121.3533, 106.1169, 144.3622; ... | ||
| + 109.8005, 112.5533, 139.1172, 155.6359, 156.3451]; | ||
| + | ||
| +Tfm = cp2tform(facial5points', coord5points', 'similarity'); | ||
| +cropImg = imtransform(image, Tfm, 'XData', [1 imgSize(2)],... | ||
| + 'YData', [1 imgSize(1)], 'Size', imgSize); | ||
| + | ||
| +% transform image, obtaining the original face and the horizontally flipped one | ||
| +if size(cropImg, 3) < 3 | ||
| + cropImg(:,:,2) = cropImg(:,:,1); | ||
| + cropImg(:,:,3) = cropImg(:,:,1); | ||
| +end | ||
| +cropImg = single(cropImg); | ||
| +cropImg = (cropImg - 127.5)/128; | ||
| +cropImg = permute(cropImg, [2,1,3]); | ||
| +cropImg = cropImg(:,:,[3,2,1]); | ||
| + | ||
| +cropImg_(:,:,1) = flipud(cropImg(:,:,1)); | ||
| +cropImg_(:,:,2) = flipud(cropImg(:,:,2)); | ||
| +cropImg_(:,:,3) = flipud(cropImg(:,:,3)); | ||
| + | ||
| +% extract deep feature | ||
| +res = net.forward({cropImg}); | ||
| +res_ = net.forward({cropImg_}); | ||
| +deepfeature = [res{1}; res_{1}]; | ||
| + | ||
| +caffe.reset_all(); |
Oops, something went wrong.