Skip to content

Commit 2941327

Browse files
author
Yulia Kotseruba
committed
initial commit
0 parents  commit 2941327

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

57 files changed

+5377
-0
lines changed

.dockerignore

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
#ignore all directories with results
2+
output
3+
contrib
4+
images
5+
data

.gitignore

+35
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
# Prerequisites
2+
*.d
3+
4+
# Compiled Object files
5+
*.slo
6+
*.lo
7+
*.o
8+
*.obj
9+
10+
# Precompiled Headers
11+
*.gch
12+
*.pch
13+
14+
# Compiled Dynamic libraries
15+
*.so
16+
*.dylib
17+
*.dll
18+
19+
# Fortran module files
20+
*.mod
21+
*.smod
22+
23+
# Compiled Static libraries
24+
*.lai
25+
*.la
26+
*.a
27+
*.lib
28+
29+
# Executables
30+
*.exe
31+
*.out
32+
*.app
33+
34+
#Caffe models
35+
*.caffemodel

.gitkeep

Whitespace-only changes.

.settings/language.settings.xml

+19
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
2+
<project>
3+
<configuration id="cdt.managedbuild.toolchain.gnu.base.1498306272" name="Default">
4+
<extension point="org.eclipse.cdt.core.LanguageSettingsProvider">
5+
<provider copy-of="extension" id="org.eclipse.cdt.ui.UserLanguageSettingsProvider"/>
6+
<provider-reference id="org.eclipse.cdt.core.ReferencedProjectsLanguageSettingsProvider" ref="shared-provider"/>
7+
<provider copy-of="extension" id="org.eclipse.cdt.managedbuilder.core.GCCBuildCommandParser"/>
8+
<<<<<<< HEAD
9+
<provider class="org.eclipse.cdt.managedbuilder.language.settings.providers.GCCBuiltinSpecsDetector" console="false" env-hash="729438408833155523" id="org.eclipse.cdt.managedbuilder.core.GCCBuiltinSpecsDetector" keep-relative-paths="false" name="CDT GCC Built-in Compiler Settings" parameter="${COMMAND} ${FLAGS} -E -P -v -dD &quot;${INPUTS}&quot;" prefer-non-shared="true">
10+
=======
11+
<provider class="org.eclipse.cdt.managedbuilder.language.settings.providers.GCCBuiltinSpecsDetector" console="false" env-hash="-1487698379250237212" id="org.eclipse.cdt.managedbuilder.core.GCCBuiltinSpecsDetector" keep-relative-paths="false" name="CDT GCC Built-in Compiler Settings" parameter="${COMMAND} ${FLAGS} -E -P -v -dD &quot;${INPUTS}&quot;" prefer-non-shared="true">
12+
>>>>>>> d7009e354dac16a779721ddfd4e245d29f759a57
13+
<language-scope id="org.eclipse.cdt.core.gcc"/>
14+
<language-scope id="org.eclipse.cdt.core.g++"/>
15+
</provider>
16+
<provider-reference id="org.eclipse.cdt.managedbuilder.core.MBSLanguageSettingsProvider" ref="shared-provider"/>
17+
</extension>
18+
</configuration>
19+
</project>

CMakeLists.txt

+165
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,165 @@
1+
2+
project(STAR_FC)
3+
4+
#add_subdirectory(test)
5+
6+
cmake_minimum_required(VERSION 3.1)
7+
8+
option(WITH_SALICON "Build with support for OpenSALICON" OFF)
9+
option(WITH_GPU_FOVEATION "Build with support for GPU-accelerated foveation" OFF)
10+
11+
#find_package(Qt5Widgets REQUIRED)
12+
find_package(PythonInterp REQUIRED )
13+
find_package(PythonLibs REQUIRED )
14+
find_package(Boost COMPONENTS system filesystem serialization program_options)
15+
16+
#FIND_PACKAGE(OpenGL REQUIRED)
17+
#FIND_LIBRARY(GLEW_LIBRARY GLEW)
18+
19+
20+
if (WITH_SALICON)
21+
set(CAFFE_INCLUDE_DIR /opt/STAR_FC/contrib/caffe/include)
22+
set(CAFFE_LIB_DIR /opt/STAR_FC/contrib/caffe/build/lib)
23+
find_library(CAFFE_LIBRARY caffe PATHS ${CAFFE_LIB_DIR})
24+
find_library(GLOG_LIBRARY glog)
25+
find_library(PROTOBUF_LIBRARY protobuf PATHS /usr/local/lib/)
26+
endif()
27+
28+
include_directories(${PYTHON_INCLUDE_DIRS})
29+
30+
# this part is to automatically compile .ui files generated by qt designer
31+
#set(CMAKE_AUTOMOC ON)
32+
#set(CMAKE_AUTOUIC ON)
33+
#set(CMAKE_INCLUDE_CURRENT_DIR ON)
34+
35+
if(WITH_GPU_FOVEATION OR WITH_SALICON)
36+
37+
find_package(CUDA REQUIRED)
38+
if (CUDA_FOUND)
39+
set(CUDA_PROPAGATE_HOST_FLAGS ON)
40+
set(CUDA_NVCC_FLAGS ${CUDA_NVCC_FLAGS} -gencode arch=compute_30,code=sm_30;
41+
-gencode arch=compute_50,code=sm_50;
42+
-gencode arch=compute_60,code=sm_60;)
43+
set(CUDA_SEPARABLE_COMPILATION ON)
44+
endif()
45+
endif()
46+
47+
if (NOT WITH_GPU_FOVEATION)
48+
find_package(OpenMP)
49+
if (OPENMP_FOUND)
50+
set (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${OpenMP_C_FLAGS}")
51+
set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${OpenMP_CXX_FLAGS}")
52+
endif()
53+
endif()
54+
55+
find_library(FFTW3_LIBRARY fftw3f)
56+
find_library(FFTW3_THREADS fftw3f_threads)
57+
find_package(OpenCV REQUIRED)
58+
find_library(MATIO_LIB matio)
59+
60+
if (WITH_SALICON)
61+
message (STATUS ${CAFFE_INCLUDE_DIR})
62+
message (STATUS ${CAFFE_LIBRARY})
63+
message (STATUS ${Boost_LIBRARIES})
64+
endif()
65+
66+
message (STATUS ${FFTW3_LIBRARY})
67+
message (STATUS ${FFTW3_THREADS})
68+
message (STATUS ${OpenCV_LIBS})
69+
message (STATUS ${MATIO_LIB})
70+
#message (STATUS ${Qt5Widgets_INCLUDE_DIRS})
71+
message (STATUS ${GLOG_LIBRARY})
72+
message (STATUS ${PROTOBUF_LIBRARY})
73+
74+
if (NOT WITH_GPU_FOVEATION)
75+
message (STATUS "OPENMP FOUND ${OPENMP_FOUND}")
76+
endif()
77+
78+
set ( STAR_FC_SOURCES
79+
src/AIM.cpp
80+
src/AttentionalMap.cpp
81+
src/CentralAttentionalMap.cpp
82+
src/ConspicuityMap.cpp
83+
src/Controller.cpp
84+
src/Environment.cpp
85+
src/Eye.cpp
86+
src/FixationHistoryMap.cpp
87+
src/foveate_wide_fov.cpp
88+
src/main.cpp
89+
src/PeripheralAttentionalMap.cpp
90+
src/PriorityMap.cpp
91+
src/factorize.cpp
92+
src/utils.cpp
93+
)
94+
95+
set ( STAR_FC_HEADERS
96+
src/AIM.h
97+
src/AttentionalMap.hpp
98+
src/CentralAttentionalMap.hpp
99+
src/ConspicuityMap.hpp
100+
src/Controller.hpp
101+
src/Environment.hpp
102+
src/Eye.hpp
103+
src/FixationHistoryMap.hpp
104+
src/foveate_wide_fov.hpp
105+
src/PeripheralAttentionalMap.hpp
106+
src/PriorityMap.hpp
107+
src/factorize.h
108+
src/utils.hpp
109+
src/ba_interp3.hpp
110+
)
111+
112+
113+
set ( STAR_FC_CUDA_FILES
114+
src/ba_interp3.cu
115+
)
116+
117+
set ( BMS_SOURCES
118+
contrib/BMS_v2/mex/BMS.cpp
119+
)
120+
121+
set ( VOCUS_SOURCES
122+
contrib/VOCUS2/src/VOCUS2.cpp
123+
)
124+
125+
set ( INIH_SOURCES
126+
contrib/inih/cpp/INIReader.cpp
127+
contrib/inih/ini.c
128+
)
129+
130+
if (WITH_SALICON )
131+
include_directories(${CAFFE_INCLUDE_DIR})
132+
endif()
133+
134+
if (WITH_GPU_FOVEATION OR WITH_SALICON)
135+
include_directories(${CUDA_INCLUDE_DIRS})
136+
endif()
137+
138+
include_directories(${OpenCV_INCLUDE_DIRS} contrib/inih/ contrib/inih/cpp contrib/BMS_v2/mex/ contrib/VOCUS2/src/ /usr/include /usr/local/include/)
139+
140+
#add_compile_options(-std=c++11)
141+
SET(CMAKE_CXX_FLAGS "-std=c++11 -O3")
142+
143+
if(WITH_GPU_FOVEATION AND WITH_SALICON)
144+
message ("Compiling with GPU_FOVEATION=ON and WITH_SALICON=ON")
145+
cuda_add_executable(STAR_FC ${STAR_FC_SOURCES} ${INIH_SOURCES} src/Salicon.cpp ${STAR_FC_HEADERS} src/Salicon.hpp ${STAR_FC_CUDA_FILES} ${BMS_SOURCES} ${VOCUS_SOURCES})
146+
target_compile_definitions(STAR_FC PRIVATE GPU_FOVEATION=1 WITH_SALICON=1)
147+
elseif (WITH_GPU_FOVEATION)
148+
message ("Compiling with WITH_GPU_FOVEATION=ON")
149+
cuda_add_executable(STAR_FC ${STAR_FC_SOURCES} ${INIH_SOURCES} ${STAR_FC_HEADERS} ${STAR_FC_CUDA_FILES} ${BMS_SOURCES} ${VOCUS_SOURCES})
150+
#this is a preprocessor directive for foveate_wide_fov.hpp to switch on/off GPU accelerated foveation
151+
target_compile_definitions(STAR_FC PRIVATE GPU_FOVEATION=1)
152+
elseif(WITH_SALICON)
153+
message ("Compiling with WITH_SALICON=ON")
154+
add_executable(STAR_FC ${STAR_FC_SOURCES} ${INIH_SOURCES} src/Salicon.cpp ${STAR_FC_HEADERS} src/Salicon.hpp ${BMS_SOURCES} ${VOCUS_SOURCES})
155+
target_compile_definitions(STAR_FC PRIVATE WITH_SALICON=1)
156+
else()
157+
add_executable(STAR_FC ${STAR_FC_SOURCES} ${INIH_SOURCES} ${STAR_FC_HEADERS} ${BMS_SOURCES} ${VOCUS_SOURCES})
158+
endif()
159+
160+
161+
if (WITH_SALICON)
162+
target_link_libraries(STAR_FC ${OpenCV_LIBS} ${FFTW3_LIBRARY} ${FFTW3_THREADS} ${MATIO_LIB} ${PYTHON_LIBRARIES} ${CAFFE_LIBRARY} ${GLOG_LIBRARY} ${PROTOBUF_LIBRARY} ${Boost_LIBRARIES})
163+
else()
164+
target_link_libraries(STAR_FC ${OpenCV_LIBS} ${FFTW3_LIBRARY} ${FFTW3_THREADS} ${MATIO_LIB} ${PYTHON_LIBRARIES} ${Boost_LIBRARIES})
165+
endif()

Dockerfile

+102
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,102 @@
1+
FROM nvidia/cuda:8.0-cudnn5-devel
2+
3+
ENV STAR_FC_ROOT=/opt/STAR_FC
4+
WORKDIR $STAR_FC_ROOT
5+
6+
## this is necessary for linking against cuda libraries ##
7+
ENV PYTHONPATH=$STAR_FC_ROOT/contrib/caffe/python/:$STAR_FC_ROOT/contrib/OpenSALICON/:$PYTHONPATH
8+
ENV LD_LIBRARY_PATH=/usr/local/cuda/lib64/stubs/:/usr/local/lib/x86_64-linux-gnu:/usr/local/lib/i386-linux-gnu:${LD_LIBRARY_PATH}
9+
ENV PATH /usr/local/nvidia/bin:${PATH}
10+
11+
## install dependencies ##
12+
13+
RUN apt-get update && apt-get install -y --no-install-recommends \
14+
build-essential \
15+
autoconf \
16+
automake \
17+
libtool \
18+
cmake \
19+
curl \
20+
libgtk2.0-dev \
21+
pkg-config \
22+
libavcodec-dev \
23+
libavformat-dev \
24+
libswscale-dev \
25+
python3-pip \
26+
python3-dev \
27+
python3-setuptools \
28+
python3-numpy \
29+
qtdeclarative5-dev \
30+
libleveldb-dev \
31+
libsnappy-dev \
32+
libhdf5-serial-dev \
33+
libgtest-dev \
34+
libfftw3-dev \
35+
libboost-all-dev \
36+
libgoogle-glog-dev \
37+
libgtest-dev \
38+
libmatio-dev \
39+
libatlas-base-dev \
40+
liblmdb-dev \
41+
libxext-dev \
42+
libx11-dev \
43+
x11proto-gl-dev \
44+
dbus \
45+
wget \
46+
unzip \
47+
dh-autoreconf \
48+
git && rm -rf /var/lib/apt/lists/*
49+
50+
RUN pip3 install scikit-image
51+
52+
WORKDIR $STAR_FC_ROOT
53+
54+
## compile OpenCV 3 with CUDA support (necessary to run AIM fast) ##
55+
RUN wget -O opencv.zip https://github.com/opencv/opencv/archive/3.3.0.zip && unzip opencv.zip && mkdir opencv-3.3.0/build && rm -rf opencv.zip
56+
57+
WORKDIR $STAR_FC_ROOT/opencv-3.3.0/build
58+
59+
RUN cmake -DCMAKE_BUILD_TYPE=RELEASE \
60+
-DWITH_GTK=OFF -DWITH_GTK_2_X=OFF -DWITH_QT=ON \
61+
-DBUILD_JPEG=ON \
62+
-DCMAKE_INSTALL_PREFIX=/usr/local \
63+
-DINSTALL_PYTHON_EXAMPLES=OFF \
64+
-DINSTALL_C_EXAMPLES=OFF \
65+
-DWITH_CUDA=ON \
66+
-DBUILD_EXAMPLES=OFF .. && make -j8 && make install
67+
68+
## install protobuf
69+
RUN pip3 install --user --upgrade protobuf==3.1.0
70+
RUN wget -O protobuf.zip https://github.com/google/protobuf/archive/v3.1.0.zip && \
71+
unzip protobuf.zip && cd protobuf-3.1.0 && ./autogen.sh && ./configure && make && make install && ldconfig && rm -rf protobuf.zip
72+
73+
## compile caffe ##
74+
RUN wget -O caffe.zip https://github.com/BVLC/caffe/archive/rc4.zip && unzip caffe.zip && \
75+
mkdir -p $STAR_FC_ROOT/contrib/caffe && mv caffe-rc4/* $STAR_FC_ROOT/contrib/caffe/
76+
77+
COPY Makefile.config $STAR_FC_ROOT/contrib/caffe/
78+
79+
WORKDIR $STAR_FC_ROOT/contrib/caffe
80+
RUN protoc --version && protoc src/caffe/proto/caffe.proto --cpp_out=. && mkdir include/caffe/proto && \
81+
mv src/caffe/proto/caffe.pb.h include/caffe/proto
82+
83+
RUN make -j8 && make pycaffe
84+
85+
## Add BMS, VOCUS2 and SALICON which are used to compute peripheral and central saliency
86+
## and inih lirary for parsing .INI configuration files
87+
WORKDIR $STAR_FC_ROOT/contrib/
88+
RUN wget http://cs-people.bu.edu/jmzhang/BMS/BMS_v2-mex.zip && unzip BMS_v2-mex.zip -d BMS_v2
89+
RUN git clone https://github.com/GeeeG/VOCUS2.git VOCUS2
90+
RUN git clone https://github.com/CLT29/OpenSALICON.git OpenSALICON
91+
RUN git clone https://github.com/benhoyt/inih.git inih
92+
93+
WORKDIR $STAR_FC_ROOT/contrib/OpenSALICON
94+
RUN wget http://www.cs.pitt.edu/%7Echris/files/2016/model_files.tgz && tar -zxvf model_files.tgz && cp model_files/salicon_osie.caffemodel . && rm -rf model_files && rm model_files.tgz
95+
96+
WORKDIR $STAR_FC_ROOT
97+
## Compile STAR-FC
98+
COPY CMakeLists.txt $STAR_FC_ROOT
99+
COPY ./src $STAR_FC_ROOT/src
100+
101+
RUN cmake -DWITH_SALICON=ON -DCMAKE_BUILD_TYPE=Debug . && make
102+
ENV LD_LIBRARY_PATH=/usr/local/nvidia/lib:/usr/local/nvidia/lib64:/usr/local/cuda/lib64/stubs/:/usr/local/lib/x86_64-linux-gnu:/usr/local/lib/i386-linux-gnu:${LD_LIBRARY_PATH}

0 commit comments

Comments
 (0)