tupleblog / face-classification-js

Face classification on JavaScript
https://tupleblog.github.io/face-classification-js/
MIT License
35 stars 5 forks source link

Train other images #5

Open Adilmar opened 5 years ago

Adilmar commented 5 years ago

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.

kittinan commented 5 years ago

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

Adilmar commented 5 years ago

Hi, thank you very much, awaiting you.

Regards

kittinan commented 5 years ago

I uploaded code on kittinan/face_classification

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

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

alt tag

Adilmar commented 5 years ago

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

Regards

titipata commented 5 years ago

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

Adilmar commented 5 years ago

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 commented 5 years ago

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

kittinan commented 5 years ago

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)

tensorflowjs==0.6.7
keras=2.2.2
tensorflow==1.12.0 (GPU Version)

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](https://user-images.githubusercontent.com/144775/50050151-e346da80-0125-11e9-9703-676b6a990b8d.png)
kittinan commented 5 years ago

@titipata I will move kittinan/face_classification to this repo

Adilmar commented 5 years ago

@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 commented 5 years ago

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 commented 5 years ago

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

config

Adilmar commented 5 years ago

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?

kittinan commented 5 years ago

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)
Adilmar commented 5 years ago

@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 commented 5 years ago

@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?

kittinan commented 5 years ago

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.

Adilmar commented 5 years ago

@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?

kittinan commented 5 years ago

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

Did you try MobileNetV2?

Adilmar commented 5 years ago

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 commented 5 years ago

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

kittinan commented 5 years ago

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

Adilmar commented 5 years ago

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?