diff options
author | marcs | 2023-06-17 15:10:41 +0200 |
---|---|---|
committer | marcs | 2023-06-17 15:11:44 +0200 |
commit | bb16a9f84285e8fed83e19cca6ec92aa76272c15 (patch) | |
tree | fffca5bad296784cf8ef37669d8b2a03b8172957 | |
parent | 854b0113a91877aaac63ef8b9eddf56ccbac8389 (diff) | |
download | aur-bb16a9f84285e8fed83e19cca6ec92aa76272c15.tar.gz |
updated dependencies: blas-openblas
-rw-r--r-- | .SRCINFO | 11 | ||||
-rw-r--r-- | PKGBUILD | 27 | ||||
-rw-r--r-- | caffe-1.0-opencv4-fix.patch | 116 |
3 files changed, 139 insertions, 15 deletions
@@ -1,12 +1,12 @@ pkgbase = caffe-cmake-git pkgdesc = A deep learning framework made with expression, speed, and modularity in mind. Uses cmake to build giving great flexibility. - pkgver = 1.0.r50.gc430690aa - pkgrel = 2 + pkgver = 1.0.r134.g04ab089db + pkgrel = 1 url = http://caffe.berkeleyvision.org/ arch = x86_64 license = BSD makedepends = git - makedepends = gcc6 + makedepends = gcc8 makedepends = doxygen makedepends = texlive-core makedepends = cmake @@ -37,7 +37,7 @@ pkgbase = caffe-cmake-git depends = python-yaml depends = python-pillow depends = python-six - depends = openblas-lapack + depends = blas-openblas depends = python-leveldb depends = python-scikit-image depends = python-pydotplus @@ -52,7 +52,8 @@ pkgbase = caffe-cmake-git conflicts = caffe2-cpu conflicts = caffe2-cpu-git source = caffe-cmake-git::git+https://github.com/BVLC/caffe.git + source = caffe-1.0-opencv4-fix.patch md5sums = SKIP + md5sums = 07001b22dd7f2133af0a4149bbcb96a5 pkgname = caffe-cmake-git - @@ -2,8 +2,8 @@ # # A thanks to Daniel Bermond for some inspiration (code) in the PKGBUILD pkgname=caffe-cmake-git -pkgver=1.0.r50.gc430690aa -pkgrel=2 +pkgver=1.0.r134.g04ab089db +pkgrel=1 epoch= pkgdesc="A deep learning framework made with expression, speed, and modularity in mind. Uses cmake to build giving great flexibility." arch=('x86_64') @@ -18,7 +18,7 @@ depends=( 'python-yaml' 'python-pillow' 'python-six' # AUR: # required: - 'openblas-lapack' + 'blas-openblas' # not required: # 'nccl' #python: @@ -27,12 +27,14 @@ depends=( # python-pydotplus (or python-pydot) is required by python executable draw_net.py # https://github.com/BVLC/caffe/blob/691febcb83d6a3147be8e9583c77aefaac9945f8/python/caffe/draw.py#L7-L22 ) -makedepends=('git' 'gcc6' 'doxygen' 'texlive-core' 'cmake') +makedepends=('git' 'gcc' 'doxygen' 'texlive-core' 'cmake') provides=('caffe') conflicts=('caffe' 'caffe-cpu' 'caffe-cpu-git' 'caffe-dr-git' 'caffe-mnc-dr-git' 'caffe2' 'caffe2-git' 'caffe2-cpu' 'caffe2-cpu-git') -source=("${pkgname}"::"git+https://github.com/BVLC/caffe.git") -md5sums=('SKIP') +source=("${pkgname}"::"git+https://github.com/BVLC/caffe.git" + "caffe-1.0-opencv4-fix.patch") +md5sums=('SKIP' + '07001b22dd7f2133af0a4149bbcb96a5') pkgver() { cd "$pkgname" @@ -47,11 +49,13 @@ prepare() { # give the user options as to how they will install # COMMENT if you do not wish to edit the configuration $EDITOR CMakeLists.txt + + patch -Np1 -i "${srcdir}/caffe-1.0-opencv4-fix.patch" } build() { cd "${srcdir}/$pkgname" - mkdir "build" + mkdir -p "build" cd build cmake -DBLAS=open .. ## UNCOMMENT if you wish to have a parallelized build. Race conditions may arise. @@ -75,9 +79,11 @@ package() { # move python files over cd "${srcdir}/$pkgname/build/install" mkdir -p usr - mkdir -p "${pkgdir}/usr/lib/python3.6/site-packages/" + mkdir -p "${pkgdir}/usr/lib/python3.8/site-packages/" + cd "${srcdir}/$pkgname/build/install/python" - mv caffe/ "${pkgdir}/usr/lib/python3.6/site-packages/" + mv caffe/ "${pkgdir}/usr/lib/python3.8/site-packages/" + mkdir -p "${pkgdir}/usr/share/Caffe/python/examples/" mv *.py "${pkgdir}/usr/share/Caffe/python/examples/" @@ -89,7 +95,8 @@ package() { cd "${srcdir}/$pkgname/build/install" mv share/ usr/ mv bin/ usr/ - mv lib64 usr/lib + mv lib usr/lib + mv include/ usr/ cp * -r "${pkgdir}" } diff --git a/caffe-1.0-opencv4-fix.patch b/caffe-1.0-opencv4-fix.patch new file mode 100644 index 000000000000..1aef32f2eabc --- /dev/null +++ b/caffe-1.0-opencv4-fix.patch @@ -0,0 +1,116 @@ +From 7f503bd9a19758a173064e299ab9d4cac65ed60f Mon Sep 17 00:00:00 2001 +From: Daniel Bermond <danielbermond@gmail.com> +Date: Mon, 26 Nov 2018 13:11:23 +0000 +Subject: [PATCH] Fix build with OpenCV 4.0 + +--- + Makefile | 16 ++++++++++++++-- + Makefile.config.example | 2 +- + src/caffe/layers/window_data_layer.cpp | 2 +- + src/caffe/test/test_io.cpp | 4 ++-- + src/caffe/util/io.cpp | 8 ++++---- + 5 files changed, 22 insertions(+), 10 deletions(-) + +diff --git a/Makefile b/Makefile +index b7660e852d6..95f3443adab 100644 +--- a/Makefile ++++ b/Makefile +@@ -200,9 +200,17 @@ endif + ifeq ($(USE_OPENCV), 1) + LIBRARIES += opencv_core opencv_highgui opencv_imgproc + +- ifeq ($(OPENCV_VERSION), 3) ++ ifeq ($(OPENCV_VERSION), $(filter $(OPENCV_VERSION), 3 4)) + LIBRARIES += opencv_imgcodecs + endif ++ ifeq ($(OPENCV_VERSION), 4) ++ ifeq ($(USE_PKG_CONFIG), 1) ++ INCLUDE_DIRS += $(shell pkg-config opencv4 --cflags-only-I | sed 's/-I//g') ++ else ++ INCLUDE_DIRS += /usr/include/opencv4 /usr/local/include/opencv4 ++ INCLUDE_DIRS += /usr/include/opencv4/opencv /usr/local/include/opencv4/opencv ++ endif ++ endif + + endif + PYTHON_LIBRARIES ?= boost_python python2.7 +@@ -429,7 +437,11 @@ LINKFLAGS += -pthread -fPIC $(COMMON_FLAGS) $(WARNINGS) + + USE_PKG_CONFIG ?= 0 + ifeq ($(USE_PKG_CONFIG), 1) +- PKG_CONFIG := $(shell pkg-config opencv --libs) ++ ifeq ($(OPENCV_VERSION), 4) ++ PKG_CONFIG := $(shell pkg-config opencv4 --libs) ++ else ++ PKG_CONFIG := $(shell pkg-config opencv --libs) ++ endif + else + PKG_CONFIG := + endif +diff --git a/Makefile.config.example b/Makefile.config.example +index 24ca632783a..24802e91534 100644 +--- a/Makefile.config.example ++++ b/Makefile.config.example +@@ -19,7 +19,7 @@ + # possibility of simultaneous read and write + # ALLOW_LMDB_NOLOCK := 1 + +-# Uncomment if you're using OpenCV 3 ++# Uncomment and set accordingly if you're using OpenCV 3/4 + # OPENCV_VERSION := 3 + + # To customize your choice of compiler, uncomment and set the following. +diff --git a/src/caffe/layers/window_data_layer.cpp b/src/caffe/layers/window_data_layer.cpp +index 1bf3760e9fd..f41169debe4 100644 +--- a/src/caffe/layers/window_data_layer.cpp ++++ b/src/caffe/layers/window_data_layer.cpp +@@ -290,7 +290,7 @@ void WindowDataLayer<Dtype>::load_batch(Batch<Dtype>* batch) { + image_database_cache_[window[WindowDataLayer<Dtype>::IMAGE_INDEX]]; + cv_img = DecodeDatumToCVMat(image_cached.second, true); + } else { +- cv_img = cv::imread(image.first, CV_LOAD_IMAGE_COLOR); ++ cv_img = cv::imread(image.first, cv::IMREAD_COLOR); + if (!cv_img.data) { + LOG(ERROR) << "Could not open or find file " << image.first; + return; +diff --git a/src/caffe/test/test_io.cpp b/src/caffe/test/test_io.cpp +index c2c919e90dc..b80df287fba 100644 +--- a/src/caffe/test/test_io.cpp ++++ b/src/caffe/test/test_io.cpp +@@ -20,8 +20,8 @@ class IOTest : public ::testing::Test {}; + bool ReadImageToDatumReference(const string& filename, const int label, + const int height, const int width, const bool is_color, Datum* datum) { + cv::Mat cv_img; +- int cv_read_flag = (is_color ? CV_LOAD_IMAGE_COLOR : +- CV_LOAD_IMAGE_GRAYSCALE); ++ int cv_read_flag = (is_color ? cv::IMREAD_COLOR : ++ cv::IMREAD_GRAYSCALE); + + cv::Mat cv_img_origin = cv::imread(filename, cv_read_flag); + if (!cv_img_origin.data) { +diff --git a/src/caffe/util/io.cpp b/src/caffe/util/io.cpp +index 5295d9dddb9..1f9167a114f 100644 +--- a/src/caffe/util/io.cpp ++++ b/src/caffe/util/io.cpp +@@ -73,8 +73,8 @@ void WriteProtoToBinaryFile(const Message& proto, const char* filename) { + cv::Mat ReadImageToCVMat(const string& filename, + const int height, const int width, const bool is_color) { + cv::Mat cv_img; +- int cv_read_flag = (is_color ? CV_LOAD_IMAGE_COLOR : +- CV_LOAD_IMAGE_GRAYSCALE); ++ int cv_read_flag = (is_color ? cv::IMREAD_COLOR : ++ cv::IMREAD_GRAYSCALE); + cv::Mat cv_img_origin = cv::imread(filename, cv_read_flag); + if (!cv_img_origin.data) { + LOG(ERROR) << "Could not open or find file " << filename; +@@ -179,8 +179,8 @@ cv::Mat DecodeDatumToCVMat(const Datum& datum, bool is_color) { + CHECK(datum.encoded()) << "Datum not encoded"; + const string& data = datum.data(); + std::vector<char> vec_data(data.c_str(), data.c_str() + data.size()); +- int cv_read_flag = (is_color ? CV_LOAD_IMAGE_COLOR : +- CV_LOAD_IMAGE_GRAYSCALE); ++ int cv_read_flag = (is_color ? cv::IMREAD_COLOR : ++ cv::IMREAD_GRAYSCALE); + cv_img = cv::imdecode(vec_data, cv_read_flag); + if (!cv_img.data) { + LOG(ERROR) << "Could not decode datum "; |