def init_params(options): ctxdim=options['featureMaps']; hdim=options['hdim']; actionNum=options['actions']; fdim=options['fdim']; # print actionNum; params=OrderedDict(); params=SaliencyFgbg_init(params,options['locations'],options['featureMaps'],prefix="recog",name='saliencyFgbg'); params=ff_init(params,ctxdim,fdim,prefix="recog",name='channel0'); params=LSTM_init(params,ctxdim,hdim,prefix="recog",name='lstm1'); params=ff_init(params,hdim,fdim,prefix="recog",name='channel1'); #output params=ff_init(params,fdim,actionNum,prefix="recog",name='output'); # params['recog/saliencyFgbg_w']=theano.gradient.grad_clip(params['recog/saliencyFgbg_w'],-0.1,0.1); tparams=share_params(params); # loading params if need loadfrom=options['loadfrom']; if options['load']: if os.path.exists(loadfrom): print "loading model parameters from ",loadfrom; tparams = load_params(loadfrom, tparams,strict=False); else: print "Not exist ",loadfrom; return tparams
def init_params(options): ctxdim=options['featureMaps']; hdim=options['hdim']; actionNum=options['actions']; fdim=options['fdim']; params=OrderedDict(); params=Saliency_init(params,ctxdim,prefix="recog",name='saliency'); # FNN channel params=ff_init(params,ctxdim,fdim,prefix="recog",name='fullconn'); # LSTM channel params=LSTM_init(params,ctxdim,hdim,prefix="recog",name='lstm'); params=ff_init(params,hdim,fdim,prefix="recog",name='fullconn_lstm'); #output params=ff_init(params,fdim,actionNum,prefix="recog",name='output'); tparams=share_params(params); # loading params if need loadfrom=options['loadfrom']; if options['load'] and os.path.exists(loadfrom): print "loading model parameters from ",loadfrom; tparams = load_params(loadfrom, tparams,strict=False); return tparams
def init_params(options): ctxdim = options['featureMaps'] hdim = options['hdim'] actionNum = options['actions'] fdim = options['fdim'] params = OrderedDict() params = Saliency_init(params, ctxdim, prefix="recog", name='saliency') # FNN channel params = ff_init(params, ctxdim, fdim, prefix="recog", name='fullconn') # LSTM channel params = LSTM_init(params, ctxdim, hdim, prefix="recog", name='lstm') params = ff_init(params, hdim, fdim, prefix="recog", name='fullconn_lstm') #output params = ff_init(params, fdim, actionNum, prefix="recog", name='output') tparams = share_params(params) # loading params if need loadfrom = options['loadfrom'] if options['load'] and os.path.exists(loadfrom): print "loading model parameters from ", loadfrom tparams = load_params(loadfrom, tparams, strict=False) return tparams
def init_params(options): ctxdim=options['featureMaps']; hdim=options['hdim']; actionNum=options['actions']; fdim=options['fdim']; # print actionNum; params=OrderedDict(); params=SaliencyLSTM_init(params,ctxdim,prefix="recog",name='saliencyLSTM'); params=ff_init(params,ctxdim,fdim,prefix="recog",name='channel0'); params=LSTM_init(params,ctxdim,hdim,prefix="recog",name='lstm'); params=ff_init(params,hdim,fdim,prefix="recog",name='channel1'); #output params=ff_init(params,fdim,actionNum,prefix="recog",name='output'); tparams=share_params(params); # loading params if need loadfrom=options['loadfrom']; if options['load'] and os.path.exists(loadfrom): print "loading model parameters from ",loadfrom; tparams = load_params(loadfrom, tparams,strict=False); return tparams
def init_params(options): ctxdim = options['featureMaps'] hdim = options['hdim'] actionNum = options['actions'] fdim = options['fdim'] # print actionNum; params = OrderedDict() params = SaliencyFgbg_init(params, options['locations'], options['featureMaps'], prefix="recog", name='saliencyFgbg') params = ff_init(params, ctxdim, fdim, prefix="recog", name='channel0') params = LSTM_init(params, ctxdim, hdim, prefix="recog", name='lstm1') params = ff_init(params, hdim, fdim, prefix="recog", name='channel1') #output params = ff_init(params, fdim, actionNum, prefix="recog", name='output') # params['recog/saliencyFgbg_w']=theano.gradient.grad_clip(params['recog/saliencyFgbg_w'],-0.1,0.1); tparams = share_params(params) # loading params if need loadfrom = options['loadfrom'] if options['load']: if os.path.exists(loadfrom): print "loading model parameters from ", loadfrom tparams = load_params(loadfrom, tparams, strict=False) else: print "Not exist ", loadfrom return tparams
def init_params(options): feadim = options['featureMaps'] ctxdim = 512 hdim = options['hdim'] actionNum = options['actions'] fdim = 64 params = OrderedDict() #params=Saliency_init(params,ctxdim,prefix="recog"); #params=ff_init(params,ctxdim,512,prefix="recog",name='ctx_pre'); params = Linger_init(params, feadim, ctxdim, prefix='recog', name='linger') # FNN channel params = ff_init(params, ctxdim, fdim, prefix="recog", name='highway') # LSTM params = LSTM_init(params, ctxdim, hdim, prefix="recog", name='lstm') params = ff_init(params, hdim, fdim, prefix="recog", name='fullconn') params = ff_init(params, fdim, actionNum, prefix="recog", name='output') tparams = share_params(params) # loading params if need loadfrom = options['loadfrom'] if options['load'] and os.path.exists(loadfrom): print "loading model parameters from ", loadfrom tparams = load_params(loadfrom, tparams, strict=False) return tparams
def init_params(options): ctxdim=256; hdim=options['hdim']; actionNum=options['actions']; fdim=options['fdim']; params=OrderedDict(); # params=Saliency_init(params,ctxdim,prefix="recog",name='saliency'); # params=Linger_init(params,ctxdim,ctxdim,prefix='recog',name='linger'); # LSTM # params=LSTM_init(params,ctxdim,hdim,prefix="recog",name='lstm1'); # params=LSTM_init(params,hdim,512,prefix="recog",name='lstm2'); # params=LSTM_init(params,512,256,prefix="recog",name='lstm3'); # params=LSTM_init(params,256,128,prefix="recog",name='lstm4'); # multiChannel params=ff_init(params,ctxdim,fdim,prefix="recog",name='channel0'); # params=ff_init(params,hdim,fdim,prefix="recog",name='channel1'); # params=ff_init(params,512,fdim,prefix="recog",name='channel2'); # params=ff_init(params,256,fdim,prefix="recog",name='channel3'); # params=ff_init(params,128,fdim,prefix="recog",name='channel4'); #output params=ff_init(params,fdim,actionNum,prefix="recog",name='output'); tparams=share_params(params); tparams=cnn_init(tparams,cnn_net,prefix='recog',name='cnn'); # loading params if need loadfrom=options['loadfrom']; if options['load'] and os.path.exists(loadfrom): print "loading model parameters from ",loadfrom; tparams = load_params(loadfrom, tparams,strict=False); return tparams
def init_params(options): ctxdim = 256 hdim = options['hdim'] actionNum = options['actions'] fdim = options['fdim'] params = OrderedDict() # params=Saliency_init(params,ctxdim,prefix="recog",name='saliency'); # params=Linger_init(params,ctxdim,ctxdim,prefix='recog',name='linger'); # LSTM # params=LSTM_init(params,ctxdim,hdim,prefix="recog",name='lstm1'); # params=LSTM_init(params,hdim,512,prefix="recog",name='lstm2'); # params=LSTM_init(params,512,256,prefix="recog",name='lstm3'); # params=LSTM_init(params,256,128,prefix="recog",name='lstm4'); # multiChannel params = ff_init(params, ctxdim, fdim, prefix="recog", name='channel0') # params=ff_init(params,hdim,fdim,prefix="recog",name='channel1'); # params=ff_init(params,512,fdim,prefix="recog",name='channel2'); # params=ff_init(params,256,fdim,prefix="recog",name='channel3'); # params=ff_init(params,128,fdim,prefix="recog",name='channel4'); #output params = ff_init(params, fdim, actionNum, prefix="recog", name='output') tparams = share_params(params) tparams = cnn_init(tparams, cnn_net, prefix='recog', name='cnn') # loading params if need loadfrom = options['loadfrom'] if options['load'] and os.path.exists(loadfrom): print "loading model parameters from ", loadfrom tparams = load_params(loadfrom, tparams, strict=False) return tparams
def init_params(options): featureMaps=options['featureMaps']; actionNum=options['actions']; fdim=options['fdim']; params=OrderedDict(); params=ff_init(params,featureMaps,fdim,prefix="recog",name='fc0'); params=ff_init(params,fdim,fdim,prefix="recog",name='fc1'); #output params=ff_init(params,fdim,actionNum,prefix="recog",name='output'); tparams=share_params(params); tparams=lasagne_net_init(tparams,CNN_NET,CNN_outputLayerName,prefix='recog',name='cnn'); # loading params if need loadfrom=options['loadfrom']; if options['load'] and os.path.exists(loadfrom): print "loading model parameters from ",loadfrom; tparams = load_params(loadfrom, tparams,strict=False); return tparams
import time from block.layer import LSTM_init,LSTM_layer,ff_init,ff_build,dropout_layer,Saliency_init,Saliency_Layer from util import load_params,share_params,unzip,itemlist def init_params(options): ctxdim=options['featureMaps']; hdim=options['hdim']; actionNum=options['actions']; fdim=options['fdim']; params=OrderedDict(); params=Saliency_init(params,ctxdim,prefix="recog"); params=LSTM_init(params,ctxdim,hdim,prefix="recog",name='lstm'); params=ff_init(params,hdim,fdim,prefix="recog",name='fullconn'); params=ff_init(params,fdim,actionNum,prefix="recog",name='output'); tparams=share_params(params); # loading params if need loadfrom=options['loadfrom']; if options['load'] and os.path.exists(loadfrom): print "loading model parameters from ",loadfrom; tparams = load_params(loadfrom, tparams,strict=False); return tparams def build_model(options,tparams): """Build up the whole computation graph Input is the features extracted from googleNet.