如何在 Bionic Beaver 18.04 LTS 中安裝具有人臉偵測功能的 Shotwell

如何在 Bionic Beaver 18.04 LTS 中安裝具有人臉偵測功能的 Shotwell

我正在從 Google Photos 過渡,我真的很喜歡 Shotwell 的功能。然而,臉部偵測/辨識對我來說非常重要,因為我管理照片的方式。我查看了這篇博文這顯然顯示瞭如何做到這一點,但在我看來,這是非常模糊的,因為我不完全是這個領域的專家。我嘗試這樣做meson build,但有大量的依賴項是我手動安裝的(也許不應該這樣做?),其中一個弄亂了我的apt 系統(我透過刪除軟體應用程式中的所有其他軟體來解決這個問題,然後進行 dist-upgrade 刪除不必要的套件和依賴項)。

有更多的逐步指南來執行此操作嗎?我真的很喜歡肖特韋爾,但我必須具有面部檢測功能(我知道它處於測試階段,但我看到了一個視頻證明它有效)。

(我知道我可以使用 digiKam,但我真的就像肖特韋爾一樣!

答案1

您可以執行以下操作:

# Downloads will be our workspace
cd ~/Downloads

# prepare the terrain by removing unwanted divs
sudo apt remove shotwell gir1.2-gexiv2-0.11 -y
# install dependencies (takes about 30 mins to complete)
sudo apt install unzip meson valac libgphoto2-dev libgudev-1.0-dev \
libgee-0.8 libgtk-3-dev gir1.2-gexiv2-0.10 libgexiv2-2 libwebkit2gtk-4.0 \
libgstreamer1.0-0 libgstreamer-plugins-base1.0-dev libgstreamer1.0-dev \
gstreamer1.0-plugins-base gstreamer1.0-plugins-good gstreamer1.0-plugins-bad \
gstreamer1.0-plugins-ugly gstreamer1.0-libav gstreamer1.0-doc \
gstreamer1.0-x gstreamer1.0-alsa gstreamer1.0-gl gstreamer1.0-gtk3 \
gstreamer1.0-qt5 gstreamer1.0-pulseaudio libraw-dev build-essential \
build-essential checkinstall cmake pkg-config yasm gfortran gstreamer1.0-tools \
libjpeg8-dev libpng-dev software-properties-common libjasper1 libtiff-dev \
libavcodec-dev libavformat-dev libswscale-dev libdc1394-22-dev libxine2-dev \
libv4l-dev libgstreamer1.0-dev libgstreamer-plugins-base1.0-dev libgtk2.0-dev \
libtbb-dev qt5-default libatlas-base-dev libfaac-dev libmp3lame-dev libtheora-dev \
libvorbis-dev libxvidcore-dev libopencore-amrnb-dev libopencore-amrwb-dev \
libavresample-dev x264 v4l-utils libprotobuf-dev protobuf-compiler \
libgoogle-glog-dev libgflags-dev libgphoto2-dev libeigen3-dev libhdf5-dev \
doxygen python3-dev python3-pip \
-y
# install one package via pip
sudo -H pip3 install -U pip numpy
# continue install now that pip deps are met
sudo apt -y install python3-testresources

# python virtualenv creation
cd
python3 -m venv opencv-4.1.0-py3
source ~/opencv-4.1.0-py3/bin/activate
# now install python libraries within this virtual environment
pip install wheel numpy scipy matplotlib scikit-image scikit-learn ipython dlib
# quit virtual environment
deactivate

# some post install
cd /usr/include/linux
sudo ln -s -f ../libv4l1-videodev.h videodev.h
cd ~/Downloads

# fulfill opencv 4.1 dependency by building from source
# this won't work yet, working off of :
# https://www.learnopencv.com/install-opencv-4-on-ubuntu-18-04/
sudo apt build-dep opencv
cd ~/Downloads
wget -O opencv-4.1.0.zip https://github.com/opencv/opencv/archive/4.1.0.zip
unzip -q opencv-4.1.0.zip
cd opencv-4.1.0/build
cmake -D CMAKE_BUILD_TYPE=RELEASE \
-D CMAKE_INSTALL_PREFIX=/usr/local \
-D INSTALL_C_EXAMPLES=ON \
-D INSTALL_PYTHON_EXAMPLES=ON \
-D WITH_TBB=ON \
-D WITH_V4L=ON \
-D OPENCV_PYTHON3_INSTALL_PATH=~/opencv-4.1.0-py3/lib/python3.5/site-packages \
-D WITH_QT=ON \
-D WITH_OPENGL=ON \
-D OPENCV_EXTRA_MODULES_PATH=../../opencv_contrib/modules \
-D BUILD_EXAMPLES=ON ..
make -j4
make install
cd build
cmake ..
cmake --build . --config Release
# still need to move built binary to usable space and declare it system-wide

# No idea how to do DNN models
# !!!

# fulfill exiv2 0.27 dependency by building from source
sudo apt build-dep exiv2
cd ~/Downloads
wget https://www.exiv2.org/builds/exiv2-0.27.1-Source.tar.gz
tar xf exiv2-0.27.1-Source.tar.gz
cd exiv2-0.27.1-Source/
cmake .
make
sudo make install

# fulfill libgexiv2-dev 0.12 dependency by building from source
sudo apt build-dep libgexiv2-dev
cd ~/Downloads
wget http://ftp.gnome.org/pub/GNOME/sources/gexiv2/0.12/gexiv2-0.12.0.tar.xz
tar xf gexiv2-0.12.0.tar.xz
cd gexiv2-0.12.0/
meson build
cd build
sudo meson install

# final build of shotwell with face detection
sudo apt build-dep shotwell
cd ~/Downloads
wget https://gitlab.gnome.org/nma83/shotwell/
\-/archive/wip/faces/shotwell-wip-faces.tar.gz
tar xzf shotwell-wip-faces.tar.gz
cd shotwell-wip-faces
meson configure -Dface-detection=true
meson build
cd build
sudo meson install

注意:我的帖子尚未完成,編輯將被接受。

更新:我失去了希望,我不知道如何安裝 opencv 以及如何從 OpenFace 取得提到的 DNN 模型。

答案2

這更多的是一種解決方法,但它透過安裝 Shotwell 的 Unstable flatpak,可以透過幾個簡單的步驟讓臉部功能發揮作用(我知道,因為我現在很高興使用它!)。

腳步:

  1. 安裝 Flathub
  2. 前往官方肖特韋爾建造安裝
  3. 點選顯示“安裝不穩定”的按鈕
  4. 複製目前頁面的 URL(連結)(點擊按鈕後)。截至撰寫本文時,連結為:“https://gitlab.gnome.org/GNOME/shotwell/raw/master/flatpak/org.gnome.Shotwell.unstable.flatpakref
  5. 啟動你的終端並運行flatpak install https://gitlab.gnome.org/GNOME/shotwell/raw/master/flatpak/org.gnome.Shotwell.unstable.flatpakref(你可能需要 sudo 管理員權限 - 我顯然不必輸入我的 sudo 密碼 - 你需要透過輸入接受安裝提示y
  6. 等待... (耐心是一種美德:-))
  7. 點擊“顯示應用程式”按鈕,然後點擊“(不穩定)Shotwell”
  8. 瞧!導入一些圖像,選擇單個圖像,並享受成功的榮耀 - 底部欄中新的“面孔”選項(注意:當我安裝不穩定版本時,它刪除了穩定版本,所以現在我只有不穩定的 Shotwell -但至少有臉部偵測耶! !

注意:當然,由於此功能仍然是一個WIP,Shotwell 可能會認為你的窗簾是一張臉(或者就此而言,你的門),並且沒有明顯的選項來掃描你的照片庫並自動標記臉部,但是嘿- 至少它在那裡!

相關內容