feat(ocr,det,slide): 重构项目结构
- 优化 规范化模型目录 - 重构 Ocr,Detector,Slide 拆分规范化
This commit is contained in:
@@ -1,15 +1,10 @@
|
||||
use crate::models::ocr::model_metadata::ModelMetadata;
|
||||
use crate::models::loader::{ModelLoader, ModelSession, ModelType};
|
||||
use anyhow::{Context, Result, anyhow};
|
||||
use image::{DynamicImage, GenericImageView, imageops::FilterType};
|
||||
use std::path::Path;
|
||||
use tract_onnx::prelude::tract_ndarray::{Array2, Array3, Array4, Axis, prelude::*, s};
|
||||
use tract_onnx::prelude::{Graph, RunnableModel, Tensor, TypedFact, TypedOp, tvec};
|
||||
use anyhow::{Context, Result};
|
||||
use image::{imageops::FilterType, DynamicImage, GenericImageView};
|
||||
use std::fmt;
|
||||
use tract_onnx::prelude::tract_ndarray::{prelude::*, s, Array2, Array3, Array4, Axis};
|
||||
use tract_onnx::prelude::{Tensor};
|
||||
|
||||
const DEFAULT_DET_PATH: &'static str = "common_det.onnx";
|
||||
|
||||
// 预设的提示信息常量
|
||||
use crate::error::MODEL_DOWNLOAD_HELP;
|
||||
use crate::models::det::session::DetSession;
|
||||
|
||||
#[derive(Debug, Clone, Copy)]
|
||||
@@ -22,15 +17,23 @@ pub struct DetectionResult {
|
||||
pub class_id: u32,
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
impl fmt::Display for DetectionResult {
|
||||
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
|
||||
// 结构体只管自己这一行怎么显示,不用管外部的索引 [i]
|
||||
write!(
|
||||
f,
|
||||
"x1={}, y1={}, x2={}, y2={}, 分数={:.4}, 类别ID={}",
|
||||
self.x1, self.y1, self.x2, self.y2, self.score, self.class_id
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
#[derive(Debug)]
|
||||
pub struct Detector<'a> {
|
||||
pub(crate) session: &'a DetSession,
|
||||
#[allow(dead_code)]
|
||||
pub(crate) use_gpu: bool,
|
||||
#[allow(dead_code)]
|
||||
pub(crate) device_id: u8,
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user