文章出處

@tags caffe python

windows下配置caffe后,create_cifar10.sh無法執行,因為是shell腳本。那就看懂腳本意思,用python重寫一個:

# create_cifar10.py
# by ChrisZZ

import os
import shutil

EXAMPLE="examples\\cifar10"
DATA="data\\cifar10"
DBTYPE="lmdb"

print "Creating "+DBTYPE+"..."

path1=EXAMPLE+"\\cifar10_train_"+DBTYPE
path2=EXAMPLE+"\\cifar10_test_"+DBTYPE

if os.path.exists(path1):
    shutil.rmtree(path1)
if os.path.exists(path2):
    shutil.rmtree(path2)

caffe_build=os.environ['caffe_build']
cmd1=caffe_build+"\\convert_cifar_data.exe "+DATA+" "+EXAMPLE+" "+DBTYPE
print cmd1
os.system(cmd1)

print "Computing image mean..."

cmd2=caffe_build+"\\compute_image_mean.exe --backend="+DBTYPE+" "+EXAMPLE+"\\cifar10_train_"+DBTYPE+" "+EXAMPLE+"\\mean.binaryproto"
print cmd2
os.system(cmd2)

然后在目錄執行:

python examples\cifar10\create_cifar10.py


文章列表


不含病毒。www.avast.com
arrow
arrow
    全站熱搜
    創作者介紹
    創作者 大師兄 的頭像
    大師兄

    IT工程師數位筆記本

    大師兄 發表在 痞客邦 留言(0) 人氣()