neuropod
v0.3.0-rc7
Neuropod是一個庫,它提供了一個統一的界面,可以從C ++和Python中的多個框架運行深度學習模型。 Neuropod使研究人員可以輕鬆地在選擇的框架中構建模型,同時簡化這些模型的生產。
目前,它支持Tensorflow,Pytorch,Torchscript,Keras和Ludwig。
有關更多信息:
運行TensorFlow模型看起來完全像運行Pytorch模型。
x = np . array ([ 1 , 2 , 3 , 4 ])
y = np . array ([ 5 , 6 , 7 , 8 ])
for model_path in [ TF_ADDITION_MODEL_PATH , PYTORCH_ADDITION_MODEL_PATH ]:
# Load the model
neuropod = load_neuropod ( model_path )
# Run inference
results = neuropod . infer ({ "x" : x , "y" : y })
# array([6, 8, 10, 12])
print results [ "out" ]有關更多示例,請參見教程,Python指南或C ++指南。
其中一些好處包括:
任何神經模型模型都可以從C ++和Python(甚至尚未轉換為Torchscript的Pytorch模型)運行。
這使您可以更多地關注要解決的問題,而不是要解決問題的框架。
例如,如果您為2D對象檢測定義問題API,則任何實現該問題的模型都可以重用所有現有的推理代碼和基礎架構解決該問題。
INPUT_SPEC = [
# BGR image
{ "name" : "image" , "dtype" : "uint8" , "shape" : ( 1200 , 1920 , 3 )},
]
OUTPUT_SPEC = [
# shape: (num_detections, 4): (xmin, ymin, xmax, ymax)
# These values are in units of pixels. The origin is the top left corner
# with positive X to the right and positive Y towards the bottom of the image
{ "name" : "boxes" , "dtype" : "float32" , "shape" : ( "num_detections" , 4 )},
# The list of classes that the network can output
# This must be some subset of ['vehicle', 'person', 'motorcycle', 'bicycle']
{ "name" : "supported_object_classes" , "dtype" : "string" , "shape" : ( "num_classes" ,)},
# The probability of each class for each detection
# These should all be floats between 0 and 1
{ "name" : "object_class_probability" , "dtype" : "float32" , "shape" : ( "num_detections" , "num_classes" )},
]這讓你
有關更多詳細信息,請參見教程。
如果您有幾個模型可以採用類似的輸入,則可以構建和優化一個框架 - 不合時宜的輸入生成管道,並在跨模型中共享。
完全獨立的模型(包括自定義操作)
有效的零拷貝操作
在包括的平台上測試
模型隔離,並進行執行不足
通過一行代碼從運行過程中切換到程序外運行
有關如何開始使用Neuropod的概述,請參見基本簡介教程。
Python Guide和C ++指南有關運行Neuropod模型的更多詳細信息。