Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Problem generating ADA models #63

Open
egottardo opened this issue Jan 17, 2016 · 15 comments
Open

Problem generating ADA models #63

egottardo opened this issue Jan 17, 2016 · 15 comments

Comments

@egottardo
Copy link

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_surprise_feats

(*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
Copy link

Same Problem!
screenshot

@mastiffs92
Copy link

@egottardo

@dbellavista
Copy link
Collaborator

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
#63 (comment).

@mastiffs92
Copy link

@dbellavista
Look this table with gabor.
immagine

@luca-m
Copy link
Owner

luca-m commented Jan 31, 2016

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
Copy link

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
Copy link

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
Copy link
Author

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
Copy link

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
Copy link
Author

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
Copy link
Author

@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
Copy link

@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
Copy link

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
Copy link
Author

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
Copy link

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants