This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import numpy as np | |
import scipy.optimize | |
def fitPLaneLTSQ(XYZ): | |
# Fits a plane to a point cloud, | |
# Where Z = aX + bY + c ----Eqn #1 | |
# Rearanging Eqn1: aX + bY -Z +c =0 | |
# Gives normal (a,b,-1) | |
# Normal = (a,b,-1) | |
[rows,cols] = XYZ.shape |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import numpy as np | |
import scipy.optimize | |
from mpl_toolkits.mplot3d import Axes3D | |
import matplotlib.pyplot as plt | |
fig = plt.figure() | |
ax = fig.gca(projection='3d') | |
def fitPlaneLTSQ(XYZ): |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import numpy as np | |
from sklearn.neighbors import NearestNeighbors | |
def chamfer_distance(x, y, metric='l2', direction='bi'): | |
"""Chamfer distance between two point clouds | |
Parameters | |
---------- | |
x: numpy array [n_points_x, n_dims] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def rename(self, sess=None, ckpt_path=None, step=None): | |
# if not sess: | |
# raise AttributeError('TensorFlow session not provided.') | |
# print(self.vars) | |
new_vars = {} | |
for k,v in self.vars.items(): | |
new_vars[k.replace('meshnet','meshnetmvp2m')] = v | |
saver = tf.train.Saver(new_vars, max_to_keep=0) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python | |
import sys | |
from termcolor import colored, cprint | |
with open('.ssh/config', 'r') as f: | |
for line in f: | |
l = line.strip() | |
#print('L', l) | |
if l.startswith('Host '): |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import numpy as np | |
from skimage import measure | |
vox = np.load('prediction.npy') | |
vox2 = np.pad(vox, ((1,1),(1,1),(1,1)),'constant', constant_values=0) | |
verts, faces, normals, values = measure.marching_cubes_lewiner(vox2, 0.0) | |
with open('3d.obj','w') as d: | |
for v in verts: | |
d.write('v {} {} {}\n'.format(v[0],v[1],v[2])) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import numpy as np | |
import OpenEXR as exr | |
import Imath | |
def readEXR(filename): | |
"""Read RGB + Depth data from EXR image file. | |
Parameters | |
---------- | |
filename : str |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
nvcc = /home/wc/lib/cuda-8.0/bin/nvcc | |
cudalib = /home/wc/lib/cuda-8.0/lib64 | |
tensorflow = /home/wc/anaconda3/envs/mesh/lib/python2.7/site-packages/tensorflow/include | |
all: tf_approxmatch_so.so tf_approxmatch_g.cu.o tf_nndistance_so.so tf_nndistance_g.cu.o | |
tf_approxmatch_so.so: tf_approxmatch_g.cu.o tf_approxmatch.cpp | |
g++ -std=c++11 tf_approxmatch.cpp tf_approxmatch_g.cu.o -o tf_approxmatch_so.so -shared -fPIC -I $(tensorflow) -lcudart -L $(cudalib) -O2 -D_GLIBCXX_USE_C |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: "ResNet-50" | |
layer { | |
name: "data" | |
type: "Python" | |
top: "data" | |
python_param{ | |
module: "python_data_layer" | |
layer: "AdaptAttributeLayer" | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env bash | |
cd ../lib/nndistance | |
CUDA_ROOT=/home/wc/lib/cuda | |
TF_INC=$(python -c 'import tensorflow as tf; print(tf.sysconfig.get_include())') | |
TF_LIB=$(python -c 'import tensorflow as tf; print(tf.sysconfig.get_lib())') | |
nvcc -std=c++11 -c -o tf_nndistance_g.cu.o tf_nndistance_g.cu \ | |
-I $TF_INC -I$TF_INC/external/nsync/public -D GOOGLE_CUDA=1 -x cu -Xcompiler -fPIC |
NewerOlder