In [24]:
# import pycuda.autoinit
# import pycuda.driver as drv
# import pycuda.gpuarray as ga
# import numpy as np
# from pycuda.compiler import SourceModule
# mod = SourceModule(open("vector_types.cu").read())
# print_coordinates = mod.get_function("print_coordinates")
In [ ]:
# mod = drv.SourceModule(""" <your kernel code here> """)
# func = mod.get_function("<name of your kernel function here>")
# elapsed = func(<your parameters>, time_kernel=True)
In [ ]:
# import pycuda.autoinit
# import pycuda.driver as drv
# import numpy
# import Image
# import time
# import sys, getopt
# import matplotlib.pyplot as plt
# import matplotlib.image as mpimg
# from pycuda.compiler import SourceModule
# start_time=0.0
# def startTimer( funcname, quiet ):
# global start_time
# if not quiet:
# sys.stdout.write(funcname)
# sys.stdout.flush()
# start_time = time.time()
# def stopTimer(quiet):
# elapsed_time = time.time() - start_time
# if not quiet:
# print 'DONE in {0:.3f} seconds.'.format(elapsed_time)
# def loadKernel():
# module = drv.module_from_file("ssgls.ptx")
# glsKernel = module.get_function("doGLS_kernel")
# return module, glsKernel
# startTimer("Load CUDA kernel ........... ", quiet)
# module, glsKernel = loadKernel()
# stopTimer(quiet)
# startTimer("Init Input data ............ ", quiet)
# w, h, normals, positions = initInputData (imgNormPath, imgwcPath)
# stopTimer(quiet)
In [ ]:
# image_slice_red = scaled_image_data[:,:,0]
# image_slice_green = scaled_image_data[:,:,1]
# image_slice_blue = scaled_image_data[:,:,2]
A standard machine learning situation. Train on batches of images and augment each batch via crop, horizontal flip ("Fliplr") and gaussian blur: