Skip to content

Instantly share code, notes, and snippets.

@tsingjinyun
tsingjinyun / installCUDA65.sh
Created November 4, 2016 02:29 — forked from jetsonhacks/installCUDA65.sh
Fresh install CUDA 6.5 on NVIDIA Jetson TK1 Development Kit
#!/bin/sh
# Fresh install for CUDA 6.5 on Jetson TK1 for Linux for Tegra (L4T) 21.1
# CUDA 6.5 REQUIRES L4T 21.1 !!!
sudo apt-add-repository universe
sudo apt-get update
# This is for L4T r21.1 ; Update for your L4T i.e. r21.3
wget http://developer.download.nvidia.com/compute/cuda/6_5/rel/installers/cuda-repo-l4t-r21.1-6-5-prod_6.5-14_armhf.deb
# Install the CUDA repo metadata that you downloaded
# This is for L4T 21.1 ; Update for your L4T i.e. 21.3
@tsingjinyun
tsingjinyun / demo.py
Created September 27, 2016 06:33 — forked from twmht/demo.py
VGG Deep Face in python
import caffe
import numpy as np
# http://stackoverflow.com/questions/33828582/vgg-face-descriptor-in-python-with-caffe
img = caffe.io.load_image( "ak.png" )
img = img[:,:,::-1]*255.0 # convert RGB->BGR
avg = np.array([129.1863,104.7624,93.5940])
img = img - avg # subtract mean (numpy takes care of dimensions :)
img = img.transpose((2,0,1))
img = img[None,:] # add singleton dimension
net = caffe.Net("VGG_FACE_deploy.prototxt","VGG_FACE.caffemodel", caffe.TEST)
import numpy as np
import deepdish as dd
import lmdb
import caffe
import glob
import random
import tifffile
#creates a numpy array data
fdata = glob.glob("/data/*.tif")
@tsingjinyun
tsingjinyun / C++ Predict with caffe
Created September 9, 2016 06:58 — forked from onauparc/C++ Predict with caffe
sample code for caffe C++ prediction
#include <cuda_runtime.h>
#include <cstring>
#include <cstdlib>
#include <vector>
#include <string>
#include <iostream>
#include <stdio.h>
#include "caffe/caffe.hpp"
cmake中一些预定义变量
PROJECT_SOURCE_DIR 工程的根目录
PROJECT_BINARY_DIR 运行cmake命令的目录,通常是${PROJECT_SOURCE_DIR}/build
CMAKE_INCLUDE_PATH 环境变量,非cmake变量
CMAKE_LIBRARY_PATH 环境变量
CMAKE_CURRENT_SOURCE_DIR 当前处理的CMakeLists.txt所在的路径
CMAKE_CURRENT_BINARY_DIR target编译目录 使用ADD_SURDIRECTORY(src bin)可以更改此变量的值 SET(EXECUTABLE_OUTPUT_PATH <新路径>)并不会对此变量有影响,只是改变了最终目标文件的存储路径
CMAKE_CURRENT_LIST_FILE 输出调用这个变量的CMakeLists.txt的完整路径
CMAKE_CURRENT_LIST_LINE 输出这个变量所在的行
@tsingjinyun
tsingjinyun / deploy.prototxt
Created August 4, 2016 02:45 — forked from bogger/deploy.prototxt
GoogLeNet_cars
name: "GoogleNet"
input: "data"
input_dim: 10
input_dim: 3
input_dim: 224
input_dim: 224
# hierarchy 1
# conv -> relu -> pool -> lrn
@tsingjinyun
tsingjinyun / readme.md
Created August 4, 2016 02:35 — forked from jimgoo/readme.md
CaffeNet fine-tuned on the Oxford 102 category flower dataset
@tsingjinyun
tsingjinyun / CMakeLists.txt
Created July 27, 2016 02:00 — forked from erikzenker/CMakeLists.txt
CMake CUDA + C++ in separate files
# CMAKE FILE to separatly compile cuda and c++ files
# with the c++11 standard
#
#
# Folder structure:
#
# |
# +--main.cpp (with C++11 content)
# +--include/
# | |
@tsingjinyun
tsingjinyun / opencv-fourcc-on-mac-os-x.md
Created April 25, 2016 02:50 — forked from takuma7/opencv-fourcc-on-mac-os-x.md
OpenCV Video Writer on Mac OS X
import cv2
import numpy as np
def in_front_of_both_cameras(first_points, second_points, rot, trans):
# check if the point correspondences are in front of both images
rot_inv = rot
for first, second in zip(first_points, second_points):
first_z = np.dot(rot[0, :] - second[0]*rot[2, :], trans) / np.dot(rot[0, :] - second[0]*rot[2, :], second)
first_3d_point = np.array([first[0] * first_z, second[0] * first_z, first_z])