78 lines
2.2 KiB
Ruby
78 lines
2.2 KiB
Ruby
class Caffe < Formula
|
|
desc "Fast open framework for deep learning"
|
|
homepage "https://caffe.berkeleyvision.org/"
|
|
url "https://github.com/BVLC/caffe/archive/1.0.tar.gz"
|
|
sha256 "71d3c9eb8a183150f965a465824d01fe82826c22505f7aa314f700ace03fa77f"
|
|
license "BSD-2-Clause"
|
|
revision 27
|
|
|
|
livecheck do
|
|
url "https://github.com/BVLC/caffe/releases/latest"
|
|
regex(%r{href=.*?/tag/v?(\d+(?:\.\d+)+)["' >]}i)
|
|
end
|
|
|
|
bottle do
|
|
sha256 "65bf174c97c7a3fac9f2d4765387d41c59abf59a0f7c3f5eb5012b9445ade013" => :catalina
|
|
sha256 "12f41de7b8e34434312f00f330aad10bed4cd1fea905ae3038a566c5e6ce0476" => :mojave
|
|
sha256 "fc668d361b8ac9d2d246a37e47b0ad696ee73bd66ca10e8b7814a17b3ceb5f29" => :high_sierra
|
|
end
|
|
|
|
depends_on "cmake" => :build
|
|
depends_on "boost"
|
|
depends_on "gflags"
|
|
depends_on "glog"
|
|
depends_on "hdf5"
|
|
depends_on "leveldb"
|
|
depends_on "lmdb"
|
|
depends_on "opencv"
|
|
depends_on "protobuf"
|
|
depends_on "snappy"
|
|
depends_on "szip"
|
|
|
|
resource "test_model_weights" do
|
|
url "https://bintray.com/homebrew/mirror/download_file?file_path=bvlc_reference_caffenet.caffemodel"
|
|
sha256 "472d4a06035497b180636d8a82667129960371375bd10fcb6df5c6c7631f25e0"
|
|
end
|
|
|
|
# Fix compilation with OpenCV 4
|
|
# https://github.com/BVLC/caffe/issues/6652
|
|
patch do
|
|
url "https://github.com/BVLC/caffe/commit/0a04cc2ccd37ba36843c18fea2d5cbae6e7dd2b5.patch?full_index=1"
|
|
sha256 "f79349200c46fc1228ab1e1c135a389a6d0c709024ab98700017f5f66b373b39"
|
|
end
|
|
|
|
def install
|
|
ENV.cxx11
|
|
|
|
args = std_cmake_args + %w[
|
|
-DALLOW_LMDB_NOLOCK=OFF
|
|
-DBUILD_SHARED_LIBS=ON
|
|
-DBUILD_docs=OFF
|
|
-DBUILD_matlab=OFF
|
|
-DBUILD_python=OFF
|
|
-DBUILD_python_layer=OFF
|
|
-DCPU_ONLY=ON
|
|
-DUSE_LEVELDB=ON
|
|
-DUSE_LMDB=ON
|
|
-DUSE_NCCL=OFF
|
|
-DUSE_OPENCV=ON
|
|
-DUSE_OPENMP=OFF
|
|
]
|
|
|
|
system "cmake", ".", *args
|
|
system "make", "install"
|
|
pkgshare.install "models"
|
|
end
|
|
|
|
test do
|
|
model = "bvlc_reference_caffenet"
|
|
m_path = "#{pkgshare}/models/#{model}"
|
|
resource("test_model_weights").stage do
|
|
system "#{bin}/caffe", "test",
|
|
"-model", "#{m_path}/deploy.prototxt",
|
|
"-solver", "#{m_path}/solver.prototxt",
|
|
"-weights", "#{model}.caffemodel"
|
|
end
|
|
end
|
|
end
|