From 776d0e9adc84c34ea4b3368a60b93c6eab4d1598 Mon Sep 17 00:00:00 2001 From: Abhishek Kumar Date: Fri, 22 Dec 2017 17:49:42 +0530 Subject: [PATCH 1/3] Redme updated for python3 port Port to python3 --- denseinference/lib/Makefile | 19 +++++++++++++------ readme.md | 37 ++++++++++++++++++++++++++++++++++++- 2 files changed, 49 insertions(+), 7 deletions(-) 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..7e5940c 100644 --- a/readme.md +++ b/readme.md @@ -74,4 +74,39 @@ 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) + From 9ac18a2184e420e4a061a7831d7517fd362400f3 Mon Sep 17 00:00:00 2001 From: Abhishek Kumar Date: Fri, 22 Dec 2017 17:52:12 +0530 Subject: [PATCH 2/3] redme modified --- readme.md | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) diff --git a/readme.md b/readme.md index 7e5940c..454f55b 100644 --- a/readme.md +++ b/readme.md @@ -82,14 +82,13 @@ If you want to use this in `python3` then you can follow the following steps #### Requirements -``` -make, g++, boost-python3.5 +```make, g++, boost-python3.5 ``` ### Installation of Boost for Python3 -#####Install python 3.5 : +#### Install python 3.5 : ```sudo apt-get install python3-dev ``` @@ -98,15 +97,14 @@ make, g++, boost-python3.5 ```sudo apt-get install libboost-python-dev ``` -#####Download the lastest version of Boost from http://www.boost.org/ +### Download the lastest version of Boost from http://www.boost.org/ -#####Run bootstrap with correct flags : +### Run bootstrap with correct flags : ```./bootstrap.sh --with-python=python3.5 ``` -#####Compile Boost in directory : +### Compile Boost in directory : ```./b2 ``` -#####Update the Makefile to take the new boost locations (Already did) - +### Update the Makefile to take the new boost locations (Already did) From b64c86c705820515f2ae9e35d78355727dfe8868 Mon Sep 17 00:00:00 2001 From: Abhishek Kumar Date: Fri, 22 Dec 2017 17:54:54 +0530 Subject: [PATCH 3/3] redme updated --- readme.md | 18 ++++++++---------- 1 file changed, 8 insertions(+), 10 deletions(-) diff --git a/readme.md b/readme.md index 454f55b..9093c07 100644 --- a/readme.md +++ b/readme.md @@ -82,29 +82,27 @@ If you want to use this in `python3` then you can follow the following steps #### Requirements -```make, g++, boost-python3.5 -``` +`make, g++, boost-python3.5` ### Installation of Boost for Python3 #### Install python 3.5 : -```sudo apt-get install python3-dev -``` + +`sudo apt-get install python3-dev` ### Make sure you have the libboost-python-dev libraries installed: -```sudo apt-get install libboost-python-dev -``` +`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 -``` + +`./bootstrap.sh --with-python=python3.5` ### Compile Boost in directory : -```./b2 -``` + +`./b2` ### Update the Makefile to take the new boost locations (Already did)