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


Python caffe.log方法代碼示例

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


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

示例1: train

# 需要導入模塊: import caffe [as 別名]
# 或者: from caffe import log [as 別名]
def train(
        solver,  # solver proto definition
        snapshot,  # solver snapshot to restore
        gpus,  # list of device ids
        timing=False,  # show timing info for compute and communications
):
    # NCCL uses a uid to identify a session
    uid = caffe.NCCL.new_uid()

    caffe.init_log()
    caffe.log('Using devices %s' % str(gpus))

    procs = []
    for rank in range(len(gpus)):
        p = Process(target=solve_step,
                    args=(solver, snapshot, gpus, timing, uid, rank))
        p.daemon = True
        p.start()
        procs.append(p)
    for p in procs:
        p.join() 
開發者ID:zhujiagang,項目名稱:DTPP,代碼行數:23,代碼來源:multigpu.py

示例2: train_net_multi_gpu

# 需要導入模塊: import caffe [as 別名]
# 或者: from caffe import log [as 別名]
def train_net_multi_gpu(solver_prototxt, roidb, output_dir, pretrained_model,
                        max_iter, gpus, reload):
    """Train a Fast R-CNN network."""
    roidb = filter_roidb(roidb)
    uid = caffe.NCCL.new_uid()
    caffe.init_log()
    caffe.log('Using devices %s' % str(gpus))
    procs = []

    for rank in range(len(gpus)):
        p = Process(target=solve,
                    args=(
                        solver_prototxt, roidb, pretrained_model, gpus, uid,
                        rank,
                        output_dir, max_iter, reload))
        p.daemon = True
        p.start()
        procs.append(p)
    for p in procs:
        p.join() 
開發者ID:po0ya,項目名稱:face-magnet,代碼行數:22,代碼來源:train_multi_gpu.py

示例3: train

# 需要導入模塊: import caffe [as 別名]
# 或者: from caffe import log [as 別名]
def train(
        solver,  # solver proto definition
        snapshot,  # solver snapshot to restore
        gpus,  # list of device ids
        timing=False,  # show timing info for compute and communications
):
    # NCCL uses a uid to identify a session
    uid = caffe.NCCL.new_uid()

    caffe.init_log()
    caffe.log('Using devices %s' % str(gpus))

    procs = []
    for rank in range(len(gpus)):
        p = Process(target=solve,
                    args=(solver, snapshot, gpus, timing, uid, rank))
        p.daemon = True
        p.start()
        procs.append(p)
    for p in procs:
        p.join() 
開發者ID:QinganZhao,項目名稱:Deep-Learning-Based-Structural-Damage-Detection,代碼行數:23,代碼來源:train.py

示例4: time

# 需要導入模塊: import caffe [as 別名]
# 或者: from caffe import log [as 別名]
def time(solver, nccl):
    fprop = []
    bprop = []
    total = caffe.Timer()
    allrd = caffe.Timer()
    for _ in range(len(solver.net.layers)):
        fprop.append(caffe.Timer())
        bprop.append(caffe.Timer())
    display = solver.param.display

    def show_time():
        if solver.iter % display == 0:
            s = '\n'
            for i in range(len(solver.net.layers)):
                s += 'forw %3d %8s ' % (i, solver.net._layer_names[i])
                s += ': %.2f\n' % fprop[i].ms
            for i in range(len(solver.net.layers) - 1, -1, -1):
                s += 'back %3d %8s ' % (i, solver.net._layer_names[i])
                s += ': %.2f\n' % bprop[i].ms
            s += 'solver total: %.2f\n' % total.ms
            s += 'allreduce: %.2f\n' % allrd.ms
            caffe.log(s)

    solver.net.before_forward(lambda layer: fprop[layer].start())
    solver.net.after_forward(lambda layer: fprop[layer].stop())
    solver.net.before_backward(lambda layer: bprop[layer].start())
    solver.net.after_backward(lambda layer: bprop[layer].stop())
    solver.add_callback(lambda: total.start(), lambda: (total.stop(), allrd.start()))
    solver.add_callback(nccl)
    solver.add_callback(lambda: '', lambda: (allrd.stop(), show_time())) 
開發者ID:zhujiagang,項目名稱:DTPP,代碼行數:32,代碼來源:multigpu.py

示例5: train

# 需要導入模塊: import caffe [as 別名]
# 或者: from caffe import log [as 別名]
def train(
        solver,  # solver proto definition
        snapshot,  # solver snapshot to restore
        use_cpu, #whether use cpu
        gpus,  # list of device ids
        timing=False,  # show timing info for compute and communications
):
    caffe.init_log(0,True)
    caffe.log('Using devices %s' % str(gpus))

    if use_cpu == True:
        p = Process(target=cpu_solve,
                    args=(solver, snapshot, timing))

        p.daemon = True
        p.start()
        p.join()
    else:
        # NCCL uses a uid to identify a session
        uid = caffe.NCCL.new_uid()

        procs = []
        for rank in range(len(gpus)):
            p = Process(target=solve,
                        args=(solver, snapshot, gpus, timing, uid, rank))
            p.daemon = True
            p.start()
            procs.append(p)
        for p in procs:
            p.join() 
開發者ID:ucloud,項目名稱:uai-sdk,代碼行數:32,代碼來源:train_large_file.py


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