Coder Social home page Coder Social logo

Comments (16)

mbeyeler avatar mbeyeler commented on August 18, 2024

Have a look at the top of chapter7.py, the process flow is explained there. After you recorded your own training set, which is stored in datasets/faces_training.pkl, you want to train the MLP on it by running train_test_mlp.py. This script will create datasets/faces_preprocessed.pkl.

Chapter 7: Learning to Recognize Emotion in Faces
An app that combines both face detection and face recognition, with a
focus on recognizing emotional expressions in the detected faces.
The process flow is as follows:
 * Run the GUI in Training Mode to assemble a training set. Upon exiting
   the app will dump all assembled training samples to a pickle file
   "datasets/faces_training.pkl".
 * Run the script train_test_mlp.py to train a MLP classifier on the
   dataset. This file will store the parameters of the trained MLP in
   a file "params/mlp.xml" and dump the preprocessed dataset to a
   pickle file "datasets/faces_preprocessed.pkl".
 * Run the GUI in Testing Mode to apply the pre-trained MLP classifier
   to the live stream of the webcam.

from opencv-python-blueprints.

johnConsidine avatar johnConsidine commented on August 18, 2024

so your saying mlp will create it? thanks for the response btw

from opencv-python-blueprints.

mbeyeler avatar mbeyeler commented on August 18, 2024

Exactly! You're welcome.

from opencv-python-blueprints.

johnConsidine avatar johnConsidine commented on August 18, 2024

you are telling me to run in "training mode" and "testing mode", im sorry if this is a dumb question but i just see options to "run" on spyder, i dont get these modes...

from opencv-python-blueprints.

johnConsidine avatar johnConsidine commented on August 18, 2024

also, where is datasets/faces_training.pkl??? the only files in datasets are "init" and "homebrew"

from opencv-python-blueprints.

mbeyeler avatar mbeyeler commented on August 18, 2024

Hi, as mentioned above, running chapter7.py in training mode will create datasets/faces_training.pkl. Running train_test_mlp.py will convert datasets/faces_training.pkl to datasets/training_preprocessed.pkl.

Regarding the GUI issue, you should see "Train" and "Test" buttons at the bottom:
b04521_07_03

Click on "Train", select an emotion such as "happy", then smile into your webcam and click "Take Snapshot". Keep taking snapshots of all emotions so that you'll get a good training set (I'd say, at least 10 snapshots per emotion). Then when you close the GUI, all snapshots will be dumped to datasets/faces_training.pkl.

However, there seems to be a bug in the Windows version of wxPython (see issue #4), which messes up the GUI. I'm working on it and will post an update as soon as I have found a workaround.

from opencv-python-blueprints.

johnConsidine avatar johnConsidine commented on August 18, 2024

ok thanks for the help :)

from opencv-python-blueprints.

G10DRAS avatar G10DRAS commented on August 18, 2024

Hello Michael,
Is it possible to train MLP (params/mlp.xml) using multiple datasets/faces_training-*.pkl files?
Basically I want to do continuous Trainingand Testing in multiple sessions.

from opencv-python-blueprints.

mbeyeler avatar mbeyeler commented on August 18, 2024

Hi guys, I just created a Google group that would be better suited for discussions. Issues are more for bug reports... Maybe we can discuss options over there?

from opencv-python-blueprints.

G10DRAS avatar G10DRAS commented on August 18, 2024

agree.

from opencv-python-blueprints.

johnConsidine avatar johnConsidine commented on August 18, 2024

ok just let me know if you get the gui working

from opencv-python-blueprints.

johnConsidine avatar johnConsidine commented on August 18, 2024

it keeps freezing when i try to run it... when it runs only a picture of me shows up and where the buttons should be its not coming on

from opencv-python-blueprints.

johnConsidine avatar johnConsidine commented on August 18, 2024

ill email you

from opencv-python-blueprints.

mbeyeler avatar mbeyeler commented on August 18, 2024

Reportedly, this issue has been resolved.
Future readers/users, you are welcome to discuss issues and seek help in our brand-new Google group.

from opencv-python-blueprints.

XDUSPONGE avatar XDUSPONGE commented on August 18, 2024

Hello Michael
Is this code suitable for linux , i just run the code in ubuntu and ,the test button can not be clicked, it is very strange. It just says that there should be at least one input

from opencv-python-blueprints.

mbeyeler avatar mbeyeler commented on August 18, 2024

Hi XDUSPONGE, I know you're aware of the answer by now, but I'm posting this here for the sake of others: This issue has been discussed in the Google Discussion group.

In short, you need to generate a training set first by following the workflow I mentioned in the second post above from Feb16. This excerpt is taken from the source code of chapter7/chapter7.py. A more detailed explanation and step-by-step guide can be found in the book in Chapter 7.

If you have more questions or run into any issues with this, it's easier to ask in the Discussion group. Thanks!

from opencv-python-blueprints.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.