Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 3 additions & 8 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,14 +27,9 @@ If you find PoseCNN useful in your research, please consider citing:

1. Install [TensorFlow](https://www.tensorflow.org/get_started/os_setup). I usually compile the source code of tensorflow locally.

2. Compile the new layers under $ROOT/lib we introduce in PoseCNN.
```Shell
cd $ROOT/lib
sh make.sh
```
3. Download the VGG16 weights from [here](https://drive.google.com/open?id=1UdmOKrr9t4IetMubX-y-Pcn7AVaWJ2bL) (528M). Put the weight file vgg16.npy to $ROOT/data/imagenet_models.
2. Download the VGG16 weights from [here](https://drive.google.com/open?id=1UdmOKrr9t4IetMubX-y-Pcn7AVaWJ2bL) (528M). Put the weight file vgg16.npy to $ROOT/data/imagenet_models.

4. Compile lib/synthesize with cmake (optional). This package contains a few useful tools such as generating synthetic image and ICP.
3. Compile lib/synthesize with cmake. This package contains a few useful tools such as generating synthetic image and ICP.

Install dependencies:
- [Pangolin](https://github.com/stevenlovegrove/Pangolin)
Expand All @@ -51,7 +46,7 @@ If you find PoseCNN useful in your research, please consider citing:
make
```

Compile the Cython interface for lib/synthesize
Compile the Cython interface for lib/synthesize and custom layers
```Shell
cd $ROOT/lib
python setup.py build_ext --inplace
Expand Down
1 change: 1 addition & 0 deletions lib/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
build/
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,8 @@
#include <cfloat>
#include <time.h>
#include <thrust/extrema.h>
#include <Eigen/Geometry>
#include <thrust/execution_policy.h>
#include <Eigen/Geometry>
#include <cublas_v2.h>
#include "hough_voting_gpu_op.h"

Expand Down
1 change: 1 addition & 0 deletions lib/kinect_fusion/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
build/
10 changes: 4 additions & 6 deletions lib/kinect_fusion/src/transform/nonrigid.cu
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ __global__ void warpMeshKernel(DeviceTensor<DTensor, Eigen::UnalignedVec3<Scalar

// const NNVec nearestNeighborIndices = nearestNeighborGrid(nearestNeighborVoxel);

DualQuaternion blendedTransform;
DualQuaternion blendedTransform(deformationGraphTransforms(0));

const bool initialized = blendDualQuaternions(blendedTransform, unwarpedVertexGridCoords,
unwarpedVertexWorldCoords, deformationGraphVertices,
Expand Down Expand Up @@ -755,19 +755,17 @@ __global__ void initializeNewBaseLevelVertexTransformsKernel(const DeviceTensor1

const Vec3 newVertexInGridCoords = nearestNeighborGrid.worldToGrid(newVertexInWorldCoords);

DualQuaternion<Scalar,Eigen::DontAlign> blendedTransform;

const bool initialized = blendDualQuaternions(blendedTransform,newVertexInGridCoords,newVertexInWorldCoords,
const bool initialized = blendDualQuaternions(baseLevelTransforms(index),
newVertexInGridCoords,newVertexInWorldCoords,
baseLevelVertices, baseLevelTransforms, nearestNeighborGrid,
oneOverBlendingSigmaSquared);

if (initialized) {

printf("initialized %d\n",index);

blendedTransform.normalize();

baseLevelTransforms(index) = blendedTransform;
baseLevelTransforms(index).normalize();

}

Expand Down
111 changes: 0 additions & 111 deletions lib/make.sh

This file was deleted.

28 changes: 0 additions & 28 deletions lib/make_one.sh

This file was deleted.

1 change: 1 addition & 0 deletions lib/nms/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
gpu_nms.cpp
1 change: 1 addition & 0 deletions lib/normals/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
gpu_normals.cpp
77 changes: 76 additions & 1 deletion lib/setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@
from distutils.core import setup
from distutils.extension import Extension
from Cython.Distutils import build_ext
import tensorflow as tf
import subprocess

def find_in_path(name, path):
"Find a file in a search path"
Expand Down Expand Up @@ -104,7 +106,80 @@ def build_extensions(self):
customize_compiler_for_nvcc(self.compiler)
build_ext.build_extensions(self)

def includes_from_flags(flags):
return [f[2:] for f in flags if f.startswith('-I')]

def lib_libdir_from_flags(flags):
return [f[2:] for f in flags if f.startswith('-L')], [f[2:] for f in flags if f.startswith('-l')]

tf_compile_flags = [f for f in tf.sysconfig.get_compile_flags() if not f.startswith('-I')]
tf_include_dirs = includes_from_flags(tf.sysconfig.get_compile_flags())

opencv_cflags = subprocess.check_output(['pkg-config', '--cflags', 'opencv-3.3.1-dev']).split()
opencv_includes = includes_from_flags(opencv_cflags)
opencv_libs = subprocess.check_output(['pkg-config', '--libs', 'opencv-3.3.1-dev']).split()
opencv_libdirs, opencv_libs = lib_libdir_from_flags(opencv_libs)

def custom_tf_op(name, sources, use_opencv=False):
ext = Extension(name, sources,
library_dirs=[CUDA['lib64'], tf.sysconfig.get_lib()],
libraries=['cudart', 'tensorflow_framework'],
language='c++',
runtime_library_dirs=[CUDA['lib64']],
extra_compile_args={'gcc': ['-std=c++11',
'-D GOOGLE_CUDA=1']+tf_compile_flags,
'nvcc': ['-std=c++11',
'-D GOOGLE_CUDA=1',
'-D_MWAITXINTRIN_H_INCLUDED']
+tf_compile_flags+
['-Xcompiler',
'-fPIC',
'-arch=sm_50']},
include_dirs = tf_include_dirs+[CUDA['include'], '/usr/include/eigen3']
)
if use_opencv:
ext.include_dirs += opencv_includes
ext.libraries += opencv_libs
ext.library_dirs += opencv_libdirs
return ext

ext_modules = [
custom_tf_op('average_distance_loss.average_distance_loss',
['average_distance_loss/average_distance_loss_op_gpu.cu',
'average_distance_loss/average_distance_loss_op.cc']),
custom_tf_op('hough_voting_gpu_layer.hough_voting_gpu',
['hough_voting_gpu_layer/hough_voting_gpu_op_cc.cu',
'hough_voting_gpu_layer/hough_voting_gpu_op.cc'],
use_opencv=True),
custom_tf_op('hough_voting_layer.houg_voting',
['hough_voting_layer/Hypothesis.cpp',
'hough_voting_layer/thread_rand.cpp',
'hough_voting_layer/hough_voting_op.cc'],
use_opencv = True),
custom_tf_op('roi_pooling_layer.roi_pooling_layer',
['roi_pooling_layer/roi_pooling_op_gpu.cu',
'roi_pooling_layer/roi_pooling_op.cc']),
custom_tf_op('triplet_loss.triplet_loss',
['triplet_loss/triplet_loss_op_gpu.cu',
'triplet_loss/triplet_loss_op.cc']),
custom_tf_op('lifted_structured_loss.lifted_structured_loss',
['lifted_structured_loss/lifted_structured_loss_op_gpu.cu',
'lifted_structured_loss/lifted_structured_loss_op.cc']),
custom_tf_op('computing_flow_layer.computing_flow_layer',
['computing_flow_layer/computing_flow_op_gpu.cu',
'computing_flow_layer/computing_flow_op.cc']),
custom_tf_op('backprojecting_layer.backprojecting',
['backprojecting_layer/backprojecting_op_gpu.cu',
'backprojecting_layer/backprojecting_op.cc']),
custom_tf_op('projecting_layer.projecting',
['projecting_layer/projecting_op_gpu.cu',
'projecting_layer/projecting_op.cc']),
custom_tf_op('computing_label_layer.computing_label',
['computing_label_layer/computing_label_op_gpu.cu',
'computing_label_layer/computing_label_op.cc']),
custom_tf_op('gradient_reversal_layer.gradient_reversal',
['gradient_reversal_layer/gradient_reversal_op_gpu.cu',
'gradient_reversal_layer/gradient_reversal_op.cc']),
Extension('normals.gpu_normals',
['normals/compute_normals.cu', 'normals/gpu_normals.pyx'],
library_dirs=[CUDA['lib64']],
Expand All @@ -120,7 +195,7 @@ def build_extensions(self):
'-c',
'--compiler-options',
"'-fPIC'"]},
include_dirs = [numpy_include, CUDA['include'], '/usr/local/include/eigen3']
include_dirs = [numpy_include, CUDA['include'], '/usr/include/eigen3']
),
Extension(
"utils.cython_bbox",
Expand Down
1 change: 1 addition & 0 deletions lib/synthesize/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
synthesizer.cpp
4 changes: 3 additions & 1 deletion lib/synthesize/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
project("synthesizer")
cmake_minimum_required(VERSION 2.8)

cmake_policy(SET CMP0015 NEW)

if(NOT CMAKE_BUILD_TYPE)
set(CMAKE_BUILD_TYPE Release)
endif()
Expand Down Expand Up @@ -28,7 +30,7 @@ if (OPENMP_FOUND)
set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${OpenMP_CXX_FLAGS}")
endif()

set(xFusion_ROOT "/home/yuxiang/Projects/Deep_Pose/lib/kinect_fusion")
set(xFusion_ROOT "../kinect_fusion")
set(xFusion_INCLUDE_DIRS ${xFusion_ROOT}/include)
set(xFusion_LIBRARY_DIRS ${xFusion_ROOT}/build)
set(xFusion_LIBRARIES kfusion)
Expand Down