如何在Windows上构建Caffe库(Visual Studio 2013)?

时间:2015-11-04 19:19:35

标签: visual-studio-2013 caffe

有没有人在Visual Studio开发中成功使用Caffe库?如果是,您可以做一个简短的概述(一步一步)。

我已经做过的事情:   - 从Github下载Caffe   - 建设Boost   - 构建Cuda Toolkit 7.5   - 建立gflags   - 建立glog

还是要这样做: - hdf5 - protobuf - GLog ....

有人有任何指示吗?

3 个答案:

答案 0 :(得分:4)

<强>更新 从微软adopted the porting of CAFFE to windows开始,现在有一种更简单的方法可以使用visual studio为Windows构建CAFFE。整个过程在this 5 min video!

中描述

我看到Saeed的答案,我想我有更容易提出的建议。

按照构建的找到的here在Windows上轻松构建Caffe。但是,您始终必须检查它是否有更改,因为它们的代码会定期更新,但是它们的文档仍然存在。在我的情况下(以及许多其他同事),他们的代码按原样构建,开箱即用!

答案 1 :(得分:2)

不建议在Windows上构建和使用Caffe,但如果您坚持这样做,您可以找到这个完美的分步指南,这样有用。

Build Caffe in Windows with Visual Studio 2013 + CUDA 6.5 + OpenCV 2.4.9

答案 2 :(得分:0)

您还可以使用Collective Knowledge工作流框架,只需几个步骤即可从命令行在Windows,Linux或MacOS上自动安装Caffe。见

基本上,您只需要执行以下操作:

func genderDropdownViewConfig() {
    genderDropdownView.backgroundColor = Constants.azureColor
    genderDropdownView.frame = CGRect(x: 0, y: 0, width: 0, height: 0)
    genderDropdownView.translatesAutoresizingMaskIntoConstraints = false
    genderDropdownButton.addSubview(genderDropdownView)

    genderDropdownButton.addSubview(genderDropdownView)
    tableView.bringSubview(toFront: genderDropdownView)

    genderDropdownView.topAnchor.constraint(equalTo: genderDropdownButton.bottomAnchor).isActive = true
    genderDropdownView.centerXAnchor.constraint(equalTo: genderDropdownButton.centerXAnchor).isActive = true
    genderDropdownView.widthAnchor.constraint(equalTo: genderDropdownButton.widthAnchor).isActive = true
    //genderDropdownHeight = genderDropdownView.heightAnchor.constraint(equalToConstant: 0)
    genderDropdownHeight = genderDropdownView.heightAnchor.constraint(equalToConstant: 0)

    for subview in genderDropdownView.subviews {
        subview.backgroundColor = .clear
    }
}

override func tableView(_ tableView: UITableView, heightForRowAt indexPath: IndexPath) -> CGFloat {
    let heights = [280, 130, 103, 103, 103, 103]
    if indexPath.row ==  2 && genderIsOpen == true {
        return 191
    } else {
        return CGFloat(heights[indexPath.row])
    }
}

@objc func genderDropDownTouched() {
    if genderIsOpen == false {
        NSLayoutConstraint.deactivate([self.genderDropdownHeight])
        genderDropdownHeight.constant = 88
        genderIsOpen = true
        NSLayoutConstraint.activate([self.genderDropdownHeight])

        // Editing height of cell
        tableView.reloadData()

        UIView.animate(withDuration: 0.5, delay: 0, usingSpringWithDamping: 0.5, initialSpringVelocity: 0.5, options: .curveEaseInOut, animations: {
            self.genderDropdownView.layoutIfNeeded()
            self.genderDropdownView.center.y += self.genderDropdownView.frame.height / 2
        }, completion: nil)
    } else {
        NSLayoutConstraint.deactivate([self.genderDropdownHeight])
        genderDropdownHeight.constant = 0
        genderIsOpen = false
        NSLayoutConstraint.activate([self.genderDropdownHeight])

        // Editing height of cell
        tableView.reloadData()

        UIView.animate(withDuration: 0.5, delay: 0, usingSpringWithDamping: 0.5, initialSpringVelocity: 0.5, options: .curveEaseInOut, animations: {
            self.genderDropdownView.center.y -= self.genderDropdownView.frame.height / 2
            self.genderDropdownView.layoutIfNeeded()
        }, completion: nil)
    }
}

CK将检测或重建Windows上的所有必需依赖项(HDF5,Boost,OpenCV等)。然后,您可以从虚拟环境使用Caffe,如下所示:

   pip install ck
   ck pull repo --url=https://github.com/dividiti/ck-caffe
   ck install package:lib-caffe-bvlc-master-cudnn-universal --env.CAFFE_BUILD_PYTHON=ON

希望对您有帮助!