forked from NVIDIA-AI-IOT/nanoowl
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Docker setup initiated, ir_utils model storage added.
- Loading branch information
Showing
15 changed files
with
224 additions
and
24 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,4 +2,5 @@ data | |
*.egg-info | ||
*.pyc | ||
charmap.json.gz | ||
sandbox | ||
sandbox | ||
.vscode |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
DOCKER_BUILDKIT=0 docker build -t nanoowl -f ./nanoowl.Dockerfile . |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
To build on a Jetson, at least with current Jetpack version, | ||
you need to export DOCKER_BUILDKIT=0 to turn off the Docker buildkit, because | ||
it somehow disables the Nvidia Container Toolkit and makes it impossible for the | ||
container to access CUDA, TensorRT, etc. | ||
|
||
When building on a Jetson device with less than 16GB of video memory, | ||
you're going to need to set up a swap file, or the conversion of ONXX | ||
models into TensorRT Engines will fail, somewhat silently. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,84 @@ | ||
############################## | ||
# Initial setup | ||
############################## | ||
FROM dustynv/l4t-ml:r36.2.0 | ||
SHELL ["/bin/bash", "-c"] | ||
ENV PYTHONWARNINGS="ignore:setup.py install is deprecated::setuptools.command.install" | ||
|
||
# This tests to make sure that nvidia-container-toolkit libraries will be available. | ||
# If it fails, make sure that DOCKER_TOOLKIT=0 is set in your environment variables for | ||
# The build, or check the status of the bug that was causing this before | ||
# https://stackoverflow.com/a/75629058 | ||
RUN python3 -c "import tensorrt; print(tensorrt.__version__)" | ||
|
||
############################## | ||
# ROS Humble Install | ||
############################## | ||
RUN apt update | ||
RUN apt install -y locales | ||
RUN locale-gen en_US en_US.UTF-8 | ||
RUN update-locale LC_ALL=en_US.UTF-8 LANG=en_US.UTF-8 | ||
RUN export LANG=en_US.UTF-8 | ||
|
||
RUN apt install -y software-properties-common | ||
RUN add-apt-repository universe | ||
RUN apt install curl -y | ||
RUN curl -sSL https://raw.githubusercontent.com/ros/rosdistro/master/ros.key -o /usr/share/keyrings/ros-archive-keyring.gpg | ||
RUN echo "deb [arch=$(dpkg --print-architecture) signed-by=/usr/share/keyrings/ros-archive-keyring.gpg] http://packages.ros.org/ros2/ubuntu $(. /etc/os-release && echo $UBUNTU_CODENAME) main" | tee /etc/apt/sources.list.d/ros2.list > /dev/null | ||
RUN apt-get purge -y '*opencv*' | ||
RUN apt update | ||
RUN apt upgrade -y | ||
RUN apt install ros-humble-ros-base -y | ||
RUN rm -r /usr/local/lib/python3.10/dist-packages/cv2 | ||
|
||
RUN python3 -m pip install opencv-python | ||
RUN apt-get update | ||
RUN apt-get install -y curl | ||
RUN apt-get install -y build-essential | ||
RUN apt-get install -y libboost-all-dev | ||
RUN apt-get install -y libgeographic-dev | ||
RUN apt-get install -y libopencv-dev | ||
RUN apt-get install -y ros-humble-geographic-msgs | ||
RUN apt-get install -y ros-humble-angles | ||
RUN apt-get install -y ros-humble-diagnostic-updater | ||
RUN apt-get install -y ros-humble-geodesy | ||
RUN apt-get install -y ros-humble-camera-info-manager | ||
RUN apt-get install -y ros-humble-image-transport | ||
RUN apt-get install -y ros-humble-image-transport-plugins | ||
RUN apt-get install -y ros-humble-cv-bridge | ||
RUN apt-get install -y ros-humble-rosbag2-storage-mcap | ||
RUN apt-get install -y libgstreamer1.0-dev libgstreamer-plugins-base1.0-dev libgstreamer-plugins-bad1.0-dev gstreamer1.0-plugins-base gstreamer1.0-plugins-good gstreamer1.0-plugins-bad gstreamer1.0-plugins-ugly gstreamer1.0-libav gstreamer1.0-tools gstreamer1.0-x gstreamer1.0-alsa gstreamer1.0-gl gstreamer1.0-gtk3 gstreamer1.0-qt5 gstreamer1.0-pulseaudio ffmpeg | ||
RUN python3 -m pip install pyserial transforms3d pyubx2 colcon-common-extensions albumentations | ||
|
||
############################## | ||
# NanoSAM/NanoOWL setup | ||
# | ||
# Install instructions for these largely come from github.com/dusty-nv/jetson-containers | ||
############################## | ||
WORKDIR /opt | ||
|
||
# Install Python dependencies for NanoSAM | ||
RUN pip3 install transformers timm matplotlib gdown | ||
RUN pip3 install git+https://github.com/openai/CLIP.git | ||
RUN python3 -c "from transformers import (OwlViTProcessor, OwlViTForObjectDetection); \ | ||
OwlViTProcessor.from_pretrained(\"google/owlvit-base-patch32\"); \ | ||
OwlViTForObjectDetection.from_pretrained(\"google/owlvit-base-patch32\");" | ||
|
||
# Install Torch2TRT | ||
RUN git clone https://github.com/NVIDIA-AI-IOT/torch2trt && \ | ||
cd torch2trt && \ | ||
python3 setup.py install | ||
|
||
############################## | ||
# Final setup for IR Docker systems (uncomment if you're using this container as part of a IR Docker setup. ) | ||
############################## | ||
# COPY /ir_utils /root/ir_utils | ||
# WORKDIR /root/ir_utils | ||
# RUN pip3 install . | ||
|
||
# COPY /core_ws /root/core_ws | ||
# WORKDIR /root/core_ws | ||
# RUN . /opt/ros/humble/setup.sh && colcon build | ||
# RUN . install/setup.bash | ||
|
||
WORKDIR /root |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
docker run -it --net=host --ipc=host --pid=host -v /dev/shm:/dev/shm -v /home/aqua/workspaces/shared_ws/src/nanosam/:/root/ nanoowl:latest /bin/bash |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
TARGET=$1 | ||
IR_UTILS=/home/michael/code/ir_utils/ | ||
NANOOWL=/home/michael/code/nanoowl/ | ||
|
||
docker build --tag nanoowl --file ./nanoowl.Dockerfile \ | ||
--target=$TARGET \ | ||
--build-context ir_utils=$IR_UTILS \ | ||
--build-context nanoowl=$NANOOWL \ | ||
. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,61 @@ | ||
############################## | ||
# Initial setup | ||
############################## | ||
# If you run into issues with CUDA version, you should switch to a different CUDA image. | ||
FROM nvcr.io/nvidia/cuda:12.2.2-devel-ubuntu22.04 as base | ||
SHELL ["/bin/bash", "-c"] | ||
|
||
ARG DEBIAN_FRONTEND=noninteractive | ||
ENV TZ=Etc/UTC | ||
|
||
RUN apt update | ||
RUN apt upgrade -y | ||
RUN apt install -y python3 python3-pip | ||
RUN apt-get install -y curl wget git build-essential | ||
RUN apt-get install -y libboost-all-dev | ||
RUN apt-get install -y libgstreamer1.0-dev libgstreamer-plugins-base1.0-dev libgstreamer-plugins-bad1.0-dev gstreamer1.0-plugins-base gstreamer1.0-plugins-good gstreamer1.0-plugins-bad gstreamer1.0-plugins-ugly gstreamer1.0-libav gstreamer1.0-tools gstreamer1.0-x gstreamer1.0-alsa gstreamer1.0-gl gstreamer1.0-gtk3 gstreamer1.0-qt5 gstreamer1.0-pulseaudio ffmpeg | ||
RUN apt-get install -y libnvinfer-bin | ||
RUN pip install opencv-python | ||
|
||
# NanoSAM setup | ||
WORKDIR /opt/ | ||
|
||
# Install Torch2TRT | ||
RUN git clone https://github.com/NVIDIA-AI-IOT/torch2trt && \ | ||
cd torch2trt && \ | ||
python3 -m pip install -r requirements/requirements_10.txt && \ | ||
python3 -m pip install . | ||
|
||
# Install Python dependencies for NanoOWL | ||
RUN python3 -m pip install transformers timm matplotlib scipy | ||
RUN python3 -m pip install git+https://github.com/openai/CLIP.git | ||
|
||
|
||
# Install IR utils | ||
COPY --from=ir_utils . /opt/ir_utils | ||
RUN cd ir_utils && \ | ||
python3 -m pip install . | ||
|
||
################################# | ||
# Local version: We copy from local directories. | ||
################################# | ||
FROM base as local | ||
# # Grab most recent from build directory. | ||
COPY --from=nanoowl . /opt/nanoowl | ||
RUN cd nanoowl && \ | ||
python3 -m pip install . | ||
|
||
RUN cp /opt/nanoowl/examples/owl_predict.py /root/owl_predict.py | ||
WORKDIR /root | ||
################################# | ||
# Github version: We clone from Github | ||
################################# | ||
FROM base as github | ||
|
||
# Pull most recent from Github | ||
RUN git clone https://github.com/independentrobotics/nanoowl.git && \ | ||
cd nanoowl && \ | ||
python3 -m pip install . | ||
|
||
RUN cp /opt/nanosam/examples/basic_usage.py /root/example.py | ||
WORKDIR /root |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
docker run \ | ||
-it \ | ||
--gpus all \ | ||
--net=host \ | ||
--ipc=host \ | ||
--pid=host \ | ||
--volume="$HOME/.Xauthority:/root/.Xauthority:rw" \ | ||
--volume="$HOME/.config/independent-robotics.yaml:/root/.config/independent-robotics.yaml" \ | ||
--volume="$HOME/IndependentRobotics:/root/IndependentRobotics" \ | ||
--volume="$1:/root/out" \ | ||
nanoowl:latest \ | ||
/usr/bin/python3 /root/owl_predict.py "${@:2}" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
docker run \ | ||
-it \ | ||
--gpus all \ | ||
--net=host \ | ||
--ipc=host \ | ||
--pid=host \ | ||
--volume="$HOME/.Xauthority:/root/.Xauthority:rw" \ | ||
--volume="$HOME/.config/independent-robotics.yaml:/root/.config/independent-robotics.yaml" \ | ||
--volume="$HOME/IndependentRobotics:/root/IndependentRobotics" \ | ||
nanoowl:latest \ | ||
/bin/bash |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3,6 +3,11 @@ | |
|
||
setup( | ||
name="nanoowl", | ||
version="0.0.0", | ||
version="1.0.0", | ||
description="NanoOWL is a project that optimizes OWL-ViT to run in real-time on NVIDIA Jetson Orin Platforms with NVIDIA TensorRT.", | ||
author="Originally authored by NVIDIA, modifications made by Independent Robotics.", | ||
maintainer="Michael Fulton", | ||
maintainer_email="[email protected]", | ||
license="Apache 2.0", | ||
packages=find_packages() | ||
) |