Package Details: vapoursynth-plugin-waifu2x-caffe-git r13.1.g102e7f2-1

Git Clone URL: https://aur.archlinux.org/vapoursynth-plugin-waifu2x-caffe-git.git (read-only)
Package Base: vapoursynth-plugin-waifu2x-caffe-git
Description: Plugin for Vapoursynth: waifu2x-caffe (NVIDIA users only)(static libcaffe)(GIT version)
Upstream URL: https://forum.doom9.org/showthread.php?t=173673
Keywords: vapoursynth
Licenses: MIT
Conflicts: vapoursynth-plugin-waifu2x-caffe
Provides: vapoursynth-plugin-waifu2x-caffe
Submitter: sl1pkn07
Maintainer: sl1pkn07
Last Packager: sl1pkn07
Votes: 2
Popularity: 0.003213
First Submitted: 2017-06-14 15:01
Last Updated: 2019-06-30 14:00

Latest Comments

1 2 Next › Last »

sl1pkn07 commented on 2019-03-16 19:10

try now

nicholascw commented on 2019-03-15 23:21

Same here with error: layer_factory.cpp:65] Check failed: registry.count(type) == 1 (0 vs. 1) Unknown layer type: Input (known types: Convolution, Deconvolution, Eltwise, LRN, Pooling, Power, ReLU, Sigmoid, Softmax, Split, TanH)

fitu996 commented on 2019-02-13 03:51

And, meson in makedeps is missing?

fitu996 commented on 2019-02-13 02:09

It can build, but can not run.

import vapoursynth as vs
import mvsfunc as mvf
core = vs.get_core()

source = 'source.mkv'
core.caffe.Waifu2x(mvf.ToRGB(core.ffms2.Source(source),depth=32),noise=3,scale=1,model=6).set_output()

Test it with vsedit, it will crash.

sl1pkn07 commented on 2019-01-26 12:58

arch-meson is only a wrapper. that add a some flags in the command line

+ exec meson setup --prefix /usr --libdir /usr/lib --libexecdir /usr/lib --bindir /usr/bin --sbindir /usr/bin --includedir /usr/include --datadir /usr/share --mandir /usr/share/man --infodir /usr/share/info --localedir /usr/share/locale --sysconfdir /etc --localstatedir /var --sharedstatedir /var/lib --buildtype release --auto-features enabled --wrap-mode nofallback -D b_lto=true -D b_pie=true build -Dcuda_includedir=/opt/cuda/include -Dcuda_libdir=/opt/cuda/lib64 -Dcaffe_includedir=/tmp/makepkg/vapoursynth-plugin-waifu2x-caffe-git/src/fakeroot/include -Dcaffe_libdir=/tmp/makepkg/vapoursynth-plugin-waifu2x-caffe-git/src/waifu2x-caffe

this build ok fro me

please paste the example you use

fitu996 commented on 2019-01-26 07:27

When using this plugin with vspipe, it will crash:

F0126 07:04:22.029536 29219 layer_factory.cpp:65] Check failed: registry.count(type) == 1 (0 vs. 1) Unknown layer type: Input (known types: Convolution, Deconvolution, Eltwise, LRN, Pooling, Power, ReLU, Sigmoid, Softmax, Split, TanH)
*** Check failure stack trace: ***
    @     0x629722b51c9d  google::LogMessage::Fail()
    @     0x629722b56720  google::LogMessage::SendToLog()
    @     0x629722b5199d  google::LogMessage::Flush()
    @     0x629722b5219a  google::LogMessageFatal::~LogMessageFatal()
    @     0x6297414ce059  caffe::LayerRegistry<>::CreateLayer()
    @     0x6297414c5c4e  caffe::Net<>::Init()
    @     0x6297414c7dcf  caffe::Net<>::Net()
    @     0x629741452825  (unknown)
    @     0x629741442815  (unknown)
    @     0x629741443b86  (unknown)
    @     0x629752e2d016  (unknown)
    @     0x629752e1e518  (unknown)
    @     0x629752f14b75  (unknown)
    @     0x6297582c363c  _PyObject_FastCallKeywords
    @     0x62975830f186  _PyEval_EvalFrameDefault
    @     0x629758250b99  _PyEval_EvalCodeWithName
    @     0x629758251ab4  PyEval_EvalCodeEx
    @     0x629758251adc  PyEval_EvalCode
    @     0x629752f098e2  vpy_evaluateScript
    @     0x6297585f590b  vsscript_evaluateScript
    @      0xb82be0442d0  (unknown)
    @      0xb82be0a31c4  (unknown)
    @      0xb82be0aaf86  (unknown)
    @     0x62976051f28c  QMetaObject::activate()
    @     0x629761066643  QAction::triggered()
    @     0x629761068d2a  QAction::activate()
    @     0x6297611e28fd  (unknown)
    @     0x6297611ea0e2  (unknown)
    @     0x6297611eb10c  QMenu::mouseReleaseEvent()
    @     0x6297610ad9d8  QWidget::event()
    @     0x6297611ed7bc  QMenu::event()
    @     0x62976106ce34  QApplicationPrivate::notify_helper()
[1]    29219 abort (core dumped)

Change arch-meson to meson, the problem disappeared.

fitu996 commented on 2019-01-26 07:21

I don't know why but using arch-meson breaks my fix for unknown layer. Use meson everything works as expected.

And you forget to add meson to makedepends.

sl1pkn07 commented on 2019-01-26 01:12

done

fitu996 commented on 2019-01-22 05:20

Latest commit break the PKGBUILD here's the new one:

# Maintainer:  Gustavo Alvarez <sl1pkn07@gmail.com>

_plug=waifu2x-caffe
pkgname=vapoursynth-plugin-${_plug}-git
pkgver=r12.3.g157c799
pkgrel=1
pkgdesc="Plugin for Vapoursynth: ${_plug} (NVIDIA users only)(static libcaffe)(GIT version)"
arch=('x86_64')
url='http://forum.doom9.org/showthread.php?t=172390'
license=('MIT')
depends=('vapoursynth'
         'boost-libs'
         'libopenblas'
         'google-glog'
         'gflags'
         'hdf5'
         'protobuf'
         'cudnn'
         'opencv'
         )
makedepends=('git'
             'boost'
             'gcc7'
             'meson'
             'ninja'
             'chrpath'
             )
provides=("vapoursynth-plugin-${_plug}")
conflicts=("vapoursynth-plugin-${_plug}")
source=("${_plug}::git+https://github.com/HomeOfVapourSynthEvolution/VapourSynth-Waifu2x-caffe.git"
        'git+https://github.com/HolyWu/caffe.git#branch=lltcggie/custom'
        )
sha256sums=('SKIP'
            'SKIP'
            )

pkgver() {
  cd "${_plug}"
  echo "$(git describe --long --tags | tr - .)"
}

prepare() {
  mkdir -p fakeroot

  # CUDA 10 requires gcc7
  sed -e '/CUSTOM_CXX/s/^# //' \
      -e '/CUSTOM_CXX/s/$/-7/' \
      -i caffe/Makefile.config

  # set CUDA directory
  sed '/CUDA_DIR/s/\/usr\/local\/cuda/\/opt\/cuda/' -i caffe/Makefile.config

  # disable python
  sed -e '/PYTHON_INCLUDE/s/^P/# P/g' \
      -e '/PYTHON_LIB/s/^P/# P/g' \
      -i caffe/Makefile.config

  # set OpenBlas
  sed -e '/\/blas/s/^# //g' \
      -e '/^BLAS_INCLUDE/s/\/path\/to\/your\/blas/\$(shell pkg-config --cflags openblas)/g' \
      -e '/^BLAS_LIB/s/\/path\/to\/your\/blas/\$(shell pkg-config --libs-only-L openblas)/g' \
      -i caffe/Makefile.config

  # -- local
  sed -e 's| /usr/local/include||g' \
      -e 's| /usr/local/lib||g' \
      -i caffe/Makefile.config

  # use pkgconfig
  sed "s|+= openblas|+= \$(shell pkg-config --libs openblas \| sed 's\|-l\|\|g')|g" \
      -i caffe/Makefile

  cd "${srcdir}/${_plug}"
  # Set caffe include path
  #sed "s|include_directories(get_option('caffe_includedir'))|include_directories('${srcdir}/fakeroot/include')|g" -i meson.build
  # Set caffe library path
  #sed "s|cc.find_library('caffe', dirs : get_option('caffe_libdir'))|cc.find_library('caffe', dirs: '$(pwd)')|g" -i meson.build
  # Fix opencv4
  sed -e 's/CV_GRAY2RGB/cv::COLOR_GRAY2RGB/g' \
      -e 's/CV_RGB2GRAY/cv::COLOR_RGB2GRAY/g' \
      -e 's/CV_BGR2YUV/cv::COLOR_BGR2YUV/g' \
      -e 's/CV_YUV2BGR/cv::COLOR_YUV2BGR/g' \
      -e 's/CV_BGR2RGB/cv::COLOR_BGR2RGB/g' \
      -e 's/CV_BGRA2RGBA/cv::COLOR_BGRA2RGBA/g' \
      -e 's/CV_BGR2RGBA/cv::COLOR_BGR2RGBA/g' \
      -e 's/CV_BGRA2RGB/cv::COLOR_BGRA2RGB/g' \
      -i Waifu2x-caffe/stImage.cpp Waifu2x-caffe/waifu2x.cpp
  # Fix unknown layer
  echo '#include "caffe/common.hpp"
#include "caffe/layers/input_layer.hpp"
#include "caffe/layers/flatten_layer.hpp"
#include "caffe/layers/scale_layer.hpp"
#include "caffe/layers/crop_layer.hpp"
namespace caffe{
    extern INSTANTIATE_CLASS(InputLayer);
    extern INSTANTIATE_CLASS(FlattenLayer);
    extern INSTANTIATE_CLASS(ScaleLayer);
    extern INSTANTIATE_CLASS(CropLayer);
    //REGISTER_LAYER_CLASS(Scale);
}' > Waifu2x-caffe/addlayer.h
  sed '1i#include "addlayer.h"' -i Waifu2x-caffe/cNet.cpp Waifu2x-caffe/waifu2x.cpp Waifu2x-caffe/Waifu2x-caffe.cpp
  #cd waifu2x-caffe

  # use pkgconfig
  #sed -e 's|-lopenblas|$(shell pkg-config --libs openblas)|g' \
  #    -i Makefile.am

  # link static libcaffe
  #sed 's|-lcaffe|libcaffe.a|g' \
  #    -i Makefile.am

  #./autogen.sh
}

build() {
  cd caffe
  make lib

  install -Dm644 build/lib/libcaffe.a "${srcdir}/waifu2x-caffe/libcaffe.a"
  cp -R include "${srcdir}/fakeroot"
  install -Dm644 build/src/caffe/proto/caffe.pb.h "${srcdir}/fakeroot/include/caffe/proto/caffe.pb.h"

  cd "${srcdir}/${_plug}"
  #CXXFLAGS+=" -I${srcdir}/fakeroot/include" \
  CXXFLAGS+=" -I/usr/include/$(pacman -Qlq opencv | grep -i '^/usr/include.*/$' | cut -d '/' -f 4 | sort | uniq | xargs)" \
    meson build -Dcuda_includedir=/opt/cuda/include -Dcuda_libdir=/opt/cuda/lib64 \
    "-Dcaffe_includedir=$(readlink -e "${srcdir}/fakeroot/include")" \
    "-Dcaffe_libdir=$(pwd)"
  ninja -C build
#  ./configure \
#    --prefix=/usr \
#    --libdir=/usr/lib/vapoursynth

#  make
}

package(){
  cd "${_plug}"
  #make DESTDIR="${pkgdir}" install
  chrpath -d "build/lib${_plug}.so"
  DESTDIR="${pkgdir}" ninja -C build install

  (cd Waifu2x-caffe/models; for i in $(find . -type f); do install -Dm644 "${i}" "${pkgdir}/usr/lib/vapoursynth/models/${i}"; done)
  chmod -R a+w "${pkgdir}/usr/lib/vapoursynth/models"

  install -Dm644 README.md "${pkgdir}/usr/share/doc/vapoursynth/plugins/${_plug}/README.md"
  install -Dm644 LICENSE "${pkgdir}/usr/share/licenses/${pkgname}/LICENSE"
}

fitu996 commented on 2019-01-21 11:47

This is a simple fix for meson build and opencv4. It works for me.

# Maintainer:  Gustavo Alvarez <sl1pkn07@gmail.com>

_plug=waifu2x-caffe
pkgname=vapoursynth-plugin-${_plug}-git
pkgver=r12.1.g56c45a5
pkgrel=1
pkgdesc="Plugin for Vapoursynth: ${_plug} (NVIDIA users only)(static libcaffe)(GIT version)"
arch=('x86_64')
url='http://forum.doom9.org/showthread.php?t=172390'
license=('MIT')
depends=('vapoursynth'
         'boost-libs'
         'libopenblas'
         'google-glog'
         'gflags'
         'hdf5'
         'protobuf'
         'cudnn'
         'opencv'
         )
makedepends=('git'
             'boost'
             'gcc7'
             'meson'
             'ninja'
             'chrpath'
             )
provides=("vapoursynth-plugin-${_plug}")
conflicts=("vapoursynth-plugin-${_plug}")
source=("${_plug}::git+https://github.com/HomeOfVapourSynthEvolution/VapourSynth-Waifu2x-caffe.git"
        'git+https://github.com/HolyWu/caffe.git#branch=lltcggie/custom'
        )
sha256sums=('SKIP'
            'SKIP'
            )

pkgver() {
  cd "${_plug}"
  echo "$(git describe --long --tags | tr - .)"
}

prepare() {
  mkdir -p fakeroot

  # CUDA 10 requires gcc7
  sed -e '/CUSTOM_CXX/s/^# //' \
      -e '/CUSTOM_CXX/s/$/-7/' \
      -i caffe/Makefile.config

  # set CUDA directory
  sed '/CUDA_DIR/s/\/usr\/local\/cuda/\/opt\/cuda/' -i caffe/Makefile.config

  # disable python
  sed -e '/PYTHON_INCLUDE/s/^P/# P/g' \
      -e '/PYTHON_LIB/s/^P/# P/g' \
      -i caffe/Makefile.config

  # set OpenBlas
  sed -e '/\/blas/s/^# //g' \
      -e '/^BLAS_INCLUDE/s/\/path\/to\/your\/blas/\$(shell pkg-config --cflags openblas)/g' \
      -e '/^BLAS_LIB/s/\/path\/to\/your\/blas/\$(shell pkg-config --libs-only-L openblas)/g' \
      -i caffe/Makefile.config

  # -- local
  sed -e 's| /usr/local/include||g' \
      -e 's| /usr/local/lib||g' \
      -i caffe/Makefile.config

  # use pkgconfig
  sed "s|+= openblas|+= \$(shell pkg-config --libs openblas \| sed 's\|-l\|\|g')|g" \
      -i caffe/Makefile

  cd "${srcdir}/${_plug}"
  # Set caffe library path
  sed "s|cc.find_library('caffe')|cc.find_library('caffe', dirs: '$(pwd)')|g" -i meson.build
  # Fix opencv4
  sed -e 's/CV_GRAY2RGB/cv::COLOR_GRAY2RGB/g' \
      -e 's/CV_RGB2GRAY/cv::COLOR_RGB2GRAY/g' \
      -e 's/CV_BGR2YUV/cv::COLOR_BGR2YUV/g' \
      -e 's/CV_YUV2BGR/cv::COLOR_YUV2BGR/g' \
      -e 's/CV_BGR2RGB/cv::COLOR_BGR2RGB/g' \
      -e 's/CV_BGRA2RGBA/cv::COLOR_BGRA2RGBA/g' \
      -e 's/CV_BGR2RGBA/cv::COLOR_BGR2RGBA/g' \
      -e 's/CV_BGRA2RGB/cv::COLOR_BGRA2RGB/g' \
      -i Waifu2x-caffe/stImage.cpp Waifu2x-caffe/waifu2x.cpp
  # Fix unknown layer
  echo '#include "caffe/common.hpp"
#include "caffe/layers/input_layer.hpp"
#include "caffe/layers/flatten_layer.hpp"
#include "caffe/layers/scale_layer.hpp"
#include "caffe/layers/crop_layer.hpp"
namespace caffe{
    extern INSTANTIATE_CLASS(InputLayer);
    extern INSTANTIATE_CLASS(FlattenLayer);
    extern INSTANTIATE_CLASS(ScaleLayer);
    extern INSTANTIATE_CLASS(CropLayer);
    //REGISTER_LAYER_CLASS(Scale);
}' > Waifu2x-caffe/addlayer.h
  sed '1i#include "addlayer.h"' -i Waifu2x-caffe/cNet.cpp Waifu2x-caffe/waifu2x.cpp Waifu2x-caffe/Waifu2x-caffe.cpp
  #cd waifu2x-caffe

  # use pkgconfig
  #sed -e 's|-lopenblas|$(shell pkg-config --libs openblas)|g' \
  #    -i Makefile.am

  # link static libcaffe
  #sed 's|-lcaffe|libcaffe.a|g' \
  #    -i Makefile.am

  #./autogen.sh
}

build() {
  cd caffe
  make lib

  install -Dm644 build/lib/libcaffe.a "${srcdir}/waifu2x-caffe/libcaffe.a"
  cp -R include "${srcdir}/fakeroot"
  install -Dm644 build/src/caffe/proto/caffe.pb.h "${srcdir}/fakeroot/include/caffe/proto/caffe.pb.h"

  cd "${srcdir}/${_plug}"
  CXXFLAGS+=" -I${srcdir}/fakeroot/include" \
    meson build -Dcuda_includedir=/opt/cuda/include -Dcuda_libdir=/opt/cuda/lib64
  ninja -C build
#  ./configure \
#    --prefix=/usr \
#    --libdir=/usr/lib/vapoursynth

#  make
}

package(){
  cd "${_plug}"
  #make DESTDIR="${pkgdir}" install
  chrpath -d "build/lib${_plug}.so"
  install -Dm755 "build/lib${_plug}.so" "${pkgdir}/usr/lib/vapoursynth/lib${_plug}.so"

  (cd Waifu2x-caffe/models; for i in $(find . -type f); do install -Dm644 "${i}" "${pkgdir}/usr/lib/vapoursynth/models/${i}"; done)
  chmod -R a+w "${pkgdir}/usr/lib/vapoursynth/models"

  install -Dm644 README.md "${pkgdir}/usr/share/doc/vapoursynth/plugins/${_plug}/README.md"
  install -Dm644 LICENSE "${pkgdir}/usr/share/licenses/${pkgname}/LICENSE"
}