當前位置: 首頁>>代碼示例>>Python>>正文


Python caffe.CaffeFunction方法代碼示例

本文整理匯總了Python中chainer.links.caffe.CaffeFunction方法的典型用法代碼示例。如果您正苦於以下問題:Python caffe.CaffeFunction方法的具體用法?Python caffe.CaffeFunction怎麽用?Python caffe.CaffeFunction使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在chainer.links.caffe的用法示例。


在下文中一共展示了caffe.CaffeFunction方法的4個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。

示例1: make_i2v_with_chainer

# 需要導入模塊: from chainer.links import caffe [as 別名]
# 或者: from chainer.links.caffe import CaffeFunction [as 別名]
def make_i2v_with_chainer(param_path, tag_path=None, threshold_path=None):
    # ignore UserWarnings from chainer
    with warnings.catch_warnings():
        warnings.simplefilter('ignore')
        net = CaffeFunction(param_path)

    kwargs = {}
    if tag_path is not None:
        tags = json.loads(open(tag_path, 'r').read())
        assert(len(tags) == 1539)
        kwargs['tags'] = tags

    if threshold_path is not None:
        fscore_threshold = np.load(threshold_path)['threshold']
        kwargs['threshold'] = fscore_threshold

    return ChainerI2V(net, **kwargs) 
開發者ID:rezoo,項目名稱:illustration2vec,代碼行數:19,代碼來源:chainer_i2v.py

示例2: LoadCaffeModel

# 需要導入模塊: from chainer.links import caffe [as 別名]
# 或者: from chainer.links.caffe import CaffeFunction [as 別名]
def LoadCaffeModel(path):
	print("Loading %s"%path)
	root, ext = os.path.splitext(path)
	cachepath = 'cache/'+hashlib.sha224(root.encode('utf-8')).hexdigest()+".pkl"
	if path in __Model_cache:
		print("Cache hit")
		func = __Model_cache[path]
	if os.path.exists(cachepath):
		func = pickle.load(open(cachepath,'rb'))
	else:
		print("Converting from %s"%path)
		#func = caffe.CaffeFunction('misc/'+path)
		func = CaffeFunction('misc/'+path)
		pickle.dump(func, open(cachepath, 'wb'))
	__Model_cache[path]=func
	if Deel.gpu>=0:
		func = func.to_gpu(Deel.gpu)
	return func 
開發者ID:uei,項目名稱:deel,代碼行數:20,代碼來源:__init__.py

示例3: load

# 需要導入模塊: from chainer.links import caffe [as 別名]
# 或者: from chainer.links.caffe import CaffeFunction [as 別名]
def load(self, path):
        root, ext = os.path.splitext(path)
        if ext == '.pkl':
            with open(path, 'rb') as f:
                self.func = pickle.load(f)
        else:
            self.func = caffe.CaffeFunction(path) 
開發者ID:dsanno,項目名稱:chainer-image-caption,代碼行數:9,代碼來源:image_model.py

示例4: init_func

# 需要導入模塊: from chainer.links import caffe [as 別名]
# 或者: from chainer.links.caffe import CaffeFunction [as 別名]
def init_func(self):
        self.func = caffe.CaffeFunction(self.temp_file_path) 
開發者ID:chainer,項目名稱:chainer,代碼行數:4,代碼來源:test_caffe_function.py


注:本文中的chainer.links.caffe.CaffeFunction方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。