Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add Dockerfile for nvidia-jetson #55

Draft
wants to merge 7 commits into
base: master
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
requirements.txt

/models
/test/data

Expand Down
9 changes: 9 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
cmake_minimum_required(VERSION 3.0.2)
project(detic_ros)

option(DETIC_ROS_INSTALL_TORCH "Installing the pytorch when building" ON)

find_package(catkin REQUIRED COMPONENTS
catkin_virtualenv
std_msgs
Expand Down Expand Up @@ -66,9 +68,16 @@ catkin_package(
CATKIN_DEPENDS message_runtime
)

if(DETIC_ROS_INSTALL_TORCH)
set(REQUIREMENTS requirements_with_torch.txt)
else()
set(REQUIREMENTS requirements_without_torch.txt)
endif()

catkin_generate_virtualenv(
PYTHON_INTERPRETER python3
CHECK_VENV FALSE
INPUT_REQUIREMENTS ${REQUIREMENTS}
)

file(GLOB PYTHON_SCRIPTS node_script/*.py)
Expand Down
39 changes: 39 additions & 0 deletions l4t.Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
FROM nvcr.io/nvidia/l4t-pytorch:r35.1.0-pth1.11-py3

ENV DEBIAN_FRONTEND=noninteractive

# Remove OpenCV built with CUDA by NVIDIA. It conflicts with original OpenCV deb
RUN apt purge opencv-* -y

# Install ROS
RUN apt update && apt install -y -qq curl &&\
sh -c 'echo "deb http://packages.ros.org/ros/ubuntu focal main" > /etc/apt/sources.list.d/ros-latest.list' &&\
curl -s https://raw.githubusercontent.com/ros/rosdistro/master/ros.asc | apt-key add - &&\
apt update && apt install -y -qq \
python3-catkin-tools python3-rosdep ros-noetic-desktop-full ros-noetic-jsk-recognition &&\
rm -rf /var/lib/apt/lists/*

# Upgrade pip-setup related packages to make grpcio install faster. Without this line, the grpcio would be compiled from source and it takes so much time.
RUN pip3 install --upgrade pip 'setuptools<=68.2.2' wheel && rm -rf ~/.cache/pip

# Build detectron2 from source. The aarch64 version is not released
RUN cd /tmp &&\
git clone --depth 1 -b v0.6 https://github.com/facebookresearch/detectron2 &&\
pip3 install --no-cache-dir -e detectron2 &&\
rm -rf ~/.cache/pip

# Copy repository and install system dependencies
RUN rosdep init
RUN mkdir -p /catkin_ws/src/detic_ros
COPY package.xml /catkin_ws/src/detic_ros
RUN cd /catkin_ws/src/detic_ros &&\
apt update &&\
rosdep update &&\
rosdep install --rosdistro=noetic -iqry --from-paths /catkin_ws/src &&\
rm -rf /var/lib/apt/lists/*

# Build
COPY . /catkin_ws/src/detic_ros
RUN sed -i '1,3d' /catkin_ws/src/detic_ros/requirements_without_torch.txt
RUN cd /catkin_ws &&\
/opt/ros/noetic/env.sh catkin build detic_ros --cmake-args -DDETIC_ROS_INSTALL_TORCH=OFF
4 changes: 1 addition & 3 deletions prepare.sh
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
#!/usr/bin/bash

git submodule update --init --recursive

ln -sf Detic/configs detic_configs
ln -sf Detic/configs detic_configs
ln -sf Detic/datasets datasets

cd node_script
Expand Down
File renamed without changes.
17 changes: 17 additions & 0 deletions requirements_without_torch.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
-f https://dl.fbaipublicfiles.com/detectron2/wheels/cu111/torch1.9/index.html
detectron2

pillow<10.0.0 # After 10.0.0, following error occurs: AttributeError: module 'PIL.Image' has no attribute 'LINEAR'

# Copied from Detic
opencv-python==4.5.5.62
timm==0.5.4
dataclasses # remove version specification for local install
ftfy==6.0.3
regex==2022.1.18
fasttext==0.9.2
scikit-learn==1.0.2
numpy==1.22.0
lvis==0.5.3
nltk==3.6.7
git+https://github.com/openai/CLIP.git
Loading