def get_backend(backend):
    if backend == "tensorflow":
        from backend_tf import BackendTensorflow
        backend = BackendTensorflow()
    elif backend == "onnxruntime":
        from backend_onnxruntime import BackendOnnxruntime
        backend = BackendOnnxruntime()
    elif backend == "null":
        from backend_null import BackendNull
        backend = BackendNull()
    elif backend == "pytorch":
        from backend_pytorch import BackendPytorch
        backend = BackendPytorch()
    elif backend == "pytorch-native":
        from backend_pytorch_native import BackendPytorchNative
        backend = BackendPytorchNative()      
    elif backend == "tflite":
        from backend_tflite import BackendTflite
        backend = BackendTflite()
    elif backend == "tflite-calibrate":
        from backend_tflite_calibrate import BackendTflite
        backend = BackendTflite()
    elif backend == "tflite-ncore":
        from backend_tflite_ncore import BackendTfliteNcore
        backend = BackendTfliteNcore()
    elif backend == "tflite-ncore-offline-imagenet":
        from backend_tflite_ncore_offline_imagenet import BackendTfliteNcoreOfflineImagenet
        backend = BackendTfliteNcoreOfflineImagenet()
    elif backend == "tflite-ncore-offline-ssd":
        from backend_tflite_ncore_offline_ssd import BackendTfliteNcoreOfflineSSD
        backend = BackendTfliteNcoreOfflineSSD()
    else:
        raise ValueError("unknown backend: " + backend)
    return backend
예제 #2
0
파일: main.py 프로젝트: prime91/inference
def get_backend(backend):
    if backend == "tensorflow":
        from backend_tf import BackendTensorflow
        backend = BackendTensorflow()
    elif backend == "onnxruntime":
        from backend_onnxruntime import BackendOnnxruntime
        backend = BackendOnnxruntime()
    elif backend == "null":
        from backend_null import BackendNull
        backend = BackendNull()
    elif backend == "pytorch":
        from backend_pytorch import BackendPytorch
        backend = BackendPytorch()
    elif backend == "pytorch-native":
        from backend_pytorch_native import BackendPytorchNative
        backend = BackendPytorchNative()
    elif backend == "tflite":
        from backend_tflite import BackendTflite
        backend = BackendTflite()
    elif backend == "tvm":
        from backend_tvm import BackendTvm
        backend = BackendTvm()
    else:
        raise ValueError("unknown backend: " + backend)
    return backend
def get_backend(backend):
    if backend == "tensorflow":
        from backend_tf import BackendTensorflow
        backend = BackendTensorflow()
    elif backend == "onnxruntime":
        from backend_onnxruntime import BackendOnnxruntime
        backend = BackendOnnxruntime()
    elif backend == "null":
        from backend_null import BackendNull
        backend = BackendNull()
    elif backend == "pytorch":
        from backend_pytorch import BackendPytorch
        backend = BackendPytorch()
    elif backend == "pytorch-native":
        from backend_pytorch_native import BackendPytorchNative
        backend = BackendPytorchNative()
    elif backend == "pytorch-centaur":
        from backend_pytorch_centaur import BackendPytorchCentaur
        backend = BackendPytorchCentaur()
    elif backend == "pytorch-native-calibrate":
        from backend_pytorch_native_calibrate import BackendPytorchNativeCalibrate
        backend = BackendPytorchNativeCalibrate()
    elif backend == "tflite":
        from backend_tflite import BackendTflite
        backend = BackendTflite()
    elif backend == "tflite-calibrate":
        from backend_tflite_calibrate import BackendTflite
        backend = BackendTflite()
    elif backend == "tflite-ncore":
        from backend_tflite_ncore import BackendTfliteNcore
        backend = BackendTfliteNcore()
    elif backend == "tflite-ncore-mobilenet":
        from backend_libncoretflite import BackendTfliteNcoreMobileNetV1
        backend = BackendTfliteNcoreMobileNetV1()
        backend.inputs = ["image_tensor:0"]
    elif backend == "tflite-ncore-resnet":
        from backend_libncoretflite import BackendTfliteNcoreResnet
        backend = BackendTfliteNcoreResnet()
        backend.inputs = ["image_tensor:0"]
    elif backend == "tflite-ncore-ssd":
        from backend_libncoretflite import BackendTfliteNcoreSSD
        backend = BackendTfliteNcoreSSD()
        backend.inputs = ["image_tensor:0"]
    elif backend == "tflite-ncore-mobilenet-offline":
        from backend_libncoretflite import BackendTfliteNcoreMobileNetV1Offline
        backend = BackendTfliteNcoreMobileNetV1Offline()
        backend.inputs = ["image_tensor:0"]
    elif backend == "tflite-ncore-resnet-offline":
        from backend_libncoretflite import BackendTfliteNcoreResnetOffline
        backend = BackendTfliteNcoreResnetOffline()
        backend.inputs = ["image_tensor:0"]
    elif backend == "tflite-ncore-ssd-offline":
        from backend_libncoretflite import BackendTfliteNcoreSSDOffline
        backend = BackendTfliteNcoreSSDOffline()
        backend.inputs = ["image_tensor:0"]
    else:
        raise ValueError("unknown backend: " + backend)
    return backend
예제 #4
0
def get_backend(backend, dataset_path, dataset_calibration_list):
    if backend == "tensorflow":
        from backend_tf import BackendTensorflow
        backend = BackendTensorflow()
    elif backend == "onnxruntime":
        from backend_onnxruntime import BackendOnnxruntime
        backend = BackendOnnxruntime()
    elif backend == "null":
        from backend_null import BackendNull
        backend = BackendNull()
    elif backend == "pytorch":
        from backend_pytorch import BackendPytorch
        backend = BackendPytorch()
    elif backend == "pytorch-native":
        from backend_pytorch_native import BackendPytorchNative
        backend = BackendPytorchNative()
    elif backend == "pytorch-jit-traced":
        from backend_pytorch_jit_traced import BackendPytorchJITTraced
        backend = BackendPytorchJITTraced()
    elif backend == "pytorch-fp32":
        from backend_pytorch_fp32 import BackendPytorchFP32
        backend = BackendPytorchFP32()
    elif backend == "pytorch-ssd-jit-traced":
        from backend_pytorch_ssd_jit_traced import BackendPytorchSSDJITTraced
        backend = BackendPytorchSSDJITTraced()
    elif backend == "pytorch-yolov3-jit-traced":
        from backend_pytorch_yolov3_jit_traced import BackendPytorchYOLOv3JITTraced
        backend = BackendPytorchYOLOv3JITTraced()
    elif backend == "pytorch-yolov3-fp32":
        from backend_pytorch_yolov3_fp32 import BackendPytorchYOLOv3FP32
        backend = BackendPytorchYOLOv3FP32()
    elif backend == "tflite":
        from backend_tflite import BackendTflite
        backend = BackendTflite()
    elif backend == "edgecortix":
        from backend_edgecortix import BackendEdgecortix
        backend = BackendEdgecortix(dataset_path, dataset_calibration_list)
    else:
        raise ValueError("unknown backend: " + backend)
    return backend