feat: Added cli features for mnn and ort
This commit is contained in:
@@ -1,11 +1,10 @@
|
||||
use crate::errors::*;
|
||||
use crate::facedet::*;
|
||||
use crate::ort_ep::*;
|
||||
use error_stack::ResultExt;
|
||||
use ndarray_resize::NdFir;
|
||||
use ort::{
|
||||
execution_providers::{
|
||||
CPUExecutionProvider, CoreMLExecutionProvider, ExecutionProviderDispatch,
|
||||
},
|
||||
execution_providers::{CPUExecutionProvider, ExecutionProviderDispatch},
|
||||
session::{Session, builder::GraphOptimizationLevel},
|
||||
value::Tensor,
|
||||
};
|
||||
@@ -33,18 +32,11 @@ impl FaceDetectionBuilder {
|
||||
})
|
||||
}
|
||||
|
||||
pub fn with_execution_providers(mut self, providers: Vec<String>) -> Self {
|
||||
pub fn with_execution_providers(mut self, providers: impl AsRef<[ExecutionProvider]>) -> Self {
|
||||
let execution_providers: Vec<ExecutionProviderDispatch> = providers
|
||||
.into_iter()
|
||||
.filter_map(|provider| match provider.as_str() {
|
||||
"cpu" | "CPU" => Some(CPUExecutionProvider::default().build()),
|
||||
#[cfg(target_os = "macos")]
|
||||
"coreml" | "CoreML" => Some(CoreMLExecutionProvider::default().build()),
|
||||
_ => {
|
||||
tracing::warn!("Unknown execution provider: {}", provider);
|
||||
None
|
||||
}
|
||||
})
|
||||
.as_ref()
|
||||
.iter()
|
||||
.filter_map(|provider| provider.to_dispatch())
|
||||
.collect();
|
||||
|
||||
if !execution_providers.is_empty() {
|
||||
|
||||
Reference in New Issue
Block a user