mirror of
https://github.com/yann64/haikuports.git
synced 2026-04-09 05:10:05 +02:00
caffe, revbump, import patches for opencv/protobuf (#6876)
This commit is contained in:
@@ -5,18 +5,25 @@ Berkeley Vision and Learning Center (BVLC) and community contributors."
|
||||
HOMEPAGE="http://caffe.berkeleyvision.org/"
|
||||
COPYRIGHT="2014 Randolph Voorhies, Shane Grant"
|
||||
LICENSE="BSD (2-clause)"
|
||||
REVISION="9"
|
||||
REVISION="10"
|
||||
SOURCE_URI="https://github.com/BVLC/caffe/archive/$portVersion.tar.gz"
|
||||
CHECKSUM_SHA256="71d3c9eb8a183150f965a465824d01fe82826c22505f7aa314f700ace03fa77f"
|
||||
PATCHES="caffe-$portVersion.patchset"
|
||||
PATCHES="caffe-$portVersion.patchset
|
||||
1b317bab3f6413a1b5d87c9d3a300d785a4173f9.patch
|
||||
7f503bd9a19758a173064e299ab9d4cac65ed60f.patch"
|
||||
# Patches found at: https://aur.archlinux.org/packages/caffe
|
||||
# https://github.com/BVLC/caffe/pull/6625
|
||||
# https://github.com/BVLC/caffe/pull/7044
|
||||
|
||||
ARCHITECTURES="all !x86_gcc2 ?x86"
|
||||
SECONDARY_ARCHITECTURES="?x86"
|
||||
|
||||
# On x86_gcc2 we don't want to install the commands in bin/<arch>/, but in bin/.
|
||||
commandBinDir=$binDir
|
||||
commandSuffix=$secondaryArchSuffix
|
||||
if [ "$targetArchitecture" = x86_gcc2 ]; then
|
||||
commandSuffix=
|
||||
commandBinDir=$prefix/bin
|
||||
fi
|
||||
|
||||
PROVIDES="
|
||||
@@ -37,7 +44,7 @@ PROVIDES="
|
||||
cmd:upgrade_net_proto_binary$commandSuffix
|
||||
cmd:upgrade_net_proto_text$commandSuffix
|
||||
cmd:upgrade_solver_proto_text$commandSuffix
|
||||
lib:libcaffe$secondaryArchSuffix = $portVersion
|
||||
lib:libcaffe$secondaryArchSuffix = 1.0.0
|
||||
"
|
||||
REQUIRES="
|
||||
haiku$secondaryArchSuffix
|
||||
@@ -62,7 +69,7 @@ REQUIRES="
|
||||
|
||||
PROVIDES_devel="
|
||||
caffe${secondaryArchSuffix}_devel = $portVersion
|
||||
devel:libcaffe$secondaryArchSuffix
|
||||
devel:libcaffe$secondaryArchSuffix = 1.0.0
|
||||
devel:libproto$secondaryArchSuffix
|
||||
"
|
||||
REQUIRES_devel="
|
||||
@@ -111,33 +118,23 @@ DISTRIBUTE_DIR := distribute
|
||||
USE_PKG_CONFIG := 1
|
||||
EOF
|
||||
|
||||
mkdir -p build && cd build
|
||||
|
||||
cmake -DCMAKE_INSTALL_PREFIX=$prefix \
|
||||
cmake -B build -S . \
|
||||
$cmakeDirArgs \
|
||||
-DCMAKE_INSTALL_BINDIR=$commandBinDir \
|
||||
-DCMAKE_BUILD_TYPE='Release' \
|
||||
-DUSE_LEVELDB:BOOL=OFF \
|
||||
-DUSE_OPENCV:BOOL=ON \
|
||||
-DCPU_ONLY:BOOL=ON \
|
||||
-DBUILD_python:BOOL=OFF \
|
||||
-DBUILD_SHARED_LIBS:BOOL=ON \
|
||||
..
|
||||
make $jobArgs
|
||||
-DBUILD_SHARED_LIBS:BOOL=ON
|
||||
make -C build $jobArgs
|
||||
}
|
||||
|
||||
INSTALL()
|
||||
{
|
||||
cd build
|
||||
make install
|
||||
make -C build install
|
||||
|
||||
mkdir -p $includeDir
|
||||
mv $prefix/include/* $includeDir
|
||||
rmdir $prefix/include/
|
||||
|
||||
mkdir -p $libDir/cmake
|
||||
mv $prefix/share/* $libDir/cmake
|
||||
rmdir $prefix/share/
|
||||
|
||||
# Python supporte disabled for now.
|
||||
# Python support disabled for now.
|
||||
rm -rf $prefix/python
|
||||
|
||||
prepareInstalledDevelLibs libcaffe libproto
|
||||
@@ -150,7 +147,6 @@ INSTALL()
|
||||
|
||||
TEST()
|
||||
{
|
||||
cd build
|
||||
make test
|
||||
make runtest
|
||||
make -C build test
|
||||
make -C build runtest
|
||||
}
|
||||
|
||||
@@ -0,0 +1,22 @@
|
||||
From 1b317bab3f6413a1b5d87c9d3a300d785a4173f9 Mon Sep 17 00:00:00 2001
|
||||
From: kr0p07k1n <91276442+kr0p07k1n@users.noreply.github.com>
|
||||
Date: Sun, 28 Nov 2021 19:36:04 -0500
|
||||
Subject: [PATCH] use one parameter when calling SetTotalBytesLimit
|
||||
|
||||
---
|
||||
src/caffe/util/io.cpp | 2 +-
|
||||
1 file changed, 1 insertion(+), 1 deletion(-)
|
||||
|
||||
diff --git a/src/caffe/util/io.cpp b/src/caffe/util/io.cpp
|
||||
index 5295d9dddb9..f71553c9936 100644
|
||||
--- a/src/caffe/util/io.cpp
|
||||
+++ b/src/caffe/util/io.cpp
|
||||
@@ -54,7 +54,7 @@ bool ReadProtoFromBinaryFile(const char* filename, Message* proto) {
|
||||
CHECK_NE(fd, -1) << "File not found: " << filename;
|
||||
ZeroCopyInputStream* raw_input = new FileInputStream(fd);
|
||||
CodedInputStream* coded_input = new CodedInputStream(raw_input);
|
||||
- coded_input->SetTotalBytesLimit(kProtoReadBytesLimit, 536870912);
|
||||
+ coded_input->SetTotalBytesLimit(kProtoReadBytesLimit);
|
||||
|
||||
bool success = proto->ParseFromCodedStream(coded_input);
|
||||
|
||||
@@ -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 ";
|
||||
@@ -1,4 +1,4 @@
|
||||
From f8f149fd4999b6c77901f2ff8a9cef36ef35148c Mon Sep 17 00:00:00 2001
|
||||
From 139a989d26cdfc8ac8cb068c100f751a0893259a Mon Sep 17 00:00:00 2001
|
||||
From: =?UTF-8?q?Zolt=C3=A1n=20Mizsei?= <zmizsei@extrowerk.com>
|
||||
Date: Sun, 21 May 2017 11:13:02 +0200
|
||||
Subject: caffe: BLAS fix for Haiku
|
||||
@@ -29,5 +29,28 @@ index 4a5bac4..81d5e83 100644
|
||||
# ---[ Python
|
||||
if(BUILD_python)
|
||||
--
|
||||
2.12.2
|
||||
2.35.1
|
||||
|
||||
|
||||
From 49cef6571ae08954895889d2c69b4dc9fe48c856 Mon Sep 17 00:00:00 2001
|
||||
From: begasus <begasus@gmail.com>
|
||||
Date: Thu, 5 May 2022 12:32:00 +0000
|
||||
Subject: caffe, fix install path for cmake files
|
||||
|
||||
|
||||
diff --git a/cmake/ConfigGen.cmake b/cmake/ConfigGen.cmake
|
||||
index ad91f54..a9cf5e7 100644
|
||||
--- a/cmake/ConfigGen.cmake
|
||||
+++ b/cmake/ConfigGen.cmake
|
||||
@@ -18,7 +18,7 @@ endfunction()
|
||||
# Usage:
|
||||
# caffe_generate_export_configs()
|
||||
function(caffe_generate_export_configs)
|
||||
- set(install_cmake_suffix "share/Caffe")
|
||||
+ set(install_cmake_suffix "${CMAKE_INSTALL_LIBDIR}/cmake/Caffe")
|
||||
|
||||
if(NOT HAVE_CUDA)
|
||||
set(HAVE_CUDA FALSE)
|
||||
--
|
||||
2.35.1
|
||||
|
||||
|
||||
Reference in New Issue
Block a user