caffe2-generate 1.0 KB

12345678910111213141516171819202122232425262728293031323334
  1. #!/bin/bash
  2. mkdir -p ../third_party
  3. repository=https://github.com/caffe2/caffe2.git
  4. if [ -d "../third_party/caffe2" ]; then
  5. pushd "../third_party/caffe2" > /dev/null
  6. echo "Fetch ${repository}..."
  7. git fetch -p
  8. echo "Reset ${repository}..."
  9. git reset --hard origin/master
  10. popd > /dev/null
  11. else
  12. echo "Clone ${repository}..."
  13. pushd "../third_party" > /dev/null
  14. git clone --recursive ${repository}
  15. popd > /dev/null
  16. fi
  17. echo "Generate '../src/caffe2.js'"
  18. ../node_modules/protobufjs/bin/pbjs -t static-module -w closure -r caffe2 -o ../src/caffe2.js ../third_party/caffe2/caffe2/proto/caffe2.proto
  19. echo "Install Caffe2 dependencies"
  20. brew install automake cmake gflags glog
  21. sudo -H pip install future numpy protobuf pydot python-gflags pyyaml scikit-image setuptools six
  22. sudo -H pip3 install future numpy protobuf pydot python-gflags pyyaml scikit-image setuptools six
  23. echo "Build Caffe2"
  24. pushd "../third_party/caffe2" > /dev/null
  25. mkdir -p build && cd build
  26. cmake -DUSE_CUDA=OFF ..
  27. sudo make install
  28. popd > /dev/null