Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How to enhance AUs from within Facsvatar? (Fix the notebook GUI) #19

Open
Animixer opened this issue May 12, 2020 · 9 comments
Open

How to enhance AUs from within Facsvatar? (Fix the notebook GUI) #19

Animixer opened this issue May 12, 2020 · 9 comments

Comments

@Animixer
Copy link

Hi there,

The set_new_multiplier function in smooth_data.py multiplies the value of AU45 by 1.5. I can change this value, and this seems to work. But I am having trouble adding multipliers for other AU's. Should this be possible or not?

I have tried this by adding a similar line below the one for AU45, so for example:
self.multiplier[15] = 2.0

But this causes an error in the Process_bridge module:

Traceback (most recent call last):
File "main.py", line 43, in
from smooth_data import SmoothData
File "...\FACSvatar\modules\process_bridge\smooth_data.py", line 40
self.multiplier[15] = 2.0
^
TabError: inconsistent use of tabs and spaces in indentation

I have also tried to change the line for AU45 into self.multiplier[15:17] = [2.0,1.5]

But this gives the following error:

Traceback (most recent call last):
File "main.py", line 43, in
from smooth_data import SmoothData
File "...\FACSvatar\modules\process_bridge\smooth_data.py", line 34
def set_new_multiplier(self no_of_columns=17):
^
SyntaxError: invalid syntax

If it is possible to set additional multipliers, can you show me how to do this?
If not, is there another way to enhance AUs? (other than editing the CSV file from OpenFace)

@NumesSanguis
Copy link
Owner

I haven't checked yet what you're trying to do, but those errors seem to be not specific to FACSvatar, but to Python in general. It seems that your text editor is set to use tabs instead of 4 spaces.
I would recommend to use an IDE such as PyCharm (https://www.jetbrains.com/pycharm/) to edit the Python files, because it will warn you about the errors you're encountering now.

In the case of def set_new_multiplier(self no_of_columns=17):, that self space no_of_columns=17 is not valid Python code.

Thank you for including the Traceback output of the error. It will be even more readable if you put the code between 2x ```
For example:

`` `
Code / output
`` `

@NumesSanguis
Copy link
Owner

Do I understand correctly that what you want to achieve is what's demonstrated in this video from 00:14 to 00:27?:
https://www.youtube.com/watch?v=J2FvrIl-ypU

@Animixer
Copy link
Author

Ah of course, thanks for the advice.
I used a simple IDE to do this and now the errors are gone.

Yes, I want to exaggerate some of the AUs that I feel don't show well enough in the Blender model.
Can I do this for any AU by adding this:

'''self.multiplier[index] = number'''

@Animixer
Copy link
Author

Sorry I mean

self.multiplier[index] = number

@NumesSanguis
Copy link
Owner

Hey, how are you doing with this? Sorry for my late reply.
I wanted to suggest to use the GUI to achieve this result (https://github.com/NumesSanguis/FACSvatar/tree/master/modules/gui), however after testing it, it seems it's not working with the latest code changes.
I'm hope to fix this soon.

Basically what this GUI is doing is sending a command to the bridge module to change the multiplier values. Specifically this piece of code: https://github.com/NumesSanguis/FACSvatar/blob/master/modules/process_bridge/main.py#L190-L223

@Animixer
Copy link
Author

Hi, no problem.

It seems to work now when I add lines to the set_new_multiplier function.
Is the GUI a window with sliders that allows to control the multipliers?
That could be handy I think, but for the time being adding multipliers in the code works fine as well.

Thanks!

@NumesSanguis
Copy link
Owner

Glad to hear you got it to work :)

Yes, the GUI is exactly what is shown in the video (the sliders) I linked:

https://www.youtube.com/watch?v=J2FvrIl-ypU

Although that was with the older code base of FACSvatar (when the GUI was still working).

@NumesSanguis NumesSanguis changed the title How to enhance AUs from within Facsvatar? How to enhance AUs from within Facsvatar? (Fix the notebook GUI) May 25, 2020
@Animixer
Copy link
Author

Animixer commented Jul 1, 2021

Hi Numes,

Since I asked you about the AU multipliers I have been working on many things.
Now that I am getting back to this, I see that setting the multipliers in the way I did does not actually change the intensity of the AUs. It only changes the array of numbers printed after "Router awaiting commands" in the Bridge module. Which made me think it was working.

So I wonder if you had any time to look at the gui, or whether you know of a way to specify multipliers directly in the Bridge module. Perhaps by adding an array of numbers in the piece of code you mentioned? https://github.com/NumesSanguis/FACSvatar/blob/master/modules/process_bridge/main.py#L190-L223

I would appreciate it if you could share any thoughts you have on this.

@NumesSanguis
Copy link
Owner

Hi @Animixer , sorry for my slow reply. I'm currently not actively working at this project.

It sounds strange though, the GUI should send a command to the Bridge module, which then internally changes the value of the intensity of the AUs (if the message from the GUI properly arrives). In case it does not work, you can indeed do this manually.

First of all, you probably want to be on the v0.4.x branch (newer): https://github.com/NumesSanguis/FACSvatar/tree/v0.4.0

The hacky-approach is to hard code the values (if you don't need real-time modifications). This function sets all multiplier values to 1 (except for AU45, which is set to 1.5):
https://github.com/NumesSanguis/FACSvatar/blob/v0.4.0/modules/process_bridge/smooth_data.py#L34-L40

The proper way is to send a message to the bridge module with the new multiplier values (what the GUI is supposed to do). But it seems it is currently not working, which why this issue is still open.The GUI uses this function:
https://github.com/NumesSanguis/FACSvatar/blob/v0.4.0/modules/gui/controller.py#L52-L67

Hope this can point you in the right direction!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants