luca-m / emotime

Recognizing emotional states in faces
138 stars 65 forks source link

Problem generating ADA models #63

Open egottardo opened 8 years ago

egottardo commented 8 years ago

Hi, I'm trying to create a model using the ADA classifier running the following: ->python datasetInit.py --cfg my_dataset.cfg ../dataset ->python datasetFillCK.py --cfg my_dataset.cfg ../dataset ../ckimages ../ckemotion ->python train_models.py --cfg my_dataset.cfg --mode ada --prep-train-mode 1vsallext --eye-correction ../dataset

Initially, in order to generate the model with ADA, I needed to change the train_models.py file, fixing the parameter --mode to 'ada' instead of 'AdaBoost'. After this change i can run the train_models.py, but the train_cli procedure starts, generates some files and stay running indefinitely without generating new files. Using the SVM classifier i can generate models without any problem.

I would like to see if anyone could help me or if anyone has an ADA generated model that can be made available for testing.

Below the log generated in the execution and following the configuration file "my_dataset.cfg":

Thanks in advance for any help. Ernani

ernani@Noteifrs ~/emotime-master/assets $ python train_models.py --cfg my_dataset.cfg --mode ada --prep-train-mode 1vsallext --eye-correction ../dataset * Emotime *

Luca Mella Daniele Bellavista

[*] Remember! Before using the training, the dataset folder must be initialized with datasetInit.py and datasetFillCK.py

[_] Parameters: [>] Dataset folder: ../dataset [>] Configuration file: my_dataset.cfg [>] Trainig mode: ada [>] Trainig preparation mode: 1vsallext [>] Eye correction: True [>] Skip facecrop (WARNING): False [1] Cropping faces... INFO: start cropping faces with 'facecrop' INFO: running facecropping with eye correction on neutral (228 of 228, 1 failed) INFO: running facecropping with eye correction on anger (41 of 41, 0 failed) INFO: running facecropping with eye correction on contempt (11 of 11, 0 failed) INFO: running facecropping with eye correction on disgust (42 of 42, 0 failed) INFO: running facecropping with eye correction on fear (19 of 19, 0 failed) INFO: running facecropping with eye correction on happy (51 of 51, 0 failed) INFO: running facecropping with eye correction on sadness (17 of 17, 0 failed) INFO: running facecropping with eye correction on surprise (56 of 56, 1 failed) [2] Computing features using bank of gabor magniture filters... INFO: calculating gabor features ......................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................... [3] Preparing CSV files with training data using 1vsallext... INFO: preparing training files for 1 to All Extended multiclass [4] Training with ada and selecting relevant features... INFO: dataset folder. ../dataset INFO: classifFldr. ../dataset/classifiers/ada INFO: starting training. ada INFO: done contempt_disgust_vs_anger_fear_happy_neutral_sadness_surprise_feats INFO: done contempt_neutral_vs_anger_disgust_fear_happy_sadness_surprise_feats INFO: done contempt_vs_anger_disgust_fear_happy_neutral_sadness_surprise_feats INFO: done anger_fear_happy_vs_contempt_disgust_neutral_sadness_surprise_feats INFO: done anger_happy_neutral_vs_contempt_disgust_fear_sadness_surprise_feats INFO: done fear_happy_neutral_vs_anger_contempt_disgust_sadness_surprisefeats

(*I aborted the process after about one hour of execution without any new generated file)


Configuração File= my_dataset.cfg

Example configuration file. This file will be overwritten

everytime you perfomrs an install

Classes to recognize

[CLASSES] neutral: 0 anger: 1 contempt: 2 disgust: 3 fear: 4 happy: 5 sadness: 6 surprise: 7

[TRAINING]

Folder containing the raw images (should contain a subfolder for each classes to recognize)

IMAGES: training/images

Folder containing the cropped faces (should contain a subfolder for each classes to recognize)

FACES: training/faces

Folder containing the features calculated for each face image.

Should have a first layer of subfolder named as classes to recognize, and inside each

class subfolder should contains a folder for each face image that belongs to that class

FEATURES: training/features

[VALIDATION]

Folder containing the raw images (should contain a subfolder for each classes to recognize)

IMAGES: validation/images

Folder containing the cropped faces (should contain a subfolder for each classes to recognize)

FACES: validation/faces

Folder containing the features calculated for each face image.

Should have a first layer of subfolder named as classes to recognize, and inside each

class subfolder should contains a folder for each face image that belongs to that class

FEATURES: validation/features

[FOLDER]

Folder containing the csv files of the features for training set and validation set (one file per classifier)

TRAIN: trainfiles

Folder containing the trained classifiers (auspiciously should be opencv .xml files)

CLASSIFIER: classifiers CLASSIFIER_ADA: classifiers/ada CLASSIFIER_SVM: classifiers/svm

[SUFFIX]

Suffix of the folder which contains Gabor filtered images

FILTERED_FOLDER: _feats

Suffix of the file containing features in csv format

FEATURE_FILE: _feats.csv

[FACECROP] TOOL: ./facecrop_cli FACE_DETECTOR_CFG: ../resources/haarcascade_frontalface_default.xml EYE_DETECTOR_CFG: ../resources/haarcascade_eye.xml

[SIZE]

Size of the images before features extraction

width: 48 height: 48

[GABOR] TOOL: ./gaborbank_cli FILTER_FILE: NA FEAT_FNAME: gabor.yml NWIDTHS: 3 NLAMBDAS: 5 NTHETAS: 4

[TRAIN]

Write samples features directly in the csv file prepared for training, this way is possible to use CvMLData.read_csv for

loading sample data. If "False" do not embed any feature in the csv file, instead specify the file path where to find

the feature matrix of the sample.

TOOL: ./train_cli ADA_CPU_USAGE: 0.5 ADA_FILTER_FNAME: adaboost_featselection.dat SVM_CPU_USAGE: 0.5 SVM_FILTER_FNAME: svm_featselection.dat

[DETECTION] TOOL: ./emo_detector_cli

[GUI] TOOL: ./emotimegui_cli

mastiffs92 commented 8 years ago

Same Problem! screenshot

mastiffs92 commented 8 years ago

@egottardo

dbellavista commented 8 years ago

I remember we didn't achieve great results with adaboost, however how long did you kept the script running? I remember training sessions of hours (even a day long on some old hardware)

On Sat, Jan 30, 2016, 6:30 PM mastiffs92 notifications@github.com wrote:

@egottardo https://github.com/egottardo

— Reply to this email directly or view it on GitHub https://github.com/luca-m/emotime/issues/63#issuecomment-177257640.

mastiffs92 commented 8 years ago

@dbellavista Look this table with gabor. immagine

luca-m commented 8 years ago

We used adaboost in very early dev stage. At the moment my advice is to use svm, but we are also thinking to give a try with some random forest algorithm soon, opencv should also support that kind of algorithms.

mastiffs92 commented 8 years ago

Hi Luke,I need to adaboost classificator for my thesis , from where I could start to understand the problem of the generation of models in adaboost? I remember you that six of eight they are generated, look the screen! screenshot @luca-m

mastiffs92 commented 8 years ago

The number of models to be generated are 3 and in this case it works, do not see results, it is a test. screenshot_ada @dbellavista @luca-m @egottardo

egottardo commented 8 years ago

Hi, In my search for problem, I found that the parameter weak_count was set with train_data.cols. This set that parameter with a high value when compared with the default value of 100 in the opencv docs. Changing this, i got it run and generate all the xml. However, i'm not sure the impact of this changing in the quality of generated model. In my first tests, the results are not best than SVM.

Below the function altered in AdaBoostClassifier.cpp bool AdaBoostClassifier::doTraining(cv::Mat train_data, cv::Mat train_labels) { // this->params.weak_count = train_data.cols; this->params.weak_count = 100;

mastiffs92 commented 8 years ago

Understood, then maybe it's really a matter of time? but I can not explain how it is possible that then 6 files .xml generate them. Should go slow on the first file. @egottardo

egottardo commented 8 years ago

I notice that this depend of the number of images per emotion in the file being generated. In the Kohn-Canade database there a lot of neutral and few contempt, for example. Then to generate a xml with neutral in the left part (eg. neutral_sadness_surprise_vs_anger_contempt_disgust_fear_happy_feats.xml) takes more time that for example, contempt_disgust_surprise_vs_anger_fear_happy_neutral_sadness_feats.xml.

egottardo commented 8 years ago

@mastiffs92, could you explain how you create the models with the three classes: openness, extraversion and conscientiousness? I'm interested in test with another set of classes. Thanks in advance.

mastiffs92 commented 8 years ago

@egottardo Thanks you first of all, I'm trying to use this library to make recognition of personality. Read these two papers to undesratnd something. Link relative to dataset:http://www.dcs.gla.ac.uk/~yolanda/homepage_publications/p1153-moubayed.pdf, and another link:https://en.wikipedia.org/wiki/Big_Five_personality_traits. However programmatically I modified the example file dataset.cfg, datasetFillCK and two file .cpp where they were cpp macros emotions(EmoDetector.h,EmoDetector.cpp).

mastiffs92 commented 8 years ago

Update @egottardo screenshot No changing code .cpp, but it is only a matter of time! Estimated time : 1 day. Hardware PC: intel dual core,4 gb of ram.

egottardo commented 8 years ago

Thanks for feedback. If the time is a constraint, changing de weak_count should be an option. However, the impact in accuracy should be measured.

mastiffs92 commented 8 years ago

@egottardo I am using the method 1 vs allext. I'll know.