Comments (16)
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.
so your saying mlp will create it? thanks for the response btw
from opencv-python-blueprints.
Exactly! You're welcome.
from opencv-python-blueprints.
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.
also, where is datasets/faces_training.pkl??? the only files in datasets are "init" and "homebrew"
from opencv-python-blueprints.
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:
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.
ok thanks for the help :)
from opencv-python-blueprints.
Hello Michael,
Is it possible to train MLP (params/mlp.xml
) using multiple datasets/faces_training-*.pkl
files?
Basically I want to do continuous Training
and Testing
in multiple sessions.
from opencv-python-blueprints.
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.
agree.
from opencv-python-blueprints.
ok just let me know if you get the gui working
from opencv-python-blueprints.
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.
ill email you
from opencv-python-blueprints.
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.
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.
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)
- Test/update code for OpenCV3
- Fix code for Raspberry Pi
- about chapter 7
- Cartoonizer on face with transparent background HOT 2
- cv2.cv.CV_CAP_PROP_FRAME_WIDTH doesn't exist in OpenCV 3 HOT 2
- capture.set(cv2.CV_CAP_PROP_FRAME_HEIGHT, 480) ----> does not work in opencv3 HOT 2
- metaclass error for chapter7 HOT 1
- Bug for mac
- Chapter 2 HOT 1
- chapter7 classifiers.py code is not working HOT 4
- could not align head HOT 8
- Chapter 5: Error too many values to unpack HOT 1
- Chapter 1, filters.py OpenCV error HOT 3
- TypeError: only length-1 arrays can be converted to Python scalars HOT 4
- error params order for row and cols in ` plot_power_spectrum` HOT 1
- wxPython blocks on EVT_TIMER (Windows) HOT 1
- Classification label not drawn above bounding box HOT 1
- Move common code out of chapters HOT 1
- wxPython can't be installed on Mac OS X 10.11 El Capitan HOT 3
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from opencv-python-blueprints.