Ask Your Question
1

How to add new images to yml dataset?

asked 2016-01-25 12:11:58 -0600

Bilityuk gravatar image

Hi to everyone! I save the trained model:

trainedmodel->save("C:\\fisherface.yml");

And load it from the file pass:

trainedmodel->load("C:\\fisherface.yml");

But is there any way to update the yml dataset with new images or add some new images for existing person? I mean if i close my programm and after start it again i want to train some new faces and add it to existing yml dataset. Now if i use save function it just clears the previous data and stores the current model to it..

Thank you.

edit retag flag offensive close merge delete

Comments

You can load the old data set and store it in a cv::Mat. Then you can concatenate the new data with cv::hconcat or cv::vconcat and save it again. I'm not sure if this is valid for classification data (I don't think so), but for feature or training data it should work. So in the second case you have to train again.

matman gravatar imagematman ( 2016-01-25 15:48:17 -0600 )edit

Thank you for reply! What is the best practice to make a selftraining programm that stores and updates the dataset when it detect the new face? Can you advice what kind of scenario better to use: 1) Use LBPH model with update function. But how to add new data to yml dataset with update function? 2) Use Eigen or Fisher with concat function. Is there any code samples that shows how to use this function to add data to yml dataset? 3) Use images in folder and csv file with labels and filepass to images. And any time the new face detected, save the frame in image folder, write additional string to csv and retrain the model.

Thank you for advices...

Bilityuk gravatar imageBilityuk ( 2016-01-26 01:42:40 -0600 )edit
1

with lbph it works like load() -> update(with new data) -> save()

whith fisher you have to keep your original data set, -> append new data to that -> train() -> save()

forget the hconcat idea, or anything like manipulating/adding to the yml files. it's the wrong idea, and won't work ever.

berak gravatar imageberak ( 2016-01-26 02:41:13 -0600 )edit

berak, can you explain please a little bit more clear what do you mean by "keep original data set" and "append new data to that"?

Bilityuk gravatar imageBilityuk ( 2016-01-26 03:19:42 -0600 )edit
1

unfortunately, idk. exactly, what you are doing there, but you have to keep the original images around, load them again into a images list, add the new images, add new labels to the labels list, and then re-run the training. then you can save the new model.

berak gravatar imageberak ( 2016-01-26 03:23:21 -0600 )edit
1

Ok! Thank you berak. Now its clear. You meant the 3d option i posted before

Bilityuk gravatar imageBilityuk ( 2016-01-26 03:45:45 -0600 )edit

ah, yes. looking up there, i think, so.

berak gravatar imageberak ( 2016-01-26 03:57:50 -0600 )edit

It would be great if someone share a code sample or similar project github link. I want to make a face recognition programm that can update faces and labels dataset dynamically during runtime and save the new faces for future use.

Bilityuk gravatar imageBilityuk ( 2016-01-26 04:27:20 -0600 )edit

1 answer

Sort by ยป oldest newest most voted
1

answered 2016-01-25 21:15:07 -0600

berak gravatar image
  • you can't update a fisher or eigenfaces model, instead you have to re-train it on the complete data.

  • you can update an LBPH model (by calling update() with the additional data)

edit flag offensive delete link more

Question Tools

1 follower

Stats

Asked: 2016-01-25 12:11:58 -0600

Seen: 1,411 times

Last updated: Jan 25 '16