81
机器学习应用区块链系列(一)——如何开发一套自己的智能合约系统
source link: http://mp.weixin.qq.com/s/o0gIQCRIHuOmAZAH7EkVaA
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.
机器学习应用区块链系列(一)——如何开发一套自己的智能合约系统
Original
编辑部
量化投资与机器学习
2018-01-18 12:01
Posted on
从今天开始
编辑部将带来机器学习应用区块链系列
由于是第一期,我们想解读一些国外已有的文献和研究。故带来了START-Summit-2017-Blockchain-Machine-Learning-Workshop的演讲稿和示例代码,希望能够给大家带来一些启迪。
介绍
代码的目的是用一个简单的例子来演示如何把区块链技术,智能合约和机器学习结合在一起。 (代码在文末下载)
代码文件
- runTestnet.sh: launches a local development Blockchain for easy testing
- contract.sol: contains the smart contract code in solidity language
- installContract.py: Python script for sending our contract to the Blockchain
- user.py: Python script that contains the actual chat client
- classify.py: Python script to classifiy an image file
流程
推荐使用Linux系统。 安装将集中在Ubuntu Linux 16.04 LTS上,但对于其他发行版应该是类似的。
我们需要先安装Python 2.7,pip,curl和git:
open a Linux Terminal and enter the following command:
sudo apt-get install python2.7 python-pip curl git build-essential libssl-dev
安装当前nodejs版本:
curl -sL https://deb.nodesource.com/setup_7.x | sudo -E bash -
sudo apt-get install -y nodejs
安装区块链测试环境:
sudo npm install -g ethereumjs-testrpc solc
安装其他Python包:
sudo pip install -U pip
sudo pip install -U numpy keras==2.0.0 tensorflow ethjsonrpc h5py Pillow scipy
克隆workshop代码:
cd
git clone https://github.com/thoschm/START-Summit-2017-Blockchain-Machine-Learning-Workshop.git workshop_code
克隆现成的深度学习模型:
cd
git clone https://github.com/fchollet/deep-learning-models.git
cp deep-learning-models/resnet50.py workshop_code/code/
cp deep-learning-models/imagenet_utils.py workshop_code/code/
简单的图像分类示例
cd
cd workshop_code/code
[get some image file in there]
python classify.py image.jpg
当您第一次运行它时,它会从互联网下载预先训练的网络权重。 不需要自己训练。
Using TensorFlow backend.
content:
Downloading data from https://s3.amazonaws.com/deep-learning-models/image-models/imagenet_class_index.json
> tree_frog <
PPT展示
获取本系列代码+论文
请在后台回复
区块链1
即可获取
有些人不知道后台回复如何操作
为大家介绍一下:
Recommend
About Joyk
Aggregate valuable and interesting links.
Joyk means Joy of geeK