π Geometric Computer Vision Library for Spatial AI
Python artificial-intelligencecomputer-visiondeep-learninghacktoberfestimage-processingmachine-learningneural-networkpythonpytorchroboticsspatial-ai
Dev env using baremetal conda.
Ethan Rubleef7a6ffeca2f2
diff --git a/.gitignore b/.gitignoreindex ca834e14f..73330e5a9 100644--- a/.gitignore+++ b/.gitignore@@ -9,3 +9,4 @@ torchgeometry.egg-info/.eggs/*.cache/*.pytest_cache/*+.dev_env\ No newline at end of filediff --git a/README.rst b/README.rstindex a323651ab..4d3c12f75 100644--- a/README.rst+++ b/README.rst@@ -1,4 +1,3 @@-.. image:: https://github.com/arraiy/torchgeometry/blob/master/docs/source/_static/img/torchgeometry_logo.svg:width: 350 px:align: center@@ -31,7 +30,7 @@ Quick Usagex_deg = dgm.rad2deg(x_rad)torch.allclose(x_rad, dgm.deg2rad(x_deg)) # True-+-------------------------------------------------------.. code:: python@@ -44,8 +43,31 @@ Quick Usagewarper = dgm.HomographyWarper(32, 32)img_ref_to_dst = warper(img_ref, dst_homo_ref) # NxCxHxW--+++Development Setup+=================++Assuming that you are on ubuntu 16.04, with nvidia-drivers installed.++In bash, source the ``path.bash.inc`` script. This will install a+local conda environment under ``./.dev_env``, which includes pytorch+and some dependencies (no root required).++.. code:: bash++ source ./path.bash.inc+ python -c "import torchgeometry; print(torchgeometry.__version__)"++++To install, or update the conda environment run ``setup_dev_env.sh``++.. code:: bash++ ./setup_dev_env.sh++Installation============diff --git a/dev_env.sh b/dev_env.shdeleted file mode 100755index ed1e5eefa..000000000--- a/dev_env.sh+++ /dev/null@@ -1,41 +0,0 @@-#!/bin/bash -ex-# The purpose of this script is simplify running scripts inside of our-# dev_env docker container. It mounts the workspace and the-# workspace/../build directory inside of the container, and executes-# any arguments passed to the dev_env.sh-script_link="$( readlink "$BASH_SOURCE" )" || script_link="$BASH_SOURCE"-apparent_sdk_dir="${script_link%/*}"-if [ "$apparent_sdk_dir" == "$script_link" ]; then- apparent_sdk_dir=.-fi-sdk_dir="$( command cd -P "$apparent_sdk_dir" > /dev/null && pwd -P )"--bash_args=$@-if [[ -z "$bash_args" ]] ; then- bash_args=bash-fi--docker_data_volume="-v ${DATA_DIR}:${DATA_DIR}"-if [[ -z "$DATA_DIR" ]] ; then- docker_data_volume="-v $(pwd):$(pwd)"-fi--docker_command=docker--repo=${ARRAIY_REPO:=arraiy/torchgeometry}--$docker_command \- run \- -it \- $docker_data_volume \- -v $sdk_dir:/code/torchgeometry \- -v $HOME/.Xauthority:/root/.Xauthority \- --net=host \- --env="DISPLAY" \- --env="QT_X11_NO_MITSHM=1" \- --volume="/tmp/.X11-unix:/tmp/.X11-unix:rw" \- --privileged \- --device /dev/dri \- $repo \- bash -c "cd /code/torchgeometry && $bash_args"-diff --git a/path.bash.inc b/path.bash.incnew file mode 100644index 000000000..0fd650d0c--- /dev/null+++ b/path.bash.inc@@ -0,0 +1,15 @@+# The purpose of this script is simplify running scripts inside of our+# dev_env docker container. It mounts the workspace and the+# workspace/../build directory inside of the container, and executes+# any arguments passed to the dev_env.sh+script_link="$( readlink "$BASH_SOURCE" )" || script_link="$BASH_SOURCE"+apparent_sdk_dir="${script_link%/*}"+if [ "$apparent_sdk_dir" == "$script_link" ]; then+ apparent_sdk_dir=.+fi+sdk_dir="$( command cd -P "$apparent_sdk_dir" > /dev/null && pwd -P )"+if [ ! -e $sdk_dir/.dev_env/bin/conda ]; then+ $sdk_dir/setup_dev_env.sh+fi+source $sdk_dir/.dev_env/bin/activate $sdk_dir/.dev_env+export PYTHONPATH=$PYTHONPATH:$sdk_rootdiff --git a/setup_dev_env.sh b/setup_dev_env.shnew file mode 100755index 000000000..fb0b1b0d8--- /dev/null+++ b/setup_dev_env.sh@@ -0,0 +1,29 @@+#!/bin/bash -ex+script_link="$( readlink "$BASH_SOURCE" )" || script_link="$BASH_SOURCE"+apparent_sdk_dir="${script_link%/*}"+if [ "$apparent_sdk_dir" == "$script_link" ]; then+ apparent_sdk_dir=.+fi+sdk_dir="$( command cd -P "$apparent_sdk_dir" > /dev/null && pwd -P )"++mkdir -p $sdk_dir/.dev_env++if [ ! -e $sdk_dir/.dev_env/miniconda.sh ]; then+ curl -o $sdk_dir/.dev_env/miniconda.sh \+ -O https://repo.continuum.io/miniconda/Miniconda3-latest-Linux-x86_64.sh+ chmod +x $sdk_dir/.dev_env/miniconda.sh+fi+if [ ! -e $sdk_dir/.dev_env/bin/conda ]; then+ $sdk_dir/.dev_env/miniconda.sh -b -u -p $sdk_dir/.dev_env+fi++$sdk_dir/.dev_env/bin/conda install -y \+ ipython \+ numpy \+ pytorch \+ torchvision \+ opencv \+ -c pytorch++$sdk_dir/.dev_env/bin/conda clean -ya+