diff --git a/denseinference/lib/Makefile b/denseinference/lib/Makefile index a5948b3..4f1a314 100644 --- a/denseinference/lib/Makefile +++ b/denseinference/lib/Makefile @@ -1,11 +1,11 @@ -# update the path variables +# update the path variables CC = g++ CFLAGS = -W -Wall -O2 -DNDEBUG #CFLAGS = -W -Wall -g LIB_ROOT = denseinference/lib/ -all: +all: make -C clean make -C python @@ -17,13 +17,20 @@ clean: libDenseCRF.a: libDenseCRF/bipartitedensecrf.cpp libDenseCRF/densecrf.cpp libDenseCRF/filter.cpp libDenseCRF/permutohedral.cpp libDenseCRF/util.cpp libDenseCRF/densecrf.h libDenseCRF/fastmath.h libDenseCRF/permutohedral.h libDenseCRF/sse_defs.h libDenseCRF/util.h $(CC) -fPIC libDenseCRF/bipartitedensecrf.cpp libDenseCRF/densecrf.cpp libDenseCRF/filter.cpp libDenseCRF/permutohedral.cpp libDenseCRF/util.cpp -c $(CFLAGS) -DNDEBUG ar rcs libDenseCRF.a bipartitedensecrf.o densecrf.o filter.o permutohedral.o util.o - + dense_inference.so: dense_inference.o libDenseCRF.a $(CC) -shared -I/usr/include/python2.7 -Wl,-no-undefined -o dense_inference.so dense_inference.o -lpython2.7 -lboost_python -L. -lDenseCRF $(CFLAGS) - + dense_inference.o: refine_3d/dense_inference.cpp refine_3d/dense_inference.h libDenseCRF.a $(CC) -c -fPIC -I/usr/include/python2.7 refine_3d/dense_inference.cpp -o dense_inference.o $(CFLAGS) -lDenseCRF $(CFLAGS) - + + +# For python3 use the following \ +dense_inference.so: dense_inference.o libDenseCRF.a \ + $(CC) -shared -I/usr/include/python3.5m -Wl,-no-undefined -o dense_inference.so dense_inference.o -lboost_python-py35 -lpython3.5m -L. -lDenseCRF $(CFLAGS) \ +dense_inference.o: refine_3d/dense_inference.cpp refine_3d/dense_inference.h libDenseCRF.a \ + $(CC) -c -fPIC -I/usr/include/python3.5m refine_3d/dense_inference.cpp -o dense_inference.o $(CFLAGS) -lDenseCRF $(CFLAGS) + python: dense_inference.o dense_inference.so libDenseCRF.a -.PHONY: default clean \ No newline at end of file +.PHONY: default clean diff --git a/readme.md b/readme.md index c01b4db..9093c07 100644 --- a/readme.md +++ b/readme.md @@ -74,4 +74,35 @@ result = pro.set_data_and_run(img, feature_tensor) - **param img**: Normalized input as ndarray. (W, H, D), [0, 1] - **param label**: Continuous label tensor as ndarray. (W, H, D, L), [0, 1] -- **return**: Hard labeled result as ndarray. (W, H, D), [0, L], dtype=int16 +- **return**: Hard labeled result as ndarray. (W, H, D), [0, L], dtype=int16 + + +# Porting to Python3 +If you want to use this in `python3` then you can follow the following steps + +#### Requirements + +`make, g++, boost-python3.5` + +### Installation of Boost for Python3 + + +#### Install python 3.5 : + +`sudo apt-get install python3-dev` + +### Make sure you have the libboost-python-dev libraries installed: + +`sudo apt-get install libboost-python-dev` + +### Download the lastest version of Boost from http://www.boost.org/ + +### Run bootstrap with correct flags : + +`./bootstrap.sh --with-python=python3.5` + +### Compile Boost in directory : + +`./b2` + +### Update the Makefile to take the new boost locations (Already did)