Skip to main content

BBoxTypeTrait

Trait BBoxTypeTrait 

Source
pub trait BBoxTypeTrait {
    // Required methods
    fn to_xyxy_float<A: Float + 'static, B: AsPrimitive<A>>(
        input: &[B; 4],
    ) -> [A; 4];
    fn to_xyxy_dequant<A: Float + 'static, B: AsPrimitive<A>>(
        input: &[B; 4],
        quant: Quantization,
    ) -> [A; 4]
       where f32: AsPrimitive<A>,
             i32: AsPrimitive<A>;

    // Provided methods
    fn ndarray_to_xyxy_float<A: Float + 'static, B: AsPrimitive<A>>(
        input: ArrayView1<'_, B>,
    ) -> [A; 4] { ... }
    fn ndarray_to_xyxy_dequant<A: Float + 'static, B: AsPrimitive<A>>(
        input: ArrayView1<'_, B>,
        quant: Quantization,
    ) -> [A; 4]
       where f32: AsPrimitive<A>,
             i32: AsPrimitive<A> { ... }
}
Expand description

Trait to convert bounding box formats to XYXY float format

Required Methods§

Source

fn to_xyxy_float<A: Float + 'static, B: AsPrimitive<A>>( input: &[B; 4], ) -> [A; 4]

Converts the bbox into XYXY float format.

Source

fn to_xyxy_dequant<A: Float + 'static, B: AsPrimitive<A>>( input: &[B; 4], quant: Quantization, ) -> [A; 4]
where f32: AsPrimitive<A>, i32: AsPrimitive<A>,

Converts the bbox into XYXY float format.

Provided Methods§

Source

fn ndarray_to_xyxy_float<A: Float + 'static, B: AsPrimitive<A>>( input: ArrayView1<'_, B>, ) -> [A; 4]

Converts the bbox into XYXY float format.

§Examples
let arr = array![10.0_f32, 20.0, 20.0, 20.0];
let xyxy: [f32; 4] = XYWH::ndarray_to_xyxy_float(arr.view());
assert_eq!(xyxy, [0.0_f32, 10.0, 20.0, 30.0]);
Source

fn ndarray_to_xyxy_dequant<A: Float + 'static, B: AsPrimitive<A>>( input: ArrayView1<'_, B>, quant: Quantization, ) -> [A; 4]
where f32: AsPrimitive<A>, i32: AsPrimitive<A>,

Converts the bbox into XYXY float format.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementors§