本文整理汇总了Python中cntk.__version__方法的典型用法代码示例。如果您正苦于以下问题:Python cntk.__version__方法的具体用法?Python cntk.__version__怎么用?Python cntk.__version__使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类cntk
的用法示例。
在下文中一共展示了cntk.__version__方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: init
# 需要导入模块: import cntk [as 别名]
# 或者: from cntk import __version__ [as 别名]
def init():
try:
print("Executing init() method...")
print("Python version: " + str(sys.version) + ", CNTK version: " + cntk.__version__)
except Exception as e:
print("Exception in init:")
print(str(e))
################
# Main
################
开发者ID:Azure-Samples,项目名称:MachineLearningSamples-ImageClassificationUsingCntk,代码行数:14,代码来源:deploymain.py
示例2: _get_cntk_version
# 需要导入模块: import cntk [as 别名]
# 或者: from cntk import __version__ [as 别名]
def _get_cntk_version():
version = C.__version__
if version.endswith('+'):
version = version[:-1]
# for hot fix, ignore all the . except the first one.
if len(version) > 2 and version[1] == '.':
version = version[:2] + version[2:].replace('.', '')
try:
return float(version)
except:
warnings.warn(
'CNTK backend warning: CNTK version not detected. '
'Will using CNTK 2.0 GA as default.')
return float(2.0)
示例3: _get_cntk_version
# 需要导入模块: import cntk [as 别名]
# 或者: from cntk import __version__ [as 别名]
def _get_cntk_version():
version = C.__version__
if version.endswith('+'):
version = version[:-1]
try:
return float(version)
except:
warnings.warn(
'CNTK backend warning: CNTK version not detected. '
'Will using CNTK 2.0 GA as default.')
return float(2.0)
示例4: run
# 需要导入模块: import cntk [as 别名]
# 或者: from cntk import __version__ [as 别名]
def run(input_df):
try:
print("Python version: " + str(sys.version) + ", CNTK version: " + cntk.__version__)
startTime = dt.datetime.now()
print(str(input_df))
# convert input back to image and save to disk
base64ImgString = input_df['image base64 string'][0]
print(base64ImgString)
pil_img = base64ToPilImg(base64ImgString)
print("pil_img.size: " + str(pil_img.size))
pil_img.save(imgPath, "JPEG")
print("Save pil_img to: " + imgPath)
# Load model (once then keep in memory)
print("Classifier = " + classifier)
makeDirectory(workingDir)
if not os.path.exists(cntkRefinedModelPath):
raise Exception("Model file {} does not exist, likely because the {} classifier has not been trained yet.".format(cntkRefinedModelPath, classifier))
if not ('model' in vars() or 'model' in globals()):
model = load_model(cntkRefinedModelPath)
lutId2Label = readPickle(lutId2LabelPath)
# Run DNN
printDeviceType()
node = getModelNode(classifier)
mapPath = pathJoin(workingDir, "rundnn_map.txt")
dnnOutput = runCntkModelImagePaths(model, [imgPath], mapPath, node, run_mbSize)
# Predicted labels and scores
scoresMatrix = runClassifierOnImagePaths(classifier, dnnOutput, svmPath, svm_boL2Normalize)
scores = scoresMatrix[0]
predScore = np.max(scores)
predLabel = lutId2Label[np.argmax(scores)]
print("Image predicted to be '{}' with score {}.".format(predLabel, predScore))
# Create json-encoded string of the model output
executionTimeMs = (dt.datetime.now() - startTime).microseconds / 1000
outDict = {"label": str(predLabel), "score": str(predScore), "allScores": str(scores),
"Id2Labels": str(lutId2Label), "executionTimeMs": str(executionTimeMs)}
outJsonString = json.dumps(outDict)
print("Json-encoded detections: " + outJsonString[:120] + "...")
print("DONE.")
return(str(outJsonString))
except Exception as e:
return(str(e))
# API initialization method
开发者ID:Azure-Samples,项目名称:MachineLearningSamples-ImageClassificationUsingCntk,代码行数:53,代码来源:deploymain.py