patrikhuber / 4dface

Real-time 3D face tracking and reconstruction from 2D video
https://www.4dface.io
Apache License 2.0
786 stars 248 forks source link

Model and blendshapes dimension mismatch #8

Closed Larumbergera closed 7 years ago

Larumbergera commented 7 years ago

Hi Patrik,

Thanks for your code. I'm trying to run 4dface.exe with the binaries "sfm_1724.bin", "sfm_16759.bin" and "sfm_29587.bin" but I have this error message:

4dface -m "../share/sfm_29587.bin"

OpenCV Error: Assertion failed (C.type() == type && (((flags&GEMM_3_T) == 0 && C.rows == d_size.height && C.cols == d_size.width) || ((flags&GEMM_3_T) != 0 && C.rows == d_size.width && C.cols == d_size.height))) in cv::gemm, file C:\buildslave64\win64_amdocl\master_PackSlave-win64-vc14-shared\opencv\modules\core\src\matmul.cpp, line 923

At first, I thought the problem occurs because I was using "sfm_xxx.bin" (I don't have "sfm_shape_xxxx.bin") but the program works with "sfm_3448.bin". I don't know if this error can occur because I don't have "expression_blendshapes_xxxx.bin".

Regards,

Andoni.

patrikhuber commented 7 years ago

Hi Andoni,

If the error doesn't occur with sfm_3448.bin but it occurs with other models, it indeed sounds like your guess is correct and it's the missing blendshapes.

I assume you're using the default parameters, so it would load the expression_blendshapes_3448.bin, and then try to add these to the 1724 or 16759 model to construct a face, which obviously can't work.

I think in the files we initially provided for download on the CVSSP website we didn't provide the other blendshapes, but this should since be fixed and all blendshape files should be available for download. Please check your download email again, or if it has expired, give us a quick shout through the CVSSP web form / email so we can issue you another download. Thanks!

Cheers, Patrik

patrikhuber commented 7 years ago

I think we may not have added them to our download yet. Give me a day to check it, I'll update this ticket. Related: #5

patrikhuber commented 7 years ago

All expression blendshapes are now available for download via the CVSSP download link you received in your email. Let me know if there's any more issues. Thanks!

Larumbergera commented 7 years ago

Thanks Patrik!

I have downloaded the expression_blendshapes and I have tried to run 4dface.exe:

4dface -m "..\share\sfm_shape_16759.bin" -b "../share/expression_blendshapes_16759.bin" Perfect

4dface -m "..\share\sfm_shape_1724.bin" -b "../share/expression_blendshapes_1724.bin"

OpenCV Error: Assertion failed (0 <= _rowRange.start && _rowRange.start <= _rowRange.end && _rowRange.end <= m.rows) in cv::Mat::Mat, file C:\opencv\github-2.4\opencv\modules\core\src\matrix.cpp, line 284

I dont know why 1724 model doesn't work...

By the way, can you upload "expression_blendshapes_29587.bin"? I'm very interested in using this model.

Regards, Andoni.

patrikhuber commented 7 years ago

You're welcome.

This is most likely because some of the landmark -> vertex mappings from the ibug2did file that exist in the larger models don't exist in the 1724 model. Have a look at that file and delete all mappings to vertex id's equal or larger than 1724.

For the future, if you run the code in a debugger, it will give you the call stack and tell you exactly at what line and why it crashed and you'll easily be able to find out whether it's because of blendshape dimensions or vertex ids or whatever other problem there may or may not occur.

The expression blendshapes for the 29587 model are in that download folder as well under the name expression_blendshapes.bin. You can easily make that out by looking at the file sizes. The naming scheme is that if something doesn't have a number postfix, then it's for the "big" model.

Larumbergera commented 7 years ago

Now it works perfectly!

Thanks and sorry for bothering you.

patrikhuber commented 7 years ago

Cool! :-)

patrikhuber commented 7 years ago

The expression blendshapes for the 29587 model are in that download folder as well under the name expression_blendshapes.bin. You can easily make that out by looking at the file sizes. The naming scheme is that if something doesn't have a number postfix, then it's for the "big" model.

Just for the record, as this causes some ongoing confusion, I now renamed this file to expression_blendshapes_29587.bin, so all the files now always contain the respective model resolution in their filename.