媒體庫面部識別工具
用於建造Dlib和其他
sudo apt-get install build-essential cmake python3-pip
sudo apt-get install python3-opencv
使用CUDA的庫安裝並不容易,並且對於不同的OS版本可能會有所不同。 CUDA設置的一些有用鏈接
https://developer.nvidia.com/cuda-downloads
https://medium.com/@sb.jaduniv/how-to-install-opencv-4-2-0-with-cuda-10-1-1-1-on-ubuntu-20-04-lts-focal -focal-foscal-fossa-bdc034109df3
https://www.pyimagesearch.com/2019/12/09/how-to-now-to-install-tensorflow-2-0-on-on-ubuntu/
pip3 install deepface
安裝我的face_recognition克隆(有一些修改以支持外部匹配的面孔)
git clone https://github.com/sashacmc/face_recognition.git ; cd face_recognition ; pip3 install . ; cd ..
git clone https://github.com/sashacmc/face-rec-tools.git ; cd face-rec-tools ; pip3 install . ; cd ..
使用預定義的配置文件中的一個或準備自己的配置文件。
預定義的配置文件位於Package的CFG文件夾(例如〜/.local/lib/python3.6/site-packages/face_rec_tools/cfg/)
將其複製到默認配置位置(〜/.face-rec.cfg)或使用命令行開關“ -c”指定
cp ~ /.local/lib/python3. ? /site-packages/face_rec_tools/cfg/frontal.cfg ~ /.face-rec.cfg
# recognize single image and print output (useful for debug)
face-rec-cli -a recognize_image -i imagefile.jpg
# recognize single video and print summary output (useful for debug)
face-rec-cli -a recognize_video -i videofile.mp4
# recognize folder and store the result in the database
face-rec-cli -a recognize_folder -i /folder/with/images
# remove folder recognition the result from the database
face-rec-cli -a remove_folder -i /folder/with/images
# match/rematch unmatched faces in database
face-rec-cli -a match_unmatched
# match/rematch all faces in database
face-rec-cli -a match_all
# match/rematch faces from folder in database
face-rec-cli -a match_folder -i /folder/with/images
# save faces from folder (must be previously recognized)
# cachedb must be disabled (otherwise they will saved inside cachedb)
face-rec-cli -a save_faces -i /folder/with/images -o /folder/for/faces
# find face from image in database and save them in folder
# cachedb must be disabled (otherwise they will saved inside cachedb)
face-rec-cli -a get_faces_by_face -i image_with_one_face.jpg -o /folder/for/faces
從命令行運行服務器
face-rec-server
使用主機名/ip_adress和端口8081打開瀏覽器
要識別新文件夾,單擊“識別” - >“添加新文件...”。並指定要識別的文件夾。
由於加載必要的模型,首次識別將需要一段時間。
首次識別後,您將使所有面孔都視為未知。
單擊面對面(或選擇幾個使用Shift/Ctrl)將其添加為模式。
以前添加的名稱將被保存,您無需再次輸入它。如果要更改默認的face徽標,則可以為每個人子文件夾添加為0_face.jpg。
添加模式後,再次開始匹配(例如“匹配” - >“ rembatch文件夾...”)
與模式匹配後,您將擁有匹配的人和“弱”匹配的人,這意味著它不完全匹配,也不會用於同步或搜索。您需要檢查它們並添加到圖案中。
如果您需要一些有關面部的其他信息,則可以單擊圖標查看源文件或查看與之匹配的模式。
如果您有大量的面孔,則可以通過菜單聚類中的平均聚類來簡化模式分開,它將在面孔附近與組分開,並允許將其添加到模式中。
面部識別工具允許通過標籤與Plex Media Server同步識別結果。識別文件將標記為“人:[person_name]”的標籤
# set all tags to the Plex database
face-rec-plexsync -a set_tags
# clear all tags from the Plex database
face-rec-plexsync -a remove_tags
# recognize all files which present in the Plex database
# but not recognized yet and store the result in the database
face-rec-plexsync -a sync_new
# delete from database all files which not present in the Plex database
face-rec-plexsync -a sync_deleted
如果您沒有plex,或者想使用一些更複雜的搜索,則可以使用colless command
(它將在2020年文件夾中搜索所有文件,其中包含人名稱和名稱2的面孔)
face-rec-db -a find_files_by_names -f 2020 -n Name1,Name2
感謝所有經過測試並提供建議的人。
歡迎錯誤報告,建議和拉動請求!