Пример #1
0
def getIterFromSolverstate(solverstate):
    """ Parse the iterations from the solverstate file.
    """
    from backend.caffe.path_loader import PathLoader
    proto = PathLoader().importProto()
    try:
        state = proto.SolverState()

        with open(solverstate, 'rb') as f:
            state.ParseFromString(f.read())
            return state.iter
    except Exception as e:
        print(str(e))
Пример #2
0
def getCaffemodelFromSolverstate(solverstate):
    """ Parse the filename of the caffemodel file from the solverstate file.
    """
    from backend.caffe.path_loader import PathLoader
    proto = PathLoader().importProto()
    try:
        state = proto.SolverState()

        with open(solverstate, 'rb') as f:
            state.ParseFromString(f.read())
            return state.learned_net
    except Exception as e:
        print(str(e))