Skip to content

Instantly share code, notes, and snippets.

@helxsz
helxsz / models downloads
Created August 15, 2017 03:55
models downloads
#download weights for vgg-f
wget https://www.dropbox.com/s/b96tfz2hnthfegm/vgg_f.npy
#download weights for caffenet
wget https://www.dropbox.com/s/8evo8ydl1jl03z4/caffenet.npy
#download weights for vgg-16
wget https://www.dropbox.com/s/zpeufcwesimhvua/vgg16.npy
#download weights for vgg-19
@helxsz
helxsz / batch_hed.py
Last active August 11, 2017 13:21 — forked from zeakey/hed-caffe-netspec.py
Python script for automatically generating HED(https://github.com/s9xie/hed) network, compatitable with newest caffe(https://github.com/bvlc/caffe)
# HED batch processing script; modified from https://github.com/s9xie/hed/blob/master/examples/hed/HED-tutorial.ipynb
# Step 1: download the hed repo: https://github.com/s9xie/hed
# Step 2: download the models and protoxt, and put them under {caffe_root}/examples/hed/
# Step 3: put this script under {caffe_root}/examples/hed/
# Step 4: run the following script:
# python batch_hed.py --images_dir=/data/to/path/photos/ --hed_mat_dir=/data/to/path/hed_mat_files/
# The code sometimes crashes after computation is done. Error looks like "Check failed: ... driver shutting down". You can just kill the job.
# For large images, it will produce gpu memory issue. Therefore, you better resize the images before running this script.
# Step 5: run the MATLAB post-processing script "PostprocessHED.m"
# https://github.com/phillipi/pix2pix/blob/master/scripts/edges/batch_hed.py
@helxsz
helxsz / demo.py
Created August 4, 2017 13:04
fasterrcnn demo.py on the parking data
#!/usr/bin/env python
# --------------------------------------------------------
# Faster R-CNN
# Copyright (c) 2015 Microsoft
# Licensed under The MIT License [see LICENSE for details]
# Written by Ross Girshick
# --------------------------------------------------------
"""
@helxsz
helxsz / cuda-ubuntu.md
Created July 19, 2017 22:39 — forked from vbalnt/cuda-ubuntu.md
Installation of CUDA & Tensorflow in Ubuntu 14.04 or 16.04
@helxsz
helxsz / install-opencv-2.4.13-in-ubuntu.sh
Created June 28, 2017 14:53 — forked from arthurbeggs/install_opencv2_ubuntu.sh
Install opencv-2.4.13 in Ubuntu 16.04
# install dependencies
sudo apt-get update
sudo apt-get install -y build-essential
sudo apt-get install -y cmake
sudo apt-get install -y libgtk2.0-dev
sudo apt-get install -y pkg-config
sudo apt-get install -y python-numpy python-dev
sudo apt-get install -y libavcodec-dev libavformat-dev libswscale-dev
sudo apt-get install -y libjpeg-dev libpng12-dev libtiff5-dev libjasper-dev
@helxsz
helxsz / View layer blobs in Caffe
Created June 10, 2017 14:28
View layer blobs in Caffe
import caffe
import numpy as np
import cv2
def view_layer(net, layer_name, pad = 8, pad_color = 0.2):
layer_data_raw = net.blobs[layer_name].data
layer_data = layer_data_raw.copy()
layer_data -= layer_data_raw.min()
if layer_data_raw.max() - layer_data_raw.min() != 0:
@helxsz
helxsz / use blender to create the parking lots
Created June 9, 2017 14:38
use blender to create the parking lots
#coding=utf-8
import sys
import bpy
import math
import random
import colorsys
import os
import mathutils
import numpy as np
from random import randint
import numpy as np
import matplotlib.pyplot as plt
import matplotlib.patches as patches
import matplotlib as mpl
from PIL import Image
import os
def read(file_path, image_path, vis=False, annotationPath=None):
src_txt_dir = file_path
@helxsz
helxsz / blender create many objects
Last active June 9, 2017 14:26
blender create many objects
# https://blender.stackexchange.com/questions/55965/creating-many-primitive-objects-quickly-with-python
import bpy, random
from random import randint
#Short hands for common calls
scene = bpy.context.scene
selected = bpy.context.selected_objects
mesh = bpy.ops.mesh
context = bpy.context
object = bpy.ops.object
# https://cwlseu.github.io/receptive-field-arithmetic-for-CNN
# [filter size, stride, padding]
#Assume the two dimensions are the same
#Each kernel requires the following parameters:
# - k_i: kernel size
# - s_i: stride
# - p_i: padding (if padding is uneven, right padding will higher than left padding; "SAME" option in tensorflow)
#
#Each layer i requires the following parameters to be fully represented:
# - n_i: number of feature (data layer has n_1 = imagesize )