Giter Site home page Giter Site logo

hzproc's Introduction

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

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

On OSX

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.

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

Fast Examples

  • online example:
function RandomCrop(size, pad)
  return function(input)
		-- avoid unnecessary opterations
    local w, h = input:size(3), input:size(2)
    if w == size and h == size then
      return input
    end
    local x1, y1 = torch.random(0, w + 2*pad - size), 
									torch.random(0, h + 2*pad - size)
    local out = hzproc.Crop.Pad(input, x1, y1, size, size, pad)
    assert(out:size(2) == size and out:size(3) == size, 'wrong crop size')
    return out
  end
end
  • offline example:
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)
		-- avoid unnecessary opterations
	  local w, h = input:size(3), input:size(2)
    if (w == ow and h == oh) then
      return input
    end	
		-- mapping
		return hzproc.Remap.Bilinear(input, map)
  end
end

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.