Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
  • Loading branch information
traveller59 committed Nov 29, 2018
2 parents 3eb0ffe + d843f80 commit 93e5bb7
Show file tree
Hide file tree
Showing 5 changed files with 137 additions and 32 deletions.
98 changes: 98 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,98 @@
# From https://github.com/ufoym/deepo/blob/master/docker/Dockerfile.pytorch-py36-cu90

# ==================================================================
# module list
# ------------------------------------------------------------------
# python 3.6 (apt)
# pytorch latest (pip)
# ==================================================================

FROM nvidia/cuda:9.0-cudnn7-devel-ubuntu16.04
RUN APT_INSTALL="apt-get install -y --no-install-recommends" && \
PIP_INSTALL="python -m pip --no-cache-dir install --upgrade" && \
GIT_CLONE="git clone --depth 10" && \
rm -rf /var/lib/apt/lists/* \
/etc/apt/sources.list.d/cuda.list \
/etc/apt/sources.list.d/nvidia-ml.list && \
apt-get update && \
# ==================================================================
# tools
# ------------------------------------------------------------------
DEBIAN_FRONTEND=noninteractive $APT_INSTALL \
build-essential \
ca-certificates \
cmake \
wget \
git \
vim \
fish \
libsparsehash-dev \
&& \
# ==================================================================
# python
# ------------------------------------------------------------------
DEBIAN_FRONTEND=noninteractive $APT_INSTALL \
software-properties-common \
&& \
add-apt-repository ppa:deadsnakes/ppa && \
apt-get update && \
DEBIAN_FRONTEND=noninteractive $APT_INSTALL \
python3.6 \
python3.6-dev \
&& \
wget -O ~/get-pip.py \
https://bootstrap.pypa.io/get-pip.py && \
python3.6 ~/get-pip.py && \
ln -s /usr/bin/python3.6 /usr/local/bin/python3 && \
ln -s /usr/bin/python3.6 /usr/local/bin/python && \
$PIP_INSTALL \
setuptools \
&& \
$PIP_INSTALL \
numpy \
scipy \
matplotlib \
Cython \
&& \
# ==================================================================
# pytorch
# ------------------------------------------------------------------
$PIP_INSTALL \
torch_nightly -f \
https://download.pytorch.org/whl/nightly/cu90/torch_nightly.html \
&& \
$PIP_INSTALL \
torchvision_nightly \
&& \
# ==================================================================
# config & cleanup
# ------------------------------------------------------------------
ldconfig && \
apt-get clean && \
apt-get autoremove && \
rm -rf /var/lib/apt/lists/* /tmp/* ~/*

RUN PIP_INSTALL="python -m pip --no-cache-dir install --upgrade" && \
$PIP_INSTALL \
shapely fire pybind11 pyqtgraph tensorboardX protobuf \
pyopengl pyqt5 matplotlib scikit-image numba pillow

WORKDIR /root
RUN wget https://dl.bintray.com/boostorg/release/1.68.0/source/boost_1_68_0.tar.gz
RUN tar xzvf boost_1_68_0.tar.gz
RUN cp -r ./boost_1_68_0/boost /usr/include
RUN rm -rf ./boost_1_68_0
RUN rm -rf ./boost_1_68_0.tar.gz
RUN git clone https://github.com/traveller59/second.pytorch.git --depth 10
RUN git clone https://github.com/traveller59/SparseConvNet.git --depth 10
RUN cd ./SparseConvNet && python setup.py install && cd .. && rm -rf SparseConvNet
ENV NUMBAPRO_CUDA_DRIVER=/usr/lib/x86_64-linux-gnu/libcuda.so
ENV NUMBAPRO_NVVM=/usr/local/cuda/nvvm/lib64/libnvvm.so
ENV NUMBAPRO_LIBDEVICE=/usr/local/cuda/nvvm/libdevice
ENV PYTHONPATH=/root/second.pytorch

VOLUME ["/root/data"]
VOLUME ["/root/model"]
WORKDIR /root/second.pytorch/second

ENTRYPOINT ["fish"]
23 changes: 15 additions & 8 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,6 @@ SECOND detector. Based on my unofficial implementation of VoxelNet with some imp

ONLY support python 3.6+, pytorch 0.4.1+. Don't support pytorch 0.4.0. Tested in Ubuntu 16.04/18.04.

Feel free to contact me by issue or email if encounter any problems. I don't know whether this project is runnable in other computer.

### Performance in KITTI validation set (50/50 split, people have problems, need to be tuned.)

```
Expand Down Expand Up @@ -191,19 +189,28 @@ output.features = SubmanifoldConvolutionFunction.apply(

You can download pretrained models in [google drive](https://drive.google.com/open?id=1eblyuILwbxkJXfIP5QlALW5N_x5xJZhL). The car model is corresponding to car.config, the car_tiny model is corresponding to car.tiny.config and the people model is corresponding to people.config.

## Docker

You can use a prebuilt docker for testing:
```
docker pull scrin/second-pytorch
```
Then run:
```
nvidia-docker run -it --rm -v /media/yy/960evo/datasets/:/root/data -v $HOME/pretrained_models:/root/model --ipc=host second-pytorch:latest
python ./pytorch/train.py evaluate --config_path=./configs/car.config --model_dir=/root/model/car
...
```

Currently there is a problem that training and evaluating in docker is very slow.

## Try Kitti Viewer (Unstable)

You should use kitti viewer based on pyqt and pyqtgraph to check data before training.

run ```python ./kittiviewer/viewer.py```, check following picture to use kitti viewer:
![GuidePic](https://raw.githubusercontent.com/traveller59/second.pytorch/master/images/simpleguide.png)

## TODO

- [ ] add unit tests (2018.10~2018.11).
- [ ] add a self-hosted CI (2018.10~2018.12).
- [ ] replace pyqtgraph with modernGL or other draw tools (2018.11~2019.1).

## Concepts


Expand Down
16 changes: 8 additions & 8 deletions second/configs/car.config
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@ model: {


train_input_reader: {
record_file_path: "/media/yy/960evo/datasets/kitti/kitti_train.tfrecord"
record_file_path: "/root/data/kitti/kitti_train.tfrecord"
class_names: ["Car"]
max_num_epochs : 160
batch_size: 3 # sparse conv use 7633MB GPU memory when batch_size=3
Expand All @@ -130,7 +130,7 @@ train_input_reader: {
groundtruth_points_drop_percentage: 0.0
groundtruth_drop_max_keep_points: 15
database_sampler {
database_info_path: "/media/yy/960evo/datasets/kitti/kitti_dbinfos_train.pkl"
database_info_path: "/root/data/kitti/kitti_dbinfos_train.pkl"
sample_groups {
name_to_max_num {
key: "Car"
Expand All @@ -156,8 +156,8 @@ train_input_reader: {

remove_unknown_examples: false
remove_environment: false
kitti_info_path: "/media/yy/960evo/datasets/kitti/kitti_infos_train.pkl"
kitti_root_path: "/media/yy/960evo/datasets/kitti"
kitti_info_path: "/root/data/kitti/kitti_infos_train.pkl"
kitti_root_path: "/root/data/kitti"
}

train_config: {
Expand Down Expand Up @@ -190,7 +190,7 @@ train_config: {
}

eval_input_reader: {
record_file_path: "/media/yy/960evo/datasets/kitti/kitti_val.tfrecord"
record_file_path: "/root/data/kitti/kitti_val.tfrecord"
class_names: ["Car"]
batch_size: 3
max_num_epochs : 160
Expand All @@ -200,7 +200,7 @@ eval_input_reader: {
num_workers: 3
anchor_area_threshold: 1
remove_environment: false
kitti_info_path: "/media/yy/960evo/datasets/kitti/kitti_infos_val.pkl"
# kitti_info_path: "/media/yy/960evo/datasets/kitti/kitti_infos_test.pkl"
kitti_root_path: "/media/yy/960evo/datasets/kitti"
kitti_info_path: "/root/data/kitti/kitti_infos_val.pkl"
# kitti_info_path: "/root/data/kitti/kitti_infos_test.pkl"
kitti_root_path: "/root/data/kitti"
}
16 changes: 8 additions & 8 deletions second/configs/car.tiny.config
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ model: {


train_input_reader: {
record_file_path: "/media/yy/960evo/datasets/kitti/kitti_train.tfrecord"
record_file_path: "/root/data/kitti/kitti_train.tfrecord"
class_names: ["Car"]
max_num_epochs : 160
batch_size: 3 # sparse conv use 7633MB GPU memory when batch_size=3
Expand All @@ -117,7 +117,7 @@ train_input_reader: {
groundtruth_points_drop_percentage: 0.0
groundtruth_drop_max_keep_points: 15
database_sampler {
database_info_path: "/media/yy/960evo/datasets/kitti/kitti_dbinfos_train.pkl"
database_info_path: "/root/data/kitti/kitti_dbinfos_train.pkl"
sample_groups {
name_to_max_num {
key: "Car"
Expand All @@ -143,8 +143,8 @@ train_input_reader: {

remove_unknown_examples: false
remove_environment: false
kitti_info_path: "/media/yy/960evo/datasets/kitti/kitti_infos_train.pkl"
kitti_root_path: "/media/yy/960evo/datasets/kitti"
kitti_info_path: "/root/data/kitti/kitti_infos_train.pkl"
kitti_root_path: "/root/data/kitti"
}

train_config: {
Expand Down Expand Up @@ -177,7 +177,7 @@ train_config: {
}

eval_input_reader: {
record_file_path: "/media/yy/960evo/datasets/kitti/kitti_val.tfrecord"
record_file_path: "/root/data/kitti/kitti_val.tfrecord"
class_names: ["Car"]
batch_size: 3
max_num_epochs : 160
Expand All @@ -187,7 +187,7 @@ eval_input_reader: {
num_workers: 3
anchor_area_threshold: 1
remove_environment: false
kitti_info_path: "/media/yy/960evo/datasets/kitti/kitti_infos_val.pkl"
# kitti_info_path: "/media/yy/960evo/datasets/kitti/kitti_infos_test.pkl"
kitti_root_path: "/media/yy/960evo/datasets/kitti"
kitti_info_path: "/root/data/kitti/kitti_infos_val.pkl"
# kitti_info_path: "/root/data/kitti/kitti_infos_test.pkl"
kitti_root_path: "/root/data/kitti"
}
16 changes: 8 additions & 8 deletions second/configs/people.config
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,7 @@ model: {


train_input_reader: {
record_file_path: "/media/yy/960evo/datasets/kitti/kitti_train.tfrecord"
record_file_path: "/root/data/kitti/kitti_train.tfrecord"
class_names: ["Cyclist", "Pedestrian"]
max_num_epochs : 160
batch_size: 2
Expand All @@ -130,7 +130,7 @@ train_input_reader: {
groundtruth_points_drop_percentage: 0.0
groundtruth_drop_max_keep_points: 15
database_sampler {
database_info_path: "/media/yy/960evo/datasets/kitti/kitti_dbinfos_train.pkl"
database_info_path: "/root/data/kitti/kitti_dbinfos_train.pkl"
sample_groups {
name_to_max_num {
key: "Pedestrian"
Expand Down Expand Up @@ -166,8 +166,8 @@ train_input_reader: {

remove_unknown_examples: false # if true, will decrease performance
remove_environment: false # just for VERY FAST training
kitti_info_path: "/media/yy/960evo/datasets/kitti/kitti_infos_train.pkl"
kitti_root_path: "/media/yy/960evo/datasets/kitti"
kitti_info_path: "/root/data/kitti/kitti_infos_train.pkl"
kitti_root_path: "/root/data/kitti"
}

train_config: {
Expand Down Expand Up @@ -202,7 +202,7 @@ train_config: {
}

eval_input_reader: {
record_file_path: "/media/yy/960evo/datasets/kitti/kitti_val.tfrecord"
record_file_path: "/root/data/kitti/kitti_val.tfrecord"
class_names: ["Cyclist", "Pedestrian"]
batch_size: 2
max_num_epochs : 160
Expand All @@ -212,7 +212,7 @@ eval_input_reader: {
num_workers: 3
anchor_area_threshold: 1
remove_environment: false
kitti_info_path: "/media/yy/960evo/datasets/kitti/kitti_infos_val.pkl"
# kitti_info_path: "/media/yy/960evo/datasets/kitti/kitti_infos_test.pkl"
kitti_root_path: "/media/yy/960evo/datasets/kitti"
kitti_info_path: "/root/data/kitti/kitti_infos_val.pkl"
# kitti_info_path: "/root/data/kitti/kitti_infos_test.pkl"
kitti_root_path: "/root/data/kitti"
}

0 comments on commit 93e5bb7

Please sign in to comment.