项目作者: StacyYang

项目描述 :
torch data augmentation toolbox (supports affine transform)
高级语言: C
项目地址: git://github.com/StacyYang/HzProc.git
创建时间: 2016-09-13T17:59:59Z
项目社区:https://github.com/StacyYang/HzProc

开源协议:

下载


HzProc

Created by Hang Zhang

HzProc is a fast data augmentation toolbox supporting affine transformation with GPU backend. (PyTorch version is also provide.) The name of “HzProc” means high speed image processing, where “Hz” (hertz)
is the unit of frequency and “Proc” is abbreviation of processing. HZ is also the initial of the author.

It contains the functions within the following subcategories:

Quick Start Example

Install

This package relies on torch7 and
cutorch. Please note the package
also relies on a NVIDIA GPU compitable with CUDA 6.5 or higher version.

On Linux

  1. luarocks install https://raw.githubusercontent.com/zhanghang1989/hzproc/master/hzproc-scm-1.rockspec

On OSX

  1. CC=clang CXX=clang++ luarocks install https://raw.githubusercontent.com/zhanghang1989/hzproc/master/hzproc-scm-1.rockspec

Quick Demo

Demo The demo script relies on qtlua and
image package to load and display
the images. The test script is also a good usage example.
The documentations can be found in the link.

  1. git clone https://github.com/zhanghang1989/hzproc
  2. cd hzproc
  3. qlua test/demo.lua

Fast Examples

  • online example:
    1. function RandomCrop(size, pad)
    2. return function(input)
    3. -- avoid unnecessary opterations
    4. local w, h = input:size(3), input:size(2)
    5. if w == size and h == size then
    6. return input
    7. end
    8. local x1, y1 = torch.random(0, w + 2*pad - size),
    9. torch.random(0, h + 2*pad - size)
    10. local out = hzproc.Crop.Pad(input, x1, y1, size, size, pad)
    11. assert(out:size(2) == size and out:size(3) == size, 'wrong crop size')
    12. return out
    13. end
    14. end
  • offline example:
    ```lua
    function Resize(inw, inh, ow, oh)
    — generating the lookup map only once during init
    local map = hzproc.Table.Resize(inw, inh, ow, oh)
    return function(input)
    1. -- avoid unnecessary opterations
    2. local w, h = input:size(3), input:size(2)
    if (w == ow and h == oh) then
    1. return input
    end
    1. -- mapping
    2. return hzproc.Remap.Bilinear(input, map)
    end
    end

```