Skip to content

Commit

Permalink
Fix CMake compilation, python requirements and GPU Dockerfile
Browse files Browse the repository at this point in the history
  • Loading branch information
mdbenito committed Apr 23, 2018
1 parent 94e9a34 commit d4a80c1
Show file tree
Hide file tree
Showing 5 changed files with 71 additions and 24 deletions.
6 changes: 3 additions & 3 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ caffe_option(BUILD_SHARED_LIBS "Build shared libraries" ON)
caffe_option(BUILD_python "Build Python wrapper" ON)
set(python_version "2" CACHE STRING "Specify which Python version to use")
caffe_option(BUILD_matlab "Build Matlab wrapper" OFF IF UNIX OR APPLE)
caffe_option(BUILD_docs "Build documentation" ON IF UNIX OR APPLE)
caffe_option(BUILD_docs "Build documentation" OFF) #ON IF UNIX OR APPLE)
caffe_option(BUILD_python_layer "Build the Caffe Python layer" ON)
caffe_option(USE_OPENCV "Build with OpenCV support" ON)
caffe_option(USE_LEVELDB "Build with levelDB" ON)
Expand Down Expand Up @@ -71,10 +71,10 @@ include_directories(BEFORE src) # This is needed for gtest.
add_subdirectory(src/gtest)
add_subdirectory(src/caffe)
add_subdirectory(tools)
add_subdirectory(examples)
# add_subdirectory(examples)
add_subdirectory(python)
add_subdirectory(matlab)
add_subdirectory(docs)
#add_subdirectory(docs)

# ---[ Linter target
add_custom_target(lint COMMAND ${CMAKE_COMMAND} -P ${PROJECT_SOURCE_DIR}/cmake/lint.cmake)
Expand Down
3 changes: 3 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,9 @@ Please cite the related works in your publications if it helps your research:
5. [Train](#train)

### Requirements

**NOTE** There is partial support for a docker image. See `docker/README.md`.

Torch7 for CRNN;
g++-5; cuda8.0; cudnn V5.1 (cudnn 6 and cudnn 7 may fail); opencv3.0

Expand Down
29 changes: 29 additions & 0 deletions docker/README.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,32 @@
# Docker image for TextBoxes++

### Building (GPU only)

If you cloned with https this should work:

`docker build -t tbpp:gpu --build-arg CLONE_REPO=$(git remote get-url --all origin) standalone/gpu`

Otherwise find the https clone url and pass it as argument.

### Running

This should get you a shell session:

`docker run -it --name tbpp -h tbpp -v$(pwd):/mnt/share tbpp:gpu /bin/bash`

It will be in `/opt/caffe`. You can check the `examples/text` folder.

**NOTE:** crnn is _not_ installed in the image (yet) because it requires Torch

Enjoy!


You will find some usage hints in the doc for the original caffe Dockerfiles below.


==============================


# Caffe standalone Dockerfiles.

The `standalone` subfolder contains docker files for generating both CPU and GPU executable images for Caffe. The images can be built using make, or by running:
Expand Down
23 changes: 18 additions & 5 deletions docker/standalone/gpu/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -16,11 +16,13 @@ RUN apt-get update && apt-get install -y --no-install-recommends \
libopencv-dev \
libprotobuf-dev \
libsnappy-dev \
libgeos-dev \
protobuf-compiler \
python-dev \
python-numpy \
python-pip \
python-scipy && \
python-scipy \
python-opencv && \
rm -rf /var/lib/apt/lists/*

ENV CAFFE_ROOT=/opt/caffe
Expand All @@ -29,15 +31,26 @@ WORKDIR $CAFFE_ROOT
# FIXME: clone a specific git tag and use ARG instead of ENV once DockerHub supports this.
ENV CLONE_TAG=master

RUN git clone -b ${CLONE_TAG} --depth 1 https://github.com/BVLC/caffe.git . && \
for req in $(cat python/requirements.txt) pydot; do pip install $req; done && \
# Set this with `docker build --build-arg CLONE_REPO=$(git remote get-url --all origin) .`
# Note that will only work for https urls since ssh is not installed in the image

ARG CLONE_REPO

RUN git clone -b ${CLONE_TAG} --depth 1 $CLONE_REPO .

# CUDA_ARCH_NAME=Manual is a workaround the lack of compute_60 or higher in cuda7.5's cuda
# Required for recent GPUs
RUN for req in $(cat python/requirements.txt); do pip install $req; done && \
mkdir build && cd build && \
cmake -DUSE_CUDNN=1 .. && \
cmake .. -DCUDA_ARCH_NAME=Manual && \
make -j"$(nproc)"

# HACK: OpenCV can be confused by (the lack of) this driver in some systems
RUN ln /dev/null /dev/raw1394

ENV PYCAFFE_ROOT $CAFFE_ROOT/python
ENV PYTHONPATH $PYCAFFE_ROOT:$PYTHONPATH
ENV PATH $CAFFE_ROOT/build/tools:$PYCAFFE_ROOT:$PATH
RUN echo "$CAFFE_ROOT/build/lib" >> /etc/ld.so.conf.d/caffe.conf && ldconfig

WORKDIR /workspace
WORKDIR /opt/caffe
34 changes: 18 additions & 16 deletions python/requirements.txt
Original file line number Diff line number Diff line change
@@ -1,17 +1,19 @@
Cython>=0.19.2
numpy>=1.7.1
scipy>=0.13.2
scikit-image>=0.9.3
matplotlib>=1.3.1
ipython>=3.0.0
h5py>=2.2.0
leveldb>=0.191
networkx>=1.8.1
nose>=1.3.0
pandas>=0.12.0
Cython=0.19.2
numpy=1.7.1
scipy=0.13.2
scikit-image=0.9.3
matplotlib=1.3.1
ipython=3.0.0
h5py=2.2.0
leveldb=0.191
networkx=1.8.1
nose=1.3.0
pandas=0.12.0
python-dateutil>=1.4,<2
protobuf>=2.5.0
python-gflags>=2.0
pyyaml>=3.10
Pillow>=2.3.0
six>=1.1.0
protobuf=2.5.0
python-gflags=2.0
pyyaml=3.10
Pillow=2.3.0
six=1.1.0
pydot=1.2.4
shapely=1.6.4

0 comments on commit d4a80c1

Please sign in to comment.