homebrew-core/Formula/caffe.rb
2019-11-28 12:50:58 -05:00

71 lines
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"
revision 16
bottle do
sha256 "b48ecaa34cfa9d0fd7207c48f73bae7e13dd350b46d1242cdcca9e5deba764a8" => :catalina
sha256 "94ac9647308a9de9281e676d8ecfdb4e696972f0b71f9e5509d585fba9560aaa" => :mojave
sha256 "547152fc04024cc95a02bc91668a020e05f6d7d6878f70d8f894e8d1f725608e" => :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 "http://dl.caffe.berkeleyvision.org/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/pull/6638.diff?full_index=1"
sha256 "6a6368d715284fabfa96660b6d24d1f4f419f3e6cdddab9a7293954fee4ec2bc"
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