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))
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))