Add caffe/docker and test aocnn_m40_5.prototxt

This commit is contained in:
wang-ps 2020-11-26 13:35:39 +08:00
Родитель fee8d4c2a8
Коммит 28661067bb
7 изменённых файлов: 111 добавлений и 6 удалений

6
.gitignore поставляемый
Просмотреть файл

@ -6,6 +6,8 @@ caffe-official
*.vscode
*.zip
caffe/experiments/dataset
caffe/experiments/models
caffe/experiments/*.log
tensorflow/script/dataset
tensorflow/script/logs
dist
@ -14,4 +16,6 @@ __pycache__
*.egg-info/
.vscode/
*.pyd
*.so
*.so
*.png
*.fig

Просмотреть файл

@ -0,0 +1,92 @@
FROM nvidia/cuda:8.0-cudnn6-devel-ubuntu16.04
# dir
ENV WORKSPACE=/workspace
ENV OCNN_ROOT=$WORKSPACE/ocnn
ENV CAFFE_ROOT=$WORKSPACE/caffe
# dependencies
RUN apt-get update && apt-get install -y --no-install-recommends \
build-essential \
curl \
git \
wget \
libatlas-base-dev \
libboost-all-dev \
libcgal-dev \
libeigen3-dev \
libgflags-dev \
libgoogle-glog-dev \
libhdf5-serial-dev \
libleveldb-dev \
liblmdb-dev \
libopencv-dev \
libprotobuf-dev \
libsnappy-dev \
protobuf-compiler \
python-dev \
python-numpy \
python-pip \
python-setuptools \
python-scipy \
rsync \
vim \
zip && \
rm -rf /var/lib/apt/lists/*
# cmake
WORKDIR $WORKSPACE
RUN wget https://cmake.org/files/v3.16/cmake-3.16.2-Linux-x86_64.sh && \
mkdir cmake-3.16.2 && \
sh cmake-3.16.2-Linux-x86_64.sh --prefix=$WORKSPACE/cmake-3.16.2 --skip-license && \
ln -s $WORKSPACE/cmake-3.16.2/bin/cmake /usr/bin/cmake && \
rm cmake-3.16.2-Linux-x86_64.sh
# nccl
WORKDIR $WORKSPACE
ARG NCCL_COMMIT=286916a1a37ca1fe8cd43e280f5c42ec29569fc5
RUN git clone https://github.com/NVIDIA/nccl.git && \
cd nccl && \
git reset --hard $NCCL_COMMIT && \
make -j install && \
cd .. && \
rm -rf nccl
# ocnn
WORKDIR $OCNN_ROOT
RUN git clone https://github.com/Microsoft/O-CNN.git .
RUN cd octree/external && \
git clone --recursive https://github.com/wang-ps/octree-ext.git && \
cd .. && \
mkdir build && \
cd build && \
cmake .. && \
cmake --build . --config Release
# caffe
WORKDIR $CAFFE_ROOT
ARG CAFFE_COMMIT=6bfc5ca8f7c2a4b7de09dfe7a01cf9d3470d22b3
RUN git clone https://github.com/BVLC/caffe.git . && \
git reset --hard $CAFFE_COMMIT && \
rsync -a $OCNN_ROOT/caffe/ ./ && \
pip install --upgrade pip && \
cd python && \
for req in $(cat requirements.txt) pydot; do pip install $req; done && \
cd .. && \
mkdir build && cd build && \
cmake -DUSE_CUDNN=1 -DUSE_NCCL=1 .. && \
make -j"$(nproc)"
# path
ENV PYCAFFE_ROOT=$CAFFE_ROOT/python
ENV PYTHONPATH=$PYCAFFE_ROOT:$PYTHONPATH
ENV PATH=$CAFFE_ROOT/build/tools:$PYCAFFE_ROOT:$OCNN_ROOT/octree/build:$PATH
RUN echo "$CAFFE_ROOT/build/lib" >> /etc/ld.so.conf.d/caffe.conf && ldconfig
WORKDIR /workspace

Просмотреть файл

@ -8,7 +8,7 @@ layer {
phase: TRAIN
}
data_param {
source: "dataset/m40_adaptive_5_2_12_train_lmdb"
source: "dataset/m40_5_adaptive_2_12_train_lmdb"
batch_size: 32
backend: LMDB
}
@ -26,7 +26,7 @@ layer {
phase: TEST
}
data_param {
source: "dataset/m40_adaptive_5_2_12_test_lmdb"
source: "dataset/m40_5_adaptive_2_12_test_lmdb"
batch_size: 32
backend: LMDB
}

Просмотреть файл

@ -9,7 +9,7 @@ test_interval: 2000
# The base learning rate, momentum and the weight decay of the network.
base_lr: 0.1
momentum: 0.9
weight_decay: 0.0005
weight_decay: 0.0008
# The learning rate policy
lr_policy: "step"

0
caffe/experiments/dataset/README.md Normal file → Executable file
Просмотреть файл

Просмотреть файл

@ -16,6 +16,8 @@ parser.add_argument('--octree', type=str, required=False,
help='The path of the octree')
parser.add_argument('--simplify_points', type=str, required=False,
help='The path of the simplify_points')
parser.add_argument('--depth', type=int, default=5,
help='The octree depth')
args = parser.parse_args()
cmd = args.run
@ -177,7 +179,7 @@ def m40_generate_aocnn_lmdb(depth=5):
# generate octree
root_folder = os.path.join(abs_path, 'dataset')
points_folder = os.path.join(root_folder, 'ModelNet40.points')
m40_convert_points_to_octree(points_folder, depth, adaptive=1, node_dis=1)
m40_convert_points_to_octree(points_folder, depth, adaptive=1, node_dis=0)
# generate lmdb
octree_folder = os.path.join(root_folder, 'ModelNet40.octree.%d.adaptive' % depth)
@ -243,7 +245,7 @@ if __name__ == '__main__':
elif cmd == 'm40_generate_ocnn_lmdb':
m40_generate_ocnn_lmdb(depth=5)
elif cmd == 'm40_generate_aocnn_lmdb':
m40_generate_aocnn_lmdb(depth=5)
m40_generate_aocnn_lmdb(depth=args.depth)
elif cmd == 'm40_generate_ocnn_points_tfrecords':
m40_generate_ocnn_points_tfrecords()
elif cmd == 'm40_generate_ocnn_octree_tfrecords':

Просмотреть файл

@ -51,6 +51,13 @@ If you want to try the original code or do some speed comparisons with our `O-CN
feel free to drop me an email, we can share the original code with you.
<!--
cd caffe/docker
docker build --tag=ocnn:caffe gpu
docker run --runtime=nvidia --name=ocnn-caffe -it --rm ocnn:caffe /bin/bash
docker pull wangps/ocnn:caffe
-->
## Tensorflow
The code has been tested with Ubuntu 16.04/18.04 and TensorFlow 1.14.0/1.12.0.