Skip to content

Commit

Permalink
onnx uihh
Browse files Browse the repository at this point in the history
  • Loading branch information
heabeounMKTO committed Apr 24, 2024
1 parent feb3bea commit 9e1075a
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 6 deletions.
16 changes: 11 additions & 5 deletions examples/onnx_infv9.rs
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
extern crate kesa;
use kesa::backends::compute_backends::ComputeBackendType;
use kesa::backends::onnx_backend::{init_onnx_backend, load_onnx_model};
use anyhow::{Result, Error};
use clap::{ArgAction, Parser,Args };
use clap::Parser;
use kesa::backends::compute_backends::InferenceModel;
use kesa::fileutils::get_all_images;

use kesa::fileutils::open_image;
use ort::Tensor;

#[derive(Parser, Debug)]
struct CliArguments {
Expand All @@ -22,7 +23,12 @@ fn main() -> Result<(), Error> {


let _init = init_onnx_backend()?;
let load_model = load_onnx_model(&args.weights, all_imgs[0].to_owned().to_str().unwrap(), false, None);
println!("LOADED MODEL : {:#?}", load_model);
let load_model = load_onnx_model(&args.weights, all_imgs[0].to_owned().to_str().unwrap(), false, None)?;
let orig_img = open_image(&all_imgs[0])?;
let mut _r = load_model.run(orig_img)?;
_r.data.swap_axes(2,1);
let _tnsr = Tensor::try_from(_r.data)?;
_tnsr.view();
println!("LOADED MODEL : {:#?}",_tnsr.shape());
Ok(())
}
2 changes: 1 addition & 1 deletion src/label.rs
Original file line number Diff line number Diff line change
Expand Up @@ -398,7 +398,7 @@ pub enum CoordinateType {
// not sure where to put these, just leaving it here for now :|
#[derive(Debug, Clone)]
pub struct Embeddings {
data: ArrayBase<OwnedRepr<f32>, Dim<IxDynImpl>>,
pub data: ArrayBase<OwnedRepr<f32>, Dim<IxDynImpl>>,
}
impl Embeddings {
pub fn new(data: ArrayBase<OwnedRepr<f32>, Dim<IxDynImpl>>) -> Self {
Expand Down

0 comments on commit 9e1075a

Please sign in to comment.