5

I'm transitioning from Google Photos and I really liked Shotwell's features. However, face detection/recognition is very important to me because of how I manage my photos. I viewed this blog post that apparently shows how to do it, but it's very vague IMO since I'm not exactly an expert in this area. I tried doing the meson build but there were a ton of dependencies that I manually installed (maybe wasn't supposed to do that?) and one of them messed up my apt system (I ended fixing that by removing all other software in the Software app and doing a dist-upgrade which removed unnecessary packages and dependencies).

Is there a more step-by-step guide to doing this? I really like Shotwell but I must have the face detection feature (I know that it is in beta, but I saw a video that proves it works).

(I know I could use digiKam but I really like Shotwell!)

Riyaad Azad
  • 160
  • 2
  • 16
  • 1
    he does say it is WIP. are you sure that's fine by you? – tatsu May 22 '19 at 15:02
  • Yes it's totally fine actually because it at least works. I saw a YouTube video yesterday but I forgot what it was called, but all I need is that basic functionality (it might not accurately detect faces but I'm willing to manually detect them). – Riyaad Azad May 22 '19 at 15:05

2 Answers2

3

Here's what you could do:

# 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

Note: my post is WIP and edits will be accepted.

Update: I'm losing hope, I can't figure out how to get an install of opencv and how to get the mentioned DNN models from OpenFace.

Riyaad Azad
  • 160
  • 2
  • 16
tatsu
  • 3,107
  • When I ran tar -xcp shotwell-wip-faces.tar.gz the output was tar: You may not specify more than one '-Acdtrux', '--delete' or '--test-label' option Try 'tar --help' or 'tar --usage' for more information. I ended up using the Archive Manager to extract the tar to my home folder. – Riyaad Azad May 22 '19 at 21:45
  • When I ran meson . builddir it started to do its thing but then this came up: `Native dependency gexiv2 found: NO found '0.10.8' but need: '>= 0.11.0'

    meson.build:52:0: ERROR: Invalid version of dependency, need 'gexiv2' ['>= 0.11.0'] found '0.10.8'.

    A full log can be found at /home/riyaad/shotwell-wip-faces/builddir/meson-logs/meson-log.txt` When I tried to do it myself yesterday (before asking here) the same thing popped up and I couldn't find a newer packaged version for Ubuntu - the latest is the Version 0.10: https://launchpad.net/ubuntu/+source/gexiv2

    – Riyaad Azad May 22 '19 at 21:48
  • ^^^And when I tried building gexiv2 from source (which, since I've never built from source before, might have raised some issues) it needed more (newer versions of) dependencies which Ubuntu 18 LTS Bionic Beaver didn't have. I ended up installing the wrong thing and that was what broke my apt system (which I ended up fixing). – Riyaad Azad May 22 '19 at 21:51
  • Could this help? https://www.learnopencv.com/install-opencv3-on-ubuntu/ (Since the face detection feature is apparently based on OpenCV?) – Riyaad Azad May 22 '19 at 22:35
  • When I run sudo apt remove shotwell gir1.2-gexiv2-0.11 -y the output is [sudo] password for riyaad: Reading package lists... Done Building dependency tree Reading state information... Done E: Unable to locate package gir1.2-gexiv2-0.11 E: Couldn't find any package by glob 'gir1.2-gexiv2-0.11' E: Couldn't find any package by regex 'gir1.2-gexiv2-0.11' – Riyaad Azad May 23 '19 at 12:43
  • 1
    you really should wait untill I finish this. I'll notify you when I am. right now I haven't figured out all the steps. – tatsu May 23 '19 at 13:02
  • Really sorry. I thought I was helping. Thank you for helping me! – Riyaad Azad May 23 '19 at 13:12
  • 2
    don't worry it's fine. and no problem. I'll get there. and once I do the whole thing might even fit inside a simple shell script. – tatsu May 23 '19 at 13:13
  • This might not be possible but could a workaround be integrating this CLI https://github.com/ageitgey/face_recognition/blob/master/README.md? It's not exactly built in but do you think that would work?? – Riyaad Azad May 23 '19 at 16:11
  • https://cmusatyalab.github.io/openface/setup/ Don't know if you saw this page about setting up OpenFace (DNN Models)? – Riyaad Azad May 23 '19 at 16:15
  • Uh oh - looks like it really is not possible: https://askubuntu.com/a/97168/898365 – Riyaad Azad May 23 '19 at 23:25
  • 1
    ^^^ https://gitlab.gnome.org/GNOME/shotwell/issues/95 :-( – Riyaad Azad May 23 '19 at 23:31
3

This is more of a workaround, but it is possible to get the faces feature working in a few simple steps by installing the Unstable flatpak of Shotwell (I know because I'm happily using it right now!).

Steps:

  1. Install Flathub
  2. Go to official Shotwell Building & Installing page
  3. Click the button that says "Install Unstable"
  4. Copy the URL (link) of the current page (after you click on the button). As of the time of writing, the link is: "https://gitlab.gnome.org/GNOME/shotwell/raw/master/flatpak/org.gnome.Shotwell.unstable.flatpakref"
  5. Fire up your terminal and run flatpak install https://gitlab.gnome.org/GNOME/shotwell/raw/master/flatpak/org.gnome.Shotwell.unstable.flatpakref (you may need sudo admin rights - I apparently did not have to enter my sudo password - and you'll need to accept the install prompt by typing y)
  6. Wait... (Patience is a virtue :-))
  7. Click on the Show Applications button and click on "(Unstable) Shotwell"
  8. Voila! Import some images, select a single image, and bask in the glory your success - a new "Faces" option in the bottom bar (Note: When I installed the unstable version, it removed the stable version so now I only have Unstable Shotwell - but at least there's face detection yay!!!)

Note: Of course, since this feature is still a WIP, Shotwell might think that your curtain is a face (or for that matter, your door), and there is no obvious options to scan your photo library and automatically tag faces, but hey - at least it's there!

Riyaad Azad
  • 160
  • 2
  • 16