biometrics / openbr

Open Source Biometrics, Face Recognition
www.openbiometrics.org
Other
2.85k stars 773 forks source link

Training the model and classifying the images #513

Closed zavalyshyn closed 7 years ago

zavalyshyn commented 7 years ago

Hi,

I'm trying to use OpenBR with the ufi dataset. I'm using cropped faces of these images. Every person has at 9 images in a separate folder. 1 additional image of each person is used for classification.

Now, I've trained the model using the following command:

$ br -algorithm "Open+Cvt(Gray)+Cascade(FrontalFace)+ASEFEyes+Affine(128,128,0.33,0.45)+CvtFloat+PCA(0.95)" -train train.csv EigenFaces
Set algorithm to Open+Cvt(Gray)+Cascade(FrontalFace)+ASEFEyes+Affine(128,128,0.33,0.45)+CvtFloat+PCA(0.95)
Training on train.csv to EigenFaces
2502 Training Files
Training Enrollment
Projecting Open+Cvt+Cascade+ASEFEyes+Affine(width=128,height=128,x1=0.33,y1=0.45)+CvtFloat
...
Training "PCA" 
...
Storing EigenFaces
Training Time: 00:02:06

where train.csv is a comma-separated list of files in training directory, in a format like

file-path,id
~/train/501/501-501_4.png,501
~/train/501/501-501_9.png,501
~/train/501/501-501_10.png,501
~/train/501/501-501_8.png,501
~/train/501/501-501_2.png,501
...

Training process seem to go fine, so I move to the process of enrolling the images

$ br -algorithm EigenFaces -enroll train.csv enroll_data.gal
Set algorithm to EigenFaces
Loading /home/holod/facerec/openbr/EigenFaces
Enrolling inesc-train.csv to enroll_data.gal
100.00%  ELAPSED=00:00:13  REMAINING=00:00:00  COUNT=2502

This also seems to work fine. Now I finally try to classify the test image using the trained model

br -algorithm EigenFaces -compare test/1/1-1_3.png enroll_data.gal 
Set algorithm to EigenFaces
Loading /home/holod/facerec/openbr/EigenFaces
Comparing test/1/1-1_3.png and enroll_data.gal
Enrolling test/1/1-1_3.png to 1-1_3rBaE6S.mem
100.00%  ELAPSED=00:00:00  REMAINING=00:00:00  COUNT=1
Segmentation fault

And here I get a segmentation fault. I'm not sure what I do wrong here. Can you please help me with this?

Thanks

sklum commented 7 years ago

@heroinsoul It looks like your algorithm is missing the comparison portion of the algorithm string. Note that, for example, the 4SF algorithm we provide in algorithms.cpp has NegativeLogPlusOne(ByteL1) as its distance metric. Check out the algorithm tutorial, where we note that the enrollment algorithm and comparison algorithm are separated by :.