Skip to content

Instantly share code, notes, and snippets.

View chih-chun-chang's full-sized avatar

Chih-Chun Chang chih-chun-chang

  • Department of ECE, University of Wisconsin-Madison
  • Madison, Wisconsin
View GitHub Profile
@chih-chun-chang
chih-chun-chang / cudaPinnedMemoryAllocator.cu
Created November 10, 2024 02:42
cuda pinned memory allocator for std::vector
#include <cuda_runtime.h>
// how to use?
// std::vector<float, CudaHostAllocator<float>> vec;
template <typename T>
class CudaHostAllocator {
public:
using value_type = T;
Download Google Drive files with WGET
Example Google Drive download link:
https://docs.google.com/open?id=[ID]
To download the file with WGET you need to use this link:
https://googledrive.com/host/[ID]
Example WGET command:
@chih-chun-chang
chih-chun-chang / pca.py
Created June 3, 2018 10:20
PCA (Data Augmentation) with Scikit-Image
import numpy as np
from skimage import io, transform
# Using one image
image_filenames = 'image.jpg'
# Read the image
image = io.imread(images_filenames)
# Resize image (256 x 256 x 3) and turn the image matrix of m x n x 3 to lists of rgb