Skip to content

Instantly share code, notes, and snippets.

View hzxie's full-sized avatar

Haozhe Xie hzxie

View GitHub Profile
@gVallverdu
gVallverdu / plot_cmap.py
Last active November 10, 2018 11:10
A convenient function to show a matplotlib color map
import matplotlib.pyplot as plt
def plot_cmap(cmap, ncolor):
"""
A convenient function to plot colors of a matplotlib cmap
Args:
ncolor (int): number of color to show
cmap: a cmap object or a matplotlib color name
"""
@kaushikpavani
kaushikpavani / compute_caffe_parameters.py
Created September 25, 2016 14:14
Calculate number of parameters in a Caffe model
import caffe
caffe.set_mode_cpu()
import numpy as np
from numpy import prod, sum
from pprint import pprint
def print_net_parameters (deploy_file):
print "Net: " + deploy_file
net = caffe.Net(deploy_file, caffe.TEST)
print "Layer-wise parameters: "