资源算法torchvision-transforms-based-on-opencv

torchvision-transforms-based-on-opencv

2020-01-07 | |  207 |   0 |   0

cvtorch: Utilities for pytroch based on opencv

This repository is intended to offer some common augmentataion functions in computer vision task base on opencv. The functions' prototype comes from FAIR's maskrcnn-benchmark. I tried my best to implement these functions strictly follow the details of torchvision and pillow. Any discussions are welcomed.

Modules

  • cvtorch.cvBox.BoxList
    This is a handy structure in object detection implemented by FAIR. original code

  • cvtorch.cvTransforms.Compose
    Compose a series of transforms to an opencv image (numpy ndarray in BGR order) and cvBox target

  • cvtorch.cvTransforms.Resize
    Resize an opencv image and target. target is optional.

  • cvtorch.cvTransforms.RandomHorizontalFlip
    random horizontally filp an opencv image and target. target is optional.

  • cvtorch.cvTransforms.RandomVerticalFlip
    random vertically filp an opencv image and target. target is optional.

  • cvtorch.cvTransforms.ColorJitter
    randomly jit brightness, contrast, saturation, hue of an opencv image and targe. target is optional.

  • cvtorch.cvFunctional.ColorJitter
    randomly jit brightness, contrast, saturation, hue of an opencv image.

  • cvtorch.cvTransforms.ToTensor
    convert an opencv image to tensor. (follow torchvision with transpose).

  • cvtorch.cvTransforms.NormalizeAsNumpy
    Normalize an opencv image.

  • cvtorch.cvTransforms.NormalizeAsTorch
    Normalize a tensor image.

Eg

from cvtorch import cvTransforms as T

normalize_transform = T.NormalizeAsTorch(mean, std)
color_jitter = T.ColorJitter(brightness, contrast, saturation, hue)
transforms = T.Compose(
	[
		color_jitter,
		T.Resize(min_size, max_size),
		T.RandomHorizontalFlip(0.5),
		T.RandomVerticalFlip(0.5),
		T.ToTensor(),
		normalize_transform,
	]
)

Functions

  • cvtorch.cvFunctional.adjust_brightness

  • cvtorch.cvFunctional.adjust_contrast

  • cvtorch.cvFunctional.adjust_hue

  • cvtorch.cvFunctional.adjust_saturation

installation

pip install cvtorch


上一篇:opencv_transforms_torchvision

下一篇:magnetW

用户评价
全部评价

热门资源

  • Keras-ResNeXt

    Keras ResNeXt Implementation of ResNeXt models...

  • seetafaceJNI

    项目介绍 基于中科院seetaface2进行封装的JAVA...

  • spark-corenlp

    This package wraps Stanford CoreNLP annotators ...

  • capsnet-with-caps...

    CapsNet with capsule-wise convolution Project ...

  • inferno-boilerplate

    This is a very basic boilerplate example for pe...