diff --git a/.SRCINFO b/.SRCINFO index 0219324..ada57a6 100644 --- a/.SRCINFO +++ b/.SRCINFO @@ -1,7 +1,7 @@ -pkgbase = caffe - pkgdesc = A deep learning framework made with expression, speed, and modularity in mind (cpu only) +pkgbase = caffe-ssd + pkgdesc = A deep learning framework made with expression, speed, and modularity in mind (cpu only, ssd branch) pkgver = 1.0 - pkgrel = 16 + pkgrel = 1 url = https://caffe.berkeleyvision.org/ arch = x86_64 license = BSD @@ -42,12 +42,15 @@ pkgbase = caffe provides = caffe-cpu conflicts = caffe-cpu replaces = caffe-cpu - source = caffe-1.0.tar.gz::https://github.com/BVLC/caffe/archive/1.0.tar.gz + source = caffe-ssd-ssd-1.0.tar.gz::https://github.com/weiliu89/caffe/archive/refs/tags/ssdv1.0.tar.gz source = Makefile.config source = caffe-1.0-opencv4-fix.patch - sha256sums = 71d3c9eb8a183150f965a465824d01fe82826c22505f7aa314f700ace03fa77f + source = caffe-ssd-1.0-opencv4-fix.patch + source = caffe-ssd-1.0-draw.py-fix.patch + sha256sums = 7f1ef29a5f32578e06cbb82181c19d3e4b0e45ea5374f7443c8b69b26418d008 sha256sums = d2a96f1cc984a2258b9f44a9dec8ec994796bd80f5f29b8f7bbb9a9de9f2f19b - sha256sums = 2072c8ca1393b53ef280a15c43af940cc9bf1419ae32b3d8a6541b10b8cb50e9 - -pkgname = caffe + sha256sums = 1503248080c2a960344719433b7b1c0dfcecb2fe640a405db10187fe1791d299 + sha256sums = 8fc84fc47ec53844916340c79a85f35ba5566c148afbf4ffd5b2596ee2111d98 + sha256sums = 921a1231ad416f6acd5d4c3ecb8663f1ea4ffd089779247cf8106d191912b93b +pkgname = caffe-ssd diff --git a/PKGBUILD b/PKGBUILD index 2af0fab..ce544df 100644 --- a/PKGBUILD +++ b/PKGBUILD @@ -1,10 +1,11 @@ -# Maintainer : Daniel Bermond +# Maintainer: Peter Babič +# Contributor: Daniel Bermond # Contributor: Micah Chambers -pkgname=caffe +pkgname=caffe-ssd pkgver=1.0 -pkgrel=16 -pkgdesc='A deep learning framework made with expression, speed, and modularity in mind (cpu only)' +pkgrel=1 +pkgdesc='A deep learning framework made with expression, speed, and modularity in mind (cpu only, ssd branch)' arch=('x86_64') url='https://caffe.berkeleyvision.org/' license=('BSD') @@ -25,19 +26,27 @@ makedepends=('boost' 'doxygen' 'texlive-core' 'texlive-latexextra' 'ghostscript' provides=('caffe-cpu') conflicts=('caffe-cpu') replaces=('caffe-cpu') -source=("${pkgname}-${pkgver}.tar.gz"::"https://github.com/BVLC/caffe/archive/${pkgver}.tar.gz" +source=("${pkgname}-ssd-${pkgver}.tar.gz"::"https://github.com/weiliu89/caffe/archive/refs/tags/ssdv${pkgver}.tar.gz" 'Makefile.config' - 'caffe-1.0-opencv4-fix.patch') -sha256sums=('71d3c9eb8a183150f965a465824d01fe82826c22505f7aa314f700ace03fa77f' + 'caffe-1.0-opencv4-fix.patch' + 'caffe-ssd-1.0-opencv4-fix.patch' + 'caffe-ssd-1.0-draw.py-fix.patch') +sha256sums=('7f1ef29a5f32578e06cbb82181c19d3e4b0e45ea5374f7443c8b69b26418d008' 'd2a96f1cc984a2258b9f44a9dec8ec994796bd80f5f29b8f7bbb9a9de9f2f19b' - '2072c8ca1393b53ef280a15c43af940cc9bf1419ae32b3d8a6541b10b8cb50e9') + '1503248080c2a960344719433b7b1c0dfcecb2fe640a405db10187fe1791d299' + '8fc84fc47ec53844916340c79a85f35ba5566c148afbf4ffd5b2596ee2111d98' + '921a1231ad416f6acd5d4c3ecb8663f1ea4ffd089779247cf8106d191912b93b') prepare() { + mv "${pkgname}v${pkgver}" "${pkgname}-${pkgver}" cp -af Makefile.config "${pkgname}-${pkgver}" - # fix build with opencv 4 # https://github.com/BVLC/caffe/pull/6625 - patch -d "${pkgname}-${pkgver}" -Np1 -i "${srcdir}/caffe-1.0-opencv4-fix.patch" + patch -d "${pkgname}-${pkgver}" -Np1 -i "${srcdir}/caffe-1.0-opencv4-fix.patch" + # https://github.com/weiliu89/caffe/issues/982 + patch -d "${pkgname}-${pkgver}" -Np1 -i "${srcdir}/caffe-ssd-1.0-opencv4-fix.patch" + # https://github.com/BVLC/caffe/issues/3698#issuecomment-258759498 + patch -d "${pkgname}-${pkgver}" -Np1 -i "${srcdir}/caffe-ssd-1.0-draw.py-fix.patch" } build() { diff --git a/caffe-1.0-opencv4-fix.patch b/caffe-1.0-opencv4-fix.patch index 1aef32f..41d9ac6 100644 --- a/caffe-1.0-opencv4-fix.patch +++ b/caffe-1.0-opencv4-fix.patch @@ -21,7 +21,7 @@ index b7660e852d6..95f3443adab 100644 - ifeq ($(OPENCV_VERSION), 3) + ifeq ($(OPENCV_VERSION), $(filter $(OPENCV_VERSION), 3 4)) - LIBRARIES += opencv_imgcodecs + LIBRARIES += opencv_imgcodecs opencv_videoio endif + ifeq ($(OPENCV_VERSION), 4) + ifeq ($(USE_PKG_CONFIG), 1) diff --git a/caffe-ssd-1.0-draw.py-fix.patch b/caffe-ssd-1.0-draw.py-fix.patch new file mode 100644 index 0000000..51e1721 --- /dev/null +++ b/caffe-ssd-1.0-draw.py-fix.patch @@ -0,0 +1,18 @@ +diff --color --unified --recursive --text caffe-ssd-1.0.orig/python/caffe/draw.py caffe-ssd-1.0.new/python/caffe/draw.py +--- caffe-ssd-1.0.orig/python/caffe/draw.py 2018-01-02 20:07:58.000000000 +0100 ++++ caffe-ssd-1.0.new/python/caffe/draw.py 2021-11-21 20:42:15.904577707 +0100 +@@ -91,11 +91,11 @@ + separator, + layer.type, + separator, +- layer.convolution_param.kernel_size[0] if len(layer.convolution_param.kernel_size._values) else 1, ++ layer.convolution_param.kernel_size[0] if len(layer.convolution_param.kernel_size) else 1, + separator, +- layer.convolution_param.stride[0] if len(layer.convolution_param.stride._values) else 1, ++ layer.convolution_param.stride[0] if len(layer.convolution_param.stride) else 1, + separator, +- layer.convolution_param.pad[0] if len(layer.convolution_param.pad._values) else 0) ++ layer.convolution_param.pad[0] if len(layer.convolution_param.pad) else 0) + elif layer.type == 'Pooling': + pooling_types_dict = get_pooling_types_dict() + node_label = '"%s%s(%s %s)%skernel size: %d%sstride: %d%spad: %d"' %\ diff --git a/caffe-ssd-1.0-opencv4-fix.patch b/caffe-ssd-1.0-opencv4-fix.patch new file mode 100644 index 0000000..13ac6d1 --- /dev/null +++ b/caffe-ssd-1.0-opencv4-fix.patch @@ -0,0 +1,58 @@ +diff --color --unified --recursive --text caffe-ssd-1.0.orig/include/caffe/common.hpp caffe-ssd-1.0.new/include/caffe/common.hpp +--- caffe-ssd-1.0.orig/include/caffe/common.hpp 2018-01-02 20:07:58.000000000 +0100 ++++ caffe-ssd-1.0.new/include/caffe/common.hpp 2021-11-21 17:01:19.980866883 +0100 +@@ -69,6 +69,16 @@ + // is executed we will see a fatal log. + #define NOT_IMPLEMENTED LOG(FATAL) << "Not Implemented Yet" + ++// Supporting OpenCV4 ++#if (CV_MAJOR_VERSION == 4) ++#define CV_LOAD_IMAGE_COLOR cv::IMREAD_COLOR ++#define CV_LOAD_IMAGE_GRAYSCALE cv::IMREAD_GRAYSCALE ++#define CV_CAP_PROP_FRAME_COUNT cv::CAP_PROP_FRAME_COUNT ++#define CV_CAP_PROP_POS_FRAMES cv::CAP_PROP_POS_FRAMES ++#define CV_FILLED cv::FILLED ++#define CV_FOURCC cv::VideoWriter::fourcc ++#endif ++ + // See PR #1236 + namespace cv { class Mat; } + +diff --color --unified --recursive --text caffe-ssd-1.0.orig/Makefile caffe-ssd-1.0.new/Makefile +--- caffe-ssd-1.0.orig/Makefile 2021-11-21 16:59:16.379709144 +0100 ++++ caffe-ssd-1.0.new/Makefile 2021-11-21 17:01:19.980866883 +0100 +@@ -404,7 +404,7 @@ + CXXFLAGS += -MMD -MP + + # Complete build flags. +-COMMON_FLAGS += $(foreach includedir,$(INCLUDE_DIRS),-isystem $(includedir)) ++COMMON_FLAGS += $(foreach includedir,$(INCLUDE_DIRS),-I $(includedir)) + CXXFLAGS += -pthread -fPIC $(COMMON_FLAGS) $(WARNINGS) + NVCCFLAGS += -ccbin=$(CXX) -Xcompiler -fPIC $(COMMON_FLAGS) + # mex may invoke an older gcc that is too liberal with -Wuninitalized +diff --color --unified --recursive --text caffe-ssd-1.0.orig/src/caffe/util/im_transforms.cpp caffe-ssd-1.0.new/src/caffe/util/im_transforms.cpp +--- caffe-ssd-1.0.orig/src/caffe/util/im_transforms.cpp 2018-01-02 20:07:58.000000000 +0100 ++++ caffe-ssd-1.0.new/src/caffe/util/im_transforms.cpp 2021-11-21 17:05:01.293051919 +0100 +@@ -1,7 +1,7 @@ + #ifdef USE_OPENCV + #include + +-#if CV_VERSION_MAJOR == 3 ++#if CV_VERSION_MAJOR == 3 || CV_VERSION_MAJOR == 4 + #include + #define CV_GRAY2BGR cv::COLOR_GRAY2BGR + #define CV_BGR2GRAY cv::COLOR_BGR2GRAY +@@ -12,6 +12,13 @@ + #define CV_THRESH_BINARY_INV cv::THRESH_BINARY_INV + #define CV_THRESH_OTSU cv::THRESH_OTSU + #endif ++ ++#if CV_VERSION_MAJOR == 4 ++#define CV_BGR2HSV cv::COLOR_BGR2HSV ++#define CV_HSV2BGR cv::COLOR_HSV2BGR ++#define CV_BGR2Lab cv::COLOR_BGR2Lab ++#endif ++ + #endif // USE_OPENCV + + #include