[ create a new paste ] login | about

Link: http://codepad.org/3nlwDsGc    [ raw code | output | fork ]

Python, pasted on Jan 4:
import time
from dd_client import DD

model_repo = '/home/fgvc/Models/yub-resnet50'
height = 224
width = 224
nclasses = 200

# setting up DD client
host = '127.0.0.1'
sname = 'imgserv'
description = 'yub classification'
mllib = 'caffe'
dd = DD(host, 5001)
dd.set_return_format(dd.RETURN_PYTHON)

# creating ML service
model = {'templates':'/home/fgvc/Project/deepdetect/build/templates/caffe','repository':model_repo}
#model = {'repository':model_repo}
parameters_input = {'connector':'image','width':width,'height':height}
parameters_mllib = {'nclasses':nclasses,'finetuning':True,'rotate':False,'mirror':True,'weights':'ResNet-50-model.caffemodel'}
parameters_output = {}
dd.put_service(sname,model,description,mllib,
               parameters_input,parameters_mllib,parameters_output)

# training / finetuning from pre-trained network
train_data = ['home/fgvc/Dataset/yub-200-2017']
parameters_input = {'test_split':0.2,'shuffle':True}
parameters_mllib = {'gpu':False,'net':{'batch_size':64,'test_batch_size':64},'solver':{'test_interval':4000,'iterations':50000,'snapshot':10000,'base_lr':0.01,'solver_type':'NESTEROV','test_initialization':True}}
parameters_output = {'measure':['mcll','f1','acc-5']}
dd.post_train(sname,train_data,parameters_input,parameters_mllib,parameters_output,async=True)

time.sleep(1)
train_status = ''
while True:
    train_status = dd.get_train(sname,job=1,timeout=10)
    if train_status['head']['status'] == 'running':
        print train_status['body']['measure']
    else:
        print train_status
        break

dd.delete_service(sname)


Output:
1
2
3
4
Traceback (most recent call last):
  Line 2, in <module>
    from dd_client import DD
ImportError: No module named dd_client


Create a new paste based on this one


Comments: