如何在 Bionic Beaver 18.04 LTS 中安装带人脸检测功能的 Shotwell

如何在 Bionic Beaver 18.04 LTS 中安装带人脸检测功能的 Shotwell

我正在从 Google Photos 过渡,我非常喜欢 Shotwell 的功能。但是,由于我管理照片的方式,人脸检测/识别对我来说非常重要。我查看了这篇博文这显然说明了如何操作,但在我看来,它非常模糊,因为我并不是这个领域的专家。我尝试这样做,meson build但有大量依赖项是我手动安装的(也许不应该这样做?),其中一个搞乱了我的 apt 系统(我最终通过删除软件应用程序中的所有其他软件并执行 dist-upgrade 删除了不必要的包和依赖项来解决这个问题)。

有没有更详细的步骤指南?我非常喜欢 Shotwell,但我必须具有人脸检测功能(我知道它处于测试阶段,但我看到了一个视频证明它有效)。

(我知道我可以使用 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 的不稳定 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 可能会认为您的窗帘是一张脸(或者就此而言,是您的门),并且没有明显的选项来扫描您的照片库并自动标记脸部,但是嘿 - 至少它在那里!

相关内容