Vision Processor(多硬件图像处理库)#

fastdeploy.vision.common.manager.PyProcessorManager#

class fastdeploy.vision.common.manager.PyProcessorManager[source]#

PyProcessorManager is used to define a customized processor in python

use_cuda(enable_cv_cuda=False, gpu_id=-1)[source]#

Use CUDA processors

Param

enable_cv_cuda: Ture: use CV-CUDA, False: use CUDA only

Param

gpu_id: GPU device id

fastdeploy.vision.common.processors.Processor#

class fastdeploy.vision.common.processors.Processor[source]#

fastdeploy.vision.common.processors.ResizeByShort#

class fastdeploy.vision.common.processors.ResizeByShort(target_size: int, interp=1, use_scale=True, max_hw=[])[source]#

Create a ResizeByShort operation with the given parameters.

Parameters
  • target_size – The target short size to resize the image

  • interp – Optionally, the interpolation mode for resizing image

  • use_scale – Optionally, whether to scale image

  • max_hw – Max spatial size which is used by ResizeByShort

fastdeploy.vision.common.processors.Resize#

class fastdeploy.vision.common.processors.Resize(width, height, scale_w=-1.0, scale_h=-1.0, interp=1, use_scale=False)[source]#

Create a Resize operation with the given parameters.

Parameters
  • width – Desired width of the output image

  • height – Desired height of the output image

  • scale_w – Scales the width in x-direction

  • scale_h – Scales the height in y-direction

  • interp – Optionally, the interpolation mode for resizing image

  • use_scale – Optionally, whether to scale image

fastdeploy.vision.common.processors.CenterCrop#

class fastdeploy.vision.common.processors.CenterCrop(width, height)[source]#

Create a CenterCrop operation with the given parameters.

Parameters
  • width – Desired width of the cropped image

  • height – Desired height of the cropped image

fastdeploy.vision.common.processors.Cast#

class fastdeploy.vision.common.processors.Cast(dtype='float')[source]#

Creat a new cast opereaton with given dtype

Parameters

dtype – Target dtype of the output

fastdeploy.vision.common.processors.HWC2CHW#

class fastdeploy.vision.common.processors.HWC2CHW[source]#

Creat a new hwc2chw processor with default dtype.

:return An instance of processor HWC2CHW

fastdeploy.vision.common.processors.Normalize#

class fastdeploy.vision.common.processors.Normalize(mean, std, is_scale=True, min=[], max=[], swap_rb=False)[source]#

Creat a new normalize opereator with given paremeters.

Parameters
  • mean – A list containing the mean of each channel

  • std – A list containing the standard deviation of each channel

  • is_scale – Specifies if the image are being scaled or not

  • min – A list containing the minimum value of each channel

  • max – A list containing the maximum value of each channel

fastdeploy.vision.common.processors.NormalizeAndPermute#

class fastdeploy.vision.common.processors.NormalizeAndPermute(mean=[], std=[], is_scale=True, min=[], max=[], swap_rb=False)[source]#

Creae a Normalize and a Permute operation with the given parameters.

Parameters
  • mean – A list containing the mean of each channel

  • std – A list containing the standard deviation of each channel

  • is_scale – Specifies if the image are being scaled or not

  • min – A list containing the minimum value of each channel

  • max – A list containing the maximum value of each channel

fastdeploy.vision.common.processors.Pad#

class fastdeploy.vision.common.processors.Pad(top: int, bottom: int, left: int, right: int, value=[])[source]#

Create a Pad operation with the given parameters.

Parameters
  • top – The top padding

  • bottom – The bottom padding

  • left – The left padding

  • right – The right padding

  • value – the value that is used to pad on the input image

fastdeploy.vision.common.processors.PadToSize#

class fastdeploy.vision.common.processors.PadToSize(width, height, value=[])[source]#

Create a new PadToSize opereator with given parameters.

Parameters
  • width – Desired width of the output image

  • height – Desired height of the output image

  • value – Values to pad with

fastdeploy.vision.common.processors.StridePad#

class fastdeploy.vision.common.processors.StridePad(stride, value=[])[source]#

Create a StridePad processor with given parameters.

Parameters
  • stride – Stride of the processor

  • value – Values to pad with