Created
April 9, 2014 14:20
-
-
Save madmaze/10276028 to your computer and use it in GitHub Desktop.
pyGASP simple benchmark
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import numpy as np | |
import scipy.misc | |
import pylab | |
from PIL import Image | |
from datetime import datetime as dt | |
import pywt | |
import pygasp.dwt.dwt as pygaspDWT | |
import pygasp.dwt.dwtCuda as pygaspDWTgpu | |
def show(data): | |
pylab.jet() | |
pylab.imshow(data) | |
pylab.colorbar() | |
pylab.show() | |
pylab.clf() | |
# Lets get an image to play with. | |
#img = scipy.misc.lena().astype(np.float32) | |
imgObj = Image.open("largeTest.jpg") | |
img = np.array(imgObj) | |
print img.shape | |
# pywt | |
s = dt.now() | |
res_pywt = pywt.dwt2(img, "haar", "zpd") | |
print "pywt took:", dt.now()-s | |
# pygasp CPU version | |
s = dt.now() | |
res_gasp = pygaspDWT.dwt2(img, "haar", "zpd") | |
print "pygaspCPU took:", dt.now()-s | |
# pygasp GPU version | |
s = dt.now() | |
res_gaspGPU = pygaspDWTgpu.dwt2(img, "haar", "zpd") | |
print "pygaspGPU took:", dt.now()-s | |
#show(res_pywt[0]) | |
#show(res_gasp[0]) | |
#show(res_gaspGPU[0]-res_gasp[0]) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment