johnwmillr / facer Goto Github PK
View Code? Open in Web Editor NEWSimple (๐ค) face averaging (๐) in Python (๐)
License: MIT License
Simple (๐ค) face averaging (๐) in Python (๐)
License: MIT License
Currently, the path where the pre-trained model is hardcoded and prevents usage of the library as a module without tweaking. It might be nice if there is a way to set this programmatically (e.g. via a config that the module loads).
Hi, Just trying your example code and I get :
Starting face averaging for 10 faces.
Image 1 / 10
Traceback (most recent call last):
File "D:\Facer\facer.py", line 13, in <module>
average_face = facer.create_average_face(faces, landmarks, save_image=True)
File "D:\Facer\facer\facer.py", line 224, in create_average_face
dt = calculateDelaunayTriangles(rect, np.array(pointsAvg))
File "D:\Facer\facer\utils.py", line 62, in calculateDelaunayTriangles
subdiv.insert((p[0], p[1]))
cv2.error: OpenCV(4.8.0) D:\a\opencv-python\opencv-python\opencv\modules\imgproc\src\subdivision2d.cpp:288: error: (-211:One of the arguments' values is out of range) in function 'cv::Subdiv2D::locate'
Anyone with ideas about this one?
pip install -r requirements.txt
error: Command "clang -Wno-unused-result -Wsign-compare -Wunreachable-code -fno-common -dynamic -DNDEBUG -g -fwrapv -O3 -Wall -arch arm64 -arch x86_64 -g -DNPY_INTERNAL_BUILD=1 -DHAVE_NPY_CONFIG_H=1 -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE=1 -D_LARGEFILE64_SOURCE=1 -DNO_ATLAS_INFO=3 -DHAVE_CBLAS -Ibuild/src.macosx-10.9-universal2-3.1/numpy/core/src/umath -Ibuild/src.macosx-10.9-universal2-3.1/numpy/core/src/npymath -Ibuild/src.macosx-10.9-universal2-3.1/numpy/core/src/common -Inumpy/core/include -Ibuild/src.macosx-10.9-universal2-3.1/numpy/core/include/numpy -Inumpy/core/src/common -Inumpy/core/src -Inumpy/core -Inumpy/core/src/npymath -Inumpy/core/src/multiarray -Inumpy/core/src/umath -Inumpy/core/src/npysort -I/Library/Frameworks/Python.framework/Versions/3.10/include/python3.10 -Ibuild/src.macosx-10.9-universal2-3.1/numpy/core/src/common -Ibuild/src.macosx-10.9-universal2-3.1/numpy/core/src/npymath -Ibuild/src.macosx-10.9-universal2-3.1/numpy/core/src/common -Ibuild/src.macosx-10.9-universal2-3.1/numpy/core/src/npymath -c numpy/core/src/multiarray/buffer.c -o build/temp.macosx-10.9-universal2-3.10/numpy/core/src/multiarray/buffer.o -MMD -MF build/temp.macosx-10.9-universal2-3.10/numpy/core/src/multiarray/buffer.o.d -faltivec -I/System/Library/Frameworks/vecLib.framework/Headers" failed with exit status 1
[end of output]
Thanks for this interesting project.
I am running your example on a directory of images. I get this error:
Loading face detector and landmark prediction models...
Done, models loaded.
Found 137 in '../faces'.
(1 / 137): ../faces/ffmpeg_1.jpg
(15 / 137): ../faces/ffmpeg_111.jpg
(29 / 137): ../faces/ffmpeg_125.jpg
(43 / 137): ../faces/ffmpeg_138.jpg
(57 / 137): ../faces/ffmpeg_25.jpg
(71 / 137): ../faces/ffmpeg_38.jpg
(85 / 137): ../faces/ffmpeg_50.jpg
(99 / 137): ../faces/ffmpeg_63.jpg
(113 / 137): ../faces/ffmpeg_77.jpg
(127 / 137): ../faces/ffmpeg_9.jpg
Starting face landmark detection...
Processing 137 images.
(1 / 137): ../faces/ffmpeg_1.jpg
(15 / 137): ../faces/ffmpeg_111.jpg
(29 / 137): ../faces/ffmpeg_125.jpg
(43 / 137): ../faces/ffmpeg_138.jpg
(57 / 137): ../faces/ffmpeg_25.jpg
(71 / 137): ../faces/ffmpeg_38.jpg
(85 / 137): ../faces/ffmpeg_50.jpg
(99 / 137): ../faces/ffmpeg_63.jpg
(113 / 137): ../faces/ffmpeg_77.jpg
(127 / 137): ../faces/ffmpeg_9.jpg
Skipped 1.5% of images.
Starting face averaging for 135 faces.
Image 1 / 135
Image 8 / 135
Image 15 / 135
Image 22 / 135
Image 29 / 135
Image 36 / 135
Image 43 / 135
Image 50 / 135
Image 57 / 135
Image 64 / 135
Image 71 / 135
Image 78 / 135
Image 85 / 135
Image 92 / 135
Image 99 / 135
Image 106 / 135
Image 113 / 135
Image 120 / 135
Traceback (most recent call last):
File "test.py", line 11, in <module>
average_face = facer.create_average_face(faces, landmarks, save_image=True)
File "/Users/asi/connor_asi/face_avg/Facer/facer/facer.py", line 221, in create_average_face
dt = calculateDelaunayTriangles(rect, np.array(pointsAvg))
File "/Users/asi/connor_asi/face_avg/Facer/facer/utils.py", line 62, in calculateDelaunayTriangles
subdiv.insert((p[0], p[1]))
cv2.error: OpenCV(4.5.3) /private/var/folders/24/8k48jl6d249_n_qfxwsl6xvm0000gn/T/pip-req-build-tetsazc6/opencv/modules/imgproc/src/subdivision2d.cpp:288: error: (-211:One of the arguments' values is out of range) in function 'locate'
I'm running OpenCV 4.5.3 if thats helpful.
Any ideas? Thank you!
Just wanted to give a heads up that the setup.py and installing as a modul does not work - at least not for me.
Could not make numpy 1.6.. Something with clang etc.
But installing latest version of numpy & matlibplot and just running it inside IDE worked fine.
Just changed the import from:
from facer.utils import similarityTransform, constrainPoint, calculateDelaunayTriangles, warpTriangle
to:
from utils import similarityTransform, constrainPoint, calculateDelaunayTriangles, warpTriangle
then I could just run the "create_average_face_from_directory()" function no problem
Thanks for the great work
/// W
Use your Make a GIF code from the Faces of Fortune project to add incremental animated GIF functionality to the package.
As title. Just curious.
Hello!
First off, thank you for this awesome work. I've been messing around with it for a couple days now. After some serious yak shaving, I got it working and the results are awesome. The speed leave a lot to be desired though. Especially when working with big data sets (takes me about 3hrs for an 1000 image average).
I tried loading it on a cuda enabled ami but not really getting better results there. I'm not asking for free work here, but since I don't have a CV or ML background myself, curious if you have any tips on how we can get parallel processing going here or otherwise what the bottlenecks are which can be worked on? I might do it or commission it.
Thanks!
J
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.