face-classification-js icon indicating copy to clipboard operation
face-classification-js copied to clipboard

Train other images

Open Adilmar opened this issue 6 years ago • 23 comments

Hi Congratulations on the application, I would like to train with another image base to buy the results in my experiment, could you help me how to perform the training to generate the models of the tensorflow, I would be very grateful beyond mentioning your work clear.

Adilmar avatar Dec 13 '18 19:12 Adilmar

We'll upload the code to train over the weekend. We will tag you when the code is ready!

oarriaga/face_classification is original repository we use to train

kittinan avatar Dec 14 '18 02:12 kittinan

Hi, thank you very much, awaiting you.

Regards

Adilmar avatar Dec 14 '18 11:12 Adilmar

I uploaded code on kittinan/face_classification

  • This following my code modified from original: https://github.com/kittinan/face_classification/blob/master/src/train_gender_mobilenet.py https://github.com/kittinan/face_classification/blob/master/src/train_emotion_mobilenet.py

  • Pretrained gender classification model

https://github.com/kittinan/face_classification/blob/master/trained_models/gender_models/gender_mobilenet_0.25.24-0.94.hdf5

  • Pretrained emotion classification model

https://github.com/kittinan/face_classification/blob/master/trained_models/emotion_models_mobilenet_alpha_adam_0.25/fer2013_mobilenet.96-0.63.hdf5

  • and this is how to convert Keras model to Tensowflow.js here

alt tag

kittinan avatar Dec 14 '18 14:12 kittinan

Thanks friends I will carry out the training with new base, thank you very much for the help, any contribution notice you.

Regards

Adilmar avatar Dec 14 '18 16:12 Adilmar

@kittinan should we make the PR to this repository? It should be a good idea to move everything into one place.

titipata avatar Dec 14 '18 19:12 titipata

I have managed to generate the json templates but when I load it into the application it appears Unknown layer: ReLU, do you know what it can be?

Adilmar avatar Dec 15 '18 22:12 Adilmar

I converted your keras and it returned a different error on the shape, see in the image the errors. rrrr

Adilmar avatar Dec 15 '18 23:12 Adilmar

I'm not sure why the error happens, I tested to convert Keras model to tfjs model and it works for me.

Can you navigate that page with the only HTTP? (http://localhost/face_tensor)

  • My software verion:
tensorflowjs==0.6.7
keras=2.2.2
tensorflow==1.12.0 (GPU Version)
  • My command to convert Keras model to tfjs
tensorflowjs_converter --input_format keras \
                       /home/tun/git/face_classification/trained_models/gender_models/gender_mobilenet_0.25.24-0.94.hdf5 \
                       /tmp/gender


tensorflowjs_converter --input_format keras \
                       /home/tun/git/face_classification/trained_models/emotion_models_mobilenet_alpha_adam_0.25/fer2013_mobilenet.96-0.63.hdf5 \
                       /tmp/emotion2
  • Test the new tfjs model

screenshot at 2018-12-16 11 20 37

kittinan avatar Dec 16 '18 04:12 kittinan

@titipata I will move kittinan/face_classification to this repo

kittinan avatar Dec 16 '18 04:12 kittinan

@kittinan converting your template worked was https, now my still problems will generate it with these settings.

How did you install the tensorflow for GPU can this be?

And this little boy there? cute

Here are my packages, apparently they're ok

Regards

ok

Adilmar avatar Dec 16 '18 13:12 Adilmar

Personally it did not work out, I generated the hdf5 from fer2013, converti is the ReLU error persists, the only other thing I noticed is that my tensoflow is not the one for GPU how do I use it? I have to install ?

Thanks !!!

Adilmar avatar Dec 16 '18 13:12 Adilmar

I've changed mine for only 1 epoch so what's this? see your hdf5 files and mine is a size difference.

config

Adilmar avatar Dec 16 '18 14:12 Adilmar

I found the problem despite the version of keras being the same it is using the mobilenet_0.50_64 and the one of you the mobilenet_0.25_64.

The version 50_64 adds this class relu, have idea of how to solve?

Adilmar avatar Dec 16 '18 14:12 Adilmar

I use Anaconda for Tensorflow GPU installation (this package) on my ubuntu 16.04

A little boy is my son :smiley:

The ReLU activation function is very famous and it implemented on tfjs, I don't know why you got the error about it.

Size of file difference because of an Alpha parameter for Mobilenet. My trained model use alpha=0.25, in the code I uploaded that use alpha=0.5 because I try to find better accuracy model and I forgot to change it back.

You should to use alpha=0.25 for better size model

model = MobileNet(input_shape=(64, 64, 1), include_top=True, alpha=0.25, classes=7, weights=None)

kittinan avatar Dec 16 '18 14:12 kittinan

@kittinan understood in your output file Json there is no RELU class, it is in the js file I do not know how to add it to vanish with the error.

Familly happy 👍

Adilmar avatar Dec 16 '18 14:12 Adilmar

@kittinan I was able to resolve updated to the latest version of tensorflow.js, thanks for the help.

Another question you ran 10,000 epochs to get this result?

Adilmar avatar Dec 16 '18 14:12 Adilmar

This is my converted model today https://drive.google.com/drive/folders/1Ev-ttC3xRnx6G--Vl7kU5kEM2d5TdcCm?usp=sharing

I ran around 100 epochs. In the code has EarlyStopping to stop training model when not improvement.

kittinan avatar Dec 16 '18 14:12 kittinan

@kittinan Thank you very much, I'll try with other image bases now, other thing have you already tried adding UAS points as an attribute to improve the rating?

Adilmar avatar Dec 16 '18 14:12 Adilmar

@Adilmar I don't know about UAS points. Can you explain it?

Did you try MobileNetV2?

kittinan avatar Dec 18 '18 02:12 kittinan

Hi @kittinan my Test MobileNetV2 is running the experiment with a base FER2013, I wonder if you can help me create another csv 40x40 like the other with the images.

As the Action Unit is muscle points on the face used to classify emotions, it is part of my PhD research, see the theory at https://pt.wikipedia.org/wiki/Facial_Action_Coding_System

This is my article

https://www.researchgate.net/publication/300237689_Application_for_recognition_document_of_emocracies_in_virtuals_of_learning

Regards, nice day.

Adilmar avatar Dec 19 '18 12:12 Adilmar

Hi @kittinan I generated the json of the last hdf5 in 100 epoch but the results for classification are very low even for emotion joy what can be friend?

Did I refine the tests by returning their original models gave a little improvement? One detail that I realized is that my final product is only 1 json and 1 group1-shard1of1 yours has several what would it be? My fer2013_emotion_training.log

My 0001

You 00013

Adilmar avatar Dec 21 '18 00:12 Adilmar

You got the same validation accuracy on my model. The model is not accurate because has a bias on training data (FER2013), the dataset has a bit Asian or Latin Ameria faces.

You got only 1 json and 1 group1-shard1of1 because of the new version tfjs converter increase size on a sharding file

kittinan avatar Dec 21 '18 02:12 kittinan

I understand @kittinan thank you very much, I'm putting together a mixed base that could help me make some program that converts the image to 40x40 pixels as well as the base FER2013?

Adilmar avatar Dec 22 '18 13:12 Adilmar