Skip to content

Commit 68ef9af

Browse files
committed
2 parents b7f0cff + d578899 commit 68ef9af

File tree

6 files changed

+86
-2
lines changed

6 files changed

+86
-2
lines changed

.gitignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
catkin_ws/build/
2+
catkin_ws/devel/
3+
catkin_ws/.catkin_workspace

Dockerfile

Lines changed: 37 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,5 +5,41 @@ MAINTAINER ShigemichiMatsuzaki <matsuzaki@aisl.cs.tut.ac.jp>
55
WORKDIR /workspace
66
COPY requirements.txt /tmp
77

8-
RUN pip install tensorflow tensorboard tensorboardX torchvision moviepy
98
RUN pip install -r /tmp/requirements.txt && rm -rf /tmp/requirements.txt
9+
10+
RUN apt-get update && apt install -y lsb-release \
11+
&& apt-get clean \
12+
&& rm -rf /var/lib/apt/lists/*rm
13+
14+
# Install ROS
15+
# Add key
16+
RUN sh -c 'echo "deb http://packages.ros.org/ros/ubuntu $(lsb_release -sc) main" > /etc/apt/sources.list.d/ros-latest.list' && \
17+
apt-key adv --keyserver 'hkp://keyserver.ubuntu.com:80' --recv-key C1CF6E31E6BADE8868B172B4F42ED6FBAB17C654
18+
19+
# Install ROS Melodic
20+
RUN apt-get update && apt install -y ros-kinetic-ros-base \
21+
&& apt-get clean \
22+
&& rm -rf /var/lib/apt/lists/*rm
23+
24+
# Initialize the ROS environment
25+
RUN rosdep init && rosdep update
26+
27+
# Set entry point
28+
COPY ./ros_entrypoint.sh /ros_entrypoint.sh
29+
RUN chmod 777 /ros_entrypoint.sh
30+
RUN echo "source /opt/ros/kinetic/setup.bash" >> ~/.bashrc
31+
32+
# Set environment variables
33+
ENV PATH /opt/ros/kinetic/bin:/usr/local/mpi/bin:/usr/local/nvidia/bin:/usr/local/cuda/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin
34+
ENV PYTHONPATH /opt/ros/kinetic/lib/python2.7/dist-packages:$PYTHONPATH
35+
ENV ROS_DISTRO kinetic
36+
37+
# Install LibTorch, a C++ API of PyTorch
38+
# - Following the instruction in https://github.com/pytorch/pytorch/blob/master/docs/libtorch.rst
39+
# - Use /opt/conda/bin/python because the default python can't locate necessary modules due to its configuration
40+
RUN cd /opt/pytorch/pytorch/ && mkdir build_libtorch && cd build_libtorch \
41+
&& /opt/conda/bin/python ../tools/build_libtorch.py
42+
43+
RUN echo 'alias pt-python="/opt/conda/bin/python $@"' >> ~/.bashrc
44+
45+
ENTRYPOINT ["/ros_entrypoint.sh"]

catkin_ws/src/CMakeLists.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
/opt/ros/kinetic/share/catkin/cmake/toplevel.cmake

docker-compose.yml

Lines changed: 34 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,14 @@ services:
44
container_name: pytorch-train
55
image: aisl/pytorch:latest
66
runtime: nvidia
7-
command: python /root/PyTorch-ENet/main.py -m train --save-dir /root/PyTorch-ENet/save/ENet_CamVid_matsuzaki_20190921/ --name my_cityscapes_20190921 --dataset camvid --dataset-dir /tmp/dataset/CamVid/ --batch-size 8
7+
build: .
8+
command: >
9+
python /root/PyTorch-ENet/main.py -m train
10+
--save-dir /root/PyTorch-ENet/save/ENet_CamVid_matsuzaki_20190921/
11+
--name my_cityscapes_20190921
12+
--dataset camvid
13+
--dataset-dir /tmp/dataset/CamVid/
14+
--batch-size 8
815
volumes:
916
- ./PyTorch-ENet:/root/PyTorch-ENet
1017
- /media/data/dataset/matsuzaki:/tmp/dataset
@@ -14,7 +21,33 @@ services:
1421
container_name: tensorboard
1522
image: aisl/pytorch:latest
1623
command: tensorboard --logdir /root/PyTorch-ENet/runs
24+
build: .
1725
ports:
1826
- 60006:6006
1927
volumes:
2028
- ./PyTorch-ENet:/root/PyTorch-ENet
29+
30+
roscore:
31+
container_name: roscore
32+
network_mode: "host"
33+
build: .
34+
runtime: nvidia
35+
image: aisl/pytorch:latest
36+
command: roscore
37+
environment:
38+
- ROS_MASTER_URI=http://localhost:11311
39+
volumes:
40+
- ./catkin_ws/:/root/catkin_ws/
41+
- ./PyTorch-ENet:/root/PyTorch-ENet
42+
tty: true
43+
44+
bash:
45+
container_name: bash
46+
network_mode: "host"
47+
build: .
48+
image: aisl/pytorch:latest
49+
entrypoint: bash
50+
environment:
51+
- ROS_MASTER_URI=http://localhost:11311
52+
tty: true
53+
# bash -c "source /opt/ros/kinetic/setup.bash && roscore"

requirements.txt

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,3 +9,8 @@ pytz==2018.9
99
six==1.12.0
1010
torch==1.0.0
1111
torchvision==0.2.1
12+
moviepy
13+
setuptools==41.0.0
14+
tensorflow==1.13.2
15+
tensorboard==1.13.0
16+
tensorboardX==1.8

ros_entrypoint.sh

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
#!/bin/bash
2+
set -e
3+
4+
# setup ros environment
5+
source "/opt/ros/$ROS_DISTRO/setup.bash"
6+
exec "$@"

0 commit comments

Comments
 (0)