Skip to content

Commit

Permalink
ci (Fedora): Add 68-point face landmark model
Browse files Browse the repository at this point in the history
  • Loading branch information
norihiro committed Jun 8, 2024
1 parent f812778 commit 08ff5be
Show file tree
Hide file tree
Showing 3 changed files with 48 additions and 2 deletions.
2 changes: 1 addition & 1 deletion .github/containers/fedora-common/build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ sed \
< ci/plugin.spec \
> $rpmbuild/SPECS/$PLUGIN_NAME_FEDORA.spec

DESTDIR='dlib-models-data/' ci/download-dlib-models.sh
DESTDIR='dlib-models-data/' ci/download-dlib-models.sh --nonfree

git archive --format=tar --prefix=$PLUGIN_NAME_FEDORA-$VERSION/ HEAD | bzip2 > $rpmbuild/SOURCES/$PLUGIN_NAME_FEDORA-$VERSION.tar.bz2
(cd libvisca && git archive --format=tar --prefix=libvisca/ HEAD) | bzip2 > $rpmbuild/SOURCES/$PLUGIN_NAME_FEDORA-$VERSION-libvisca.tar.bz2
Expand Down
19 changes: 19 additions & 0 deletions ci/download-dlib-models.sh
Original file line number Diff line number Diff line change
@@ -1,5 +1,18 @@
#! /bin/bash

flg_nonfree=0

while (($# > 0)); do
case "$1" in
--nonfree)
flg_nonfree=1
shift ;;
*)
echo "Error: unknown option $1" >&2
exit 1;;
esac
done

mkdir -p ${DESTDIR}data

mkdir ${DESTDIR}data/dlib_hog_model
Expand All @@ -11,3 +24,9 @@ bunzip2 < dlib-models/mmod_human_face_detector.dat.bz2 > ${DESTDIR}data/dlib_cnn
bunzip2 < dlib-models/shape_predictor_5_face_landmarks.dat.bz2 > ${DESTDIR}data/dlib_face_landmark_model/shape_predictor_5_face_landmarks.dat
cp dlib/LICENSE.txt ${DESTDIR}data/LICENSE-dlib
cp dlib-models/LICENSE ${DESTDIR}data/LICENSE-dlib-models

if ((flg_nonfree)); then
bunzip2 dlib-models/shape_predictor_68_face_landmarks.dat.bz2 > ${DESTDIR}data/dlib_face_landmark_model/shape_predictor_68_face_landmarks.dat
bunzip2 dlib-models/shape_predictor_68_face_landmarks_GTX.dat.bz2 > ${DESTDIR}data/dlib_face_landmark_model/shape_predictor_68_face_landmarks_GTX.dat
awk '/^##/{p=0} /^##.*shape_predictor_68/{p=1} p' dlib-models/README.md > ${DESTDIR}data/LICENSE-shape_predictor_68_face_landmarks
fi
29 changes: 28 additions & 1 deletion ci/plugin.spec
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,11 @@ BuildRequires: dlib-devel ffmpeg-free-devel sqlite-devel blas-devel lapack-devel
%package data
Summary: Model file for %{name}
BuildArch: noarch
License: CC0-1.0

%package data-nonfree
Summary: Non-free model file for %{name}
BuildArch: noarch
License: Nonfree

%description
Expand All @@ -29,6 +34,11 @@ under tracking, the frame will be cropped.

%description data
Model files for @PLUGIN_NAME_FEDORA@.
The model files came from https://github.com/davisking/dlib-models/.

%description data-nonfree
Non-free model files for @PLUGIN_NAME_FEDORA@.
The model file came from https://github.com/davisking/dlib-models/.

%prep
%autosetup -p1
Expand All @@ -46,9 +56,26 @@ Model files for @PLUGIN_NAME_FEDORA@.
%install
%{cmake_install}

mkdir -p %{buildroot}/%{_datadir}/licenses/%{name}/
mkdir -p %{buildroot}/%{_datadir}/licenses/%{name}-data/
mkdir -p %{buildroot}/%{_datadir}/licenses/%{name}-data-nonfree/
cp LICENSE %{buildroot}/%{_datadir}/licenses/%{name}/
mv %{buildroot}/%{_datadir}/obs/obs-plugins/@PLUGIN_NAME@/LICENSE-dlib %{buildroot}/%{_datadir}/licenses/%{name}/
mv %{buildroot}/%{_datadir}/obs/obs-plugins/@PLUGIN_NAME@/LICENSE-dlib-models %{buildroot}/%{_datadir}/licenses/%{name}-data/
mv %{buildroot}/%{_datadir}/obs/obs-plugins/@PLUGIN_NAME@/LICENSE-shape_predictor_68_face_landmark %{buildroot}/%{_datadir}/licenses/%{name}-data-nonfree/

%files
%{_libdir}/obs-plugins/@PLUGIN_NAME@.so
%{_datadir}/obs/obs-plugins/@PLUGIN_NAME@/locale/
%{_datadir}/licenses/%{name}/*

%files data
%{_datadir}/obs/obs-plugins/@PLUGIN_NAME@/*dlib*
%{_datadir}/obs/obs-plugins/@PLUGIN_NAME@/dlib_cnn_model
%{_datadir}/obs/obs-plugins/@PLUGIN_NAME@/dlib_face_landmark_model/shape_predictor_5_face_landmarks.dat
%{_datadir}/obs/obs-plugins/@PLUGIN_NAME@/dlib_hog_model
%{_datadir}/licenses/%{name}-data/*

%files data-nonfree
%{_datadir}/obs/obs-plugins/@PLUGIN_NAME@/dlib_face_landmark_model/shape_predictor_68_face_landmarks.dat
%{_datadir}/obs/obs-plugins/@PLUGIN_NAME@/dlib_face_landmark_model/shape_predictor_68_face_landmarks_GTX.dat
%{_datadir}/licenses/%{name}-data-nonfree/*

0 comments on commit 08ff5be

Please sign in to comment.