diff --git a/.github/workflows/kapture-main.yml b/.github/workflows/kapture-main.yml index ed9f3e3..211864d 100644 --- a/.github/workflows/kapture-main.yml +++ b/.github/workflows/kapture-main.yml @@ -20,30 +20,30 @@ jobs: steps: - uses: actions/checkout@v4 - name: Set up Python ${{ matrix.python-version }} - uses: actions/setup-python@v4 + uses: actions/setup-python@v5 with: python-version: ${{ matrix.python-version }} - - name: Cache pip - uses: actions/cache@v4 - with: - # This path is specific to Ubuntu - path: ~/.cache/pip - # Look to see if there is a cache hit for the corresponding requirements file - key: ${{ runner.os }}-pip-${{ hashFiles('requirements.txt') }} - restore-keys: | - ${{ runner.os }}-pip- - ${{ runner.os }}- - - name: Install dependencies + cache: pip + cache-dependency-path: pyproject.toml + + - name: Install system dependencies + run: | + sudo apt-get update + sudo apt-get install -y pandoc asciidoctor + + - name: Install python dependencies run: | - python -m pip install --upgrade pip - pip install flake8 pytest - if [ -f requirements.txt ]; then pip install -r requirements.txt; fi + python -m pip install --upgrade pip + python -m pip install flake8 pytest + make install + - name: Lint with flake8 run: | # stop the build if there are Python syntax errors or undefined names flake8 . --count --select=E9,F63,F7,F82 --show-source --statistics # exit-zero treats all errors as warnings. We allow 120 chars wide lines flake8 . --count --exit-zero --max-complexity=16 --max-line-length=120 --statistics --extend-ignore=F401 + - name: Test with unittest run: | python -m unittest discover -s tests/ diff --git a/.gitignore b/.gitignore index daf905b..2daea0d 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,6 @@ +# compiled MD documentation +README.md + # Byte-compiled / optimized / DLL files __pycache__/ *.py[cod] diff --git a/Makefile b/Makefile new file mode 100644 index 0000000..620416e --- /dev/null +++ b/Makefile @@ -0,0 +1,33 @@ +.PHONY: install install_dev docker clean check-docker check-asciidoctor check-pandoc unittests + +build: README.md + python3 -m build + +install: README.md + pip install . + +install_dev: README.md + pip install -e . + +docker: check-docker + docker build -f docker/Dockerfile . -t kapture/kapture + +check-docker: + @command -v docker >/dev/null 2>&1 || { echo "docker is not installed"; exit 1; } + +README.md: README.adoc + asciidoctor -b docbook $< -o - | pandoc -f docbook -t gfm -o $@ + +check-asciidoctor: + @command -v asciidoctor >/dev/null 2>&1 || { echo "asciidoctor is not installed"; exit 1; } + +check-pandoc: + @command -v pandoc >/dev/null 2>&1 || { echo "pandoc is not installed"; exit 1; } + +clean: + rm -rf dist/ kapture.egg-info/ README.md + +all: install + +unittests: + python3 -m unittest discover -s tests \ No newline at end of file diff --git a/README.adoc b/README.adoc index 223e203..401dbce 100644 --- a/README.adoc +++ b/README.adoc @@ -118,12 +118,13 @@ Build the docker image: [source,bash] ---- +$> cd kapture # build the docker image : if you have already cloned the repository -docker build . -t kapture/kapture -# OR build the docker image directly from github -docker build git://github.com/naver/kapture -t kapture/kapture +$> make docker +# OR build the docker image directly from github (no need to clone). +$> docker build git://github.com/naver/kapture -t kapture/kapture # run unit tests -docker run -it --rm kapture/kapture python3 -m unittest discover -s /opt/src/kapture/tests +$> docker run -it --rm kapture/kapture python3 -m unittest discover -s /opt/src/kapture/tests ---- If you want to process your own data, you can bind directories between the host and the container using @@ -132,7 +133,7 @@ The following example mounts `/path/to/dataset/` from the host to `/dataset` ins [source,bash] ---- -docker run -it \ +$> docker run -it \ --rm \ # Automatically remove the container when it exits \ --volume /path/to/dataset/:/dataset:ro \ #read only kapture/kapture diff --git a/doc/datasets.adoc b/doc/datasets.adoc index ad99d87..f6dac8f 100644 --- a/doc/datasets.adoc +++ b/doc/datasets.adoc @@ -32,8 +32,8 @@ If you download one scene, you can convert every sequence into a kapture model u [source,bash] ---- -cd //7-scenes -curl http://download.microsoft.com/download/2/8/5/28564B23-0828-408F-8631-23B1EFF1DAC8/heads.zip -o heads.zip +$> cd //7-scenes +$> curl http://download.microsoft.com/download/2/8/5/28564B23-0828-408F-8631-23B1EFF1DAC8/heads.zip -o heads.zip ---- 2) unzip it all @@ -42,11 +42,11 @@ On ubuntu, use the following commands: [source,bash] ---- -unzip heads.zip -cd heads +$> unzip heads.zip +$> cd heads # unzip all inner zip files -find . -iname "*.zip" -print0 | xargs -n1 -0 -I {} unzip {} -rm *.zip ../heads.zip # optionally cleans all zip files +$> find . -iname "*.zip" -print0 | xargs -n1 -0 -I {} unzip {} +$> rm *.zip ../heads.zip # optionally cleans all zip files ---- A scene has the following tree structure: @@ -76,15 +76,17 @@ For every scene (`stairs` in this example), import mapping and query like: [source,bash] ---- -kapture_import_7scenes.py -i //7-scenes/stairs -o //7-scenes/stairs/mapping -p mapping +$> kapture_import_7scenes -i //7-scenes/stairs -o //7-scenes/stairs/mapping -p mapping ---- NOTE: You can also import without splitting mapping and query. In that case all data are merged into a single dataset. You can also import a single sequence passing directly the full path to it (e.g. `//7-scenes/stairs/seq-01`). You can easily process all scenes/split at once, using https://www.gnu.org/software/parallel/[gnu parallel]: + +[source,bash] ---- -parallel \ +$> parallel \ kapture_import_7scenes.py -v info -i //7-scenes/{1} //7-scenes/{1}/{2} -p {2} \ ::: chess fire heads office pumpkin redkitchen stairs ::: query mapping ---- @@ -143,33 +145,35 @@ Call this from aachenv11: ---- # note: on windows, this requires admin rights for symlinks # see https://docs.python.org/3.6/library/os.html#os.symlink -kapture_import_image_list.py -v debug -i day_time_queries_with_intrinsics.txt -o kapture/query_day -im images -kapture_import_image_list.py -v debug -i night_time_queries_with_intrinsics.txt -o kapture/query_night -im images +$> kapture_import_image_list -v debug -i day_time_queries_with_intrinsics.txt -o kapture/query_day -im images +$> kapture_import_image_list -v debug -i night_time_queries_with_intrinsics.txt -o kapture/query_night -im images # if you can't use symlinks, add this to the two commands: --image_transfer copy ---- Now you have separate kapture folders for day-time and night-time queries. If you would like to have one single kapture, run from aachenv11: + [source,bash] ---- -kapture_merge.py -v debug -i kapture/query_day kapture/query_night -o kapture/query +$> kapture_merge -v debug -i kapture/query_day kapture/query_night -o kapture/query ---- 4) Create the kapture for the mapping images - Convert the COLMAP reconstructions from .bin to .txt. Call this from aachenv11: + [source,bash] ---- -colmap model_converter --input_path 3D-models/aachen_v_1_1 --output_path 3D-models/aachen_v_1_1 --output_type TXT +$> colmap model_converter --input_path 3D-models/aachen_v_1_1 --output_path 3D-models/aachen_v_1_1 --output_type TXT ---- - Convert COLMAP model to kapture. Call this from aachenv11: + [source,bash] ---- # note: on windows, this requires admin rights for symlinks # see https://docs.python.org/3.6/library/os.html#os.symlink -kapture_import_colmap.py -v debug -txt 3D-models/aachen_v_1_1/ -im images -o kapture/mapping --skip_reconstruction - +$> kapture_import_colmap -v debug -txt 3D-models/aachen_v_1_1/ -im images -o kapture/mapping --skip_reconstruction # if you can't use symlinks, add this to the command: --image_transfer copy ---- @@ -212,8 +216,8 @@ Run ---- # note: on windows, this requires admin rights for symlinks # see https://docs.python.org/3.6/library/os.html#os.symlink -kapture_import_IDL_dataset_cvpr17.py -v info -i ./IDL_dataset_cvpr17_3852/training_images_undistort -gt ./IDL_dataset_cvpr17_3852/training_gt -o ./kapture/IDL_dataset_cvpr17_3852/mapping -kapture_import_IDL_dataset_cvpr17.py -v info -i ./IDL_dataset_cvpr17_3852/query_images_undistort -gt ./IDL_dataset_cvpr17_3852/query_gt -o ./kapture/IDL_dataset_cvpr17_3852/query +$> kapture_import_IDL_dataset_cvpr17 -v info -i ./IDL_dataset_cvpr17_3852/training_images_undistort -gt ./IDL_dataset_cvpr17_3852/training_gt -o ./kapture/IDL_dataset_cvpr17_3852/mapping +$> kapture_import_IDL_dataset_cvpr17 -v info -i ./IDL_dataset_cvpr17_3852/query_images_undistort -gt ./IDL_dataset_cvpr17_3852/query_gt -o ./kapture/IDL_dataset_cvpr17_3852/query # if you can't use symlinks, add this to the commands: --image_transfer copy ---- @@ -248,11 +252,11 @@ To import it to kapture, you have to replace all `.jpg` to `.png` inside reconst In bash: [source,bash] ---- -sed 's/.jpg/.png/g' ./ShopFacade/reconstruction.nvm > ./ShopFacade/reconstruction_png.nvm -tail -n +4 ./ShopFacade/dataset_train.txt > ./ShopFacade/dataset_train_cut.txt -cut -d\ -f1 ./ShopFacade/dataset_train_cut.txt > ./ShopFacade/dataset_train_list.txt -tail -n +4 ./ShopFacade/dataset_test.txt > ./ShopFacade/dataset_test_cut.txt -cut -d\ -f1 ./ShopFacade/dataset_test_cut.txt > ./ShopFacade/dataset_test_list.txt +$> sed 's/.jpg/.png/g' ./ShopFacade/reconstruction.nvm > ./ShopFacade/reconstruction_png.nvm +$> tail -n +4 ./ShopFacade/dataset_train.txt > ./ShopFacade/dataset_train_cut.txt +$> cut -d\ -f1 ./ShopFacade/dataset_train_cut.txt > ./ShopFacade/dataset_train_list.txt +$> tail -n +4 ./ShopFacade/dataset_test.txt > ./ShopFacade/dataset_test_cut.txt +$> cut -d\ -f1 ./ShopFacade/dataset_test_cut.txt > ./ShopFacade/dataset_test_list.txt ---- In powershell @@ -270,8 +274,8 @@ Then run: ---- # note: on windows, this requires admin rights for symlinks # see https://docs.python.org/3.6/library/os.html#os.symlink -kapture_import_nvm.py -v info -i ./ShopFacade/reconstruction_png.nvm -im ./ShopFacade/ -o ./kapture/ShopFacade/mapping --filter-list ./ShopFacade/dataset_train_list.txt -kapture_import_nvm.py -v info -i ./ShopFacade/reconstruction_png.nvm -im ./ShopFacade/ -o ./kapture/ShopFacade/query --filter-list ./ShopFacade/dataset_test_list.txt +$> kapture_import_nvm -v info -i ./ShopFacade/reconstruction_png.nvm -im ./ShopFacade/ -o ./kapture/ShopFacade/mapping --filter-list ./ShopFacade/dataset_train_list.txt +$> kapture_import_nvm -v info -i ./ShopFacade/reconstruction_png.nvm -im ./ShopFacade/ -o ./kapture/ShopFacade/query --filter-list ./ShopFacade/dataset_test_list.txt # if you can't use symlinks, add this to the two kapture_import_nvm.py commands: --image_transfer copy ---- @@ -323,10 +327,10 @@ To import Extended-CMU-Seasons to kapture, run: ---- # note: on windows, this requires admin rights for symlinks # see https://docs.python.org/3.6/library/os.html#os.symlink -kapture_import_Extended_CMU_Seasons.py -v info -i ./Extended-CMU-Seasons/ -o ./kapture/Extended-CMU-Seasons/ --image_transfer link_absolute --all-files +$> kapture_import_Extended_CMU_Seasons -v info -i ./Extended-CMU-Seasons/ -o ./kapture/Extended-CMU-Seasons/ --image_transfer link_absolute --all-files # if you can't use symlinks, run -kapture_import_Extended_CMU_Seasons.py -v info -i ./Extended-CMU-Seasons/ -o ./kapture/Extended-CMU-Seasons/ --image_transfer copy --all-files +$> kapture_import_Extended_CMU_Seasons -v info -i ./Extended-CMU-Seasons/ -o ./kapture/Extended-CMU-Seasons/ --image_transfer copy --all-files ---- @@ -437,7 +441,7 @@ To import RobotCar-Seasons-v2 to kapture, run: ---- # note: on windows, this requires admin rights for symlinks # see https://docs.python.org/3.6/library/os.html#os.symlink -kapture_import_RobotCar_Seasons.py -v debug -i ./RobotCar-Seasons -o ./kapture/RobotCar-Seasons-v2 --skip_reconstruction +$> kapture_import_RobotCar_Seasons -v debug -i ./RobotCar-Seasons -o ./kapture/RobotCar-Seasons-v2 --skip_reconstruction # if you can't use symlinks, add this to the command: --image_transfer copy ---- @@ -476,39 +480,39 @@ See the https://github.com/abmmusa/silda for more details. [source,bash] ---- -cd /your/working/dataset/directory # replace the path -curl -L https://github.com/abmmusa/silda/raw/master/download.sh -o download.sh -chmod +x download.sh -./download.sh # < total of around 60GB data will be downloaded +$> cd /your/working/dataset/directory # replace the path +$> curl -L https://github.com/abmmusa/silda/raw/master/download.sh -o download.sh +$> chmod +x download.sh +$> ./download.sh # < total of around 60GB data will be downloaded ---- or you can download only data relevant to kapture, applying the following command in bash terminal: [source,bash] ---- -mkdir -p ./data/SILDa +$> mkdir -p ./data/SILDa # Downloading full spherical images -wget -O im1 -L https://imperialcollegelondon.box.com/shared/static/ce2kkt0j4uir9tpzcxx55lhfr05bbjx9 -wget -O im2 -L https://imperialcollegelondon.box.com/shared/static/j4rx03ymwajz98wsfgbocrurwjq4l68h -cat im* > silda-images.tgz -tar xvzf silda-images.tgz -mv silda-images ./data/SILDa/ -rm im1 im2 silda-images.tgz +$> wget -O im1 -L https://imperialcollegelondon.box.com/shared/static/ce2kkt0j4uir9tpzcxx55lhfr05bbjx9 +$> wget -O im2 -L https://imperialcollegelondon.box.com/shared/static/j4rx03ymwajz98wsfgbocrurwjq4l68h +$> cat im* > silda-images.tgz +$> tar xvzf silda-images.tgz +$> mv silda-images ./data/SILDa/ +$> rm im1 im2 silda-images.tgz # Downloading camera intrinsics -wget -O camera-intrinsics.tar.xz -L https://imperialcollegelondon.box.com/shared/static/pug92l2sw2n375eqrqo92j63p5qm5dqo.xz -tar xvf camera-intrinsics.tar.xz -mv camera-intrinsics ./data/SILDa/ -rm camera-intrinsics.tar.xz +$> wget -O camera-intrinsics.tar.xz -L https://imperialcollegelondon.box.com/shared/static/pug92l2sw2n375eqrqo92j63p5qm5dqo.xz +$> tar xvf camera-intrinsics.tar.xz +$> mv camera-intrinsics ./data/SILDa/ +$> rm camera-intrinsics.tar.xz # Download camera poses for the train images -wget -O silda-train-poses.txt -L https://imperialcollegelondon.box.com/shared/static/jr67j3uw8sz97j4vw8la3j3vbhzfwpnz.txt -mv silda-train-poses.txt ./data/SILDa/ +$> wget -O silda-train-poses.txt -L https://imperialcollegelondon.box.com/shared/static/jr67j3uw8sz97j4vw8la3j3vbhzfwpnz.txt +$> mv silda-train-poses.txt ./data/SILDa/ # Download train and test images split -wget -O train_imgs.txt -L https://imperialcollegelondon.box.com/shared/static/m71jx5h09heygzttn85v96z6ouz03dbv.txt -wget -O query_imgs.txt -L https://imperialcollegelondon.box.com/shared/static/hfa2l5lw86asskjv6efp8lvoipc8elc8.txt -mv train_imgs.txt query_imgs.txt ./data/SILDa/ +$> wget -O train_imgs.txt -L https://imperialcollegelondon.box.com/shared/static/m71jx5h09heygzttn85v96z6ouz03dbv.txt +$> wget -O query_imgs.txt -L https://imperialcollegelondon.box.com/shared/static/hfa2l5lw86asskjv6efp8lvoipc8elc8.txt +$> mv train_imgs.txt query_imgs.txt ./data/SILDa/ ---- You should have: @@ -527,12 +531,12 @@ You should have: [source,bash] ---- # mapping query -kapture_import_silda.py -v info --image_transfer copy -i ./data/SILDa -o ./kapture/mapping --corpus mapping -kapture_import_silda.py -v info --image_transfer copy -i ./data/SILDa -o ./kapture/query --corpus query +$> kapture_import_silda -v info --image_transfer copy -i ./data/SILDa -o ./kapture/mapping --corpus mapping +$> kapture_import_silda -v info --image_transfer copy -i ./data/SILDa -o ./kapture/query --corpus query # uncomment the following, if you want the both mapping and query in the same dataset # kapture_import_silda.py -v info --image_transfer copy -i ./data/SILDa -o ./kapture/mapping_query # then [optionally] clean original -rm -rf ./data/SILDa +$> rm -rf ./data/SILDa ---- You should end up with: @@ -599,8 +603,8 @@ To import Virtual Gallery to kapture, run: ---- # note: on windows, this requires admin rights for symlinks # see https://docs.python.org/3.6/library/os.html#os.symlink -kapture_import_virtual_gallery.py -v debug -i ./virtual_gallery -o ./kapture/virtual_gallery/mapping -c training --as-rig --image_transfer link_absolute -kapture_import_virtual_gallery.py -v debug -i ./virtual_gallery -o ./kapture/virtual_gallery/query -c testing --image_transfer link_absolute +$> kapture_import_virtual_gallery -v debug -i ./virtual_gallery -o ./kapture/virtual_gallery/mapping -c training --as-rig --image_transfer link_absolute +$> kapture_import_virtual_gallery -v debug -i ./virtual_gallery -o ./kapture/virtual_gallery/query -c testing --image_transfer link_absolute # if you can't use symlinks, resplace --image_transfer link_absolute with --image_transfer copy in both commands ---- diff --git a/doc/installation.adoc b/doc/installation.adoc index 04bc6c7..95a0fec 100644 --- a/doc/installation.adoc +++ b/doc/installation.adoc @@ -22,9 +22,9 @@ In a terminal (e.g. __bash__), run: [source,bash] ---- # install requirements -sudo apt-get install -y python3.6 python3-pip colmap +$> sudo apt-get install -y python3.6 python3-pip colmap # install kapture -pip3 install kapture +$> pip3 install kapture ---- === Windows and MacOS @@ -41,7 +41,7 @@ Get the latest __colmap__ binaries from https://github.com/colmap/colmap/release Finally, in a terminal (e.g. __powershell__), run: [source,bash] ---- -pip3 install kapture +$> pip3 install kapture ---- NOTE: **For windows user**: __kapture__ uses symlinks to optimize transfer operations. But symbolic links are not fully @@ -66,16 +66,16 @@ In a terminal, do: [source,bash] ---- # install requirements -sudo apt-get install -y git python3.6 python3-pip colmap -# install optionnal requirements -sudo apt-get install -y pandoc asciidoctor +$> sudo apt-get install -y git python3.6 python3-pip colmap +# install optional requirements +$> sudo apt-get install -y pandoc asciidoctor # clone source repository -git clone https://github.com/naver/kapture.git -cd kapture +$> git clone https://github.com/naver/kapture.git +$> cd kapture +# install kapture +$> python3 -m pip install ".[dev]" # check everything is fine -python3 -m unittest discover -s tests -# install -python3 setup.py build install +$> python3 -m unittest discover -s tests ---- @@ -95,12 +95,12 @@ Then, in a command prompt (cmd or powershell) run: [source,bash] ---- # clone source repository -git clone https://github.com/naver/kapture.git -cd kapture +$> git clone https://github.com/naver/kapture.git +$> cd kapture +# install kapture +$> make install # check everything is fine -python -m unittest discover -s tests -# install -python setup.py build install +$> make unittests ---- == using docker @@ -111,30 +111,31 @@ Build the docker image: [source,bash] ---- # clone source repository -git clone https://github.com/naver/kapture.git -cd kapture +$> git clone https://github.com/naver/kapture.git +$> cd kapture # build the docker image -docker build . -t kapture/kapture +$> make docker ---- -OR build the docker image directly from github +OR build the docker image directly from github: [source,bash] ---- -docker build git://github.com/naver/kapture -t kapture/kapture +$> docker build -t kapture/kapture -f docker/Dockerfile https://github.com/naver/kapture.git ---- Finally, run unit tests: [source,bash] ---- -docker run --runtime=nvidia -it --rm kapture/kapture python3 -m unittest discover -s /opt/src/kapture/tests +$> docker run --runtime=nvidia -it --rm kapture/kapture \ + python3 -m unittest discover -s /opt/src/kapture/tests ---- === Run [source,bash] ---- -docker run --runtime=nvidia -it \ +$> docker run --runtime=nvidia -it \ --rm \ # Automatically remove the container when it exits \ --volume /path/to/dataset/:/dataset:ro \ #read only kapture/kapture @@ -148,19 +149,9 @@ in order to access to any files and directories on a host machine from the conta [source,bash] ---- -cd kapture # use path of your cloned repository -cd tools -# On linux -python3 ./kapture_print.py -i ../samples/Aachen-Day-Night/kapture/training -# On Windows and MacOS -python ./kapture_print.py -i ../samples/Aachen-Day-Night/kapture/training -# add -v 10 for more output ----- - -You should get something like this: - -[source,bash] ----- +$> cd kapture # use path of your cloned repository +$> cd sample +$> kapture_print -i Aachen-Day-Night/kapture/training nb sensors : 3 nb trajectories : 3 nb records_camera : 3 @@ -169,4 +160,4 @@ nb types keypoints : 1 nb points 3-D : 5 nb observed 3-D points : 27 nb observation 2-D points: 27 ----- \ No newline at end of file +---- diff --git a/doc/tutorial.adoc b/doc/tutorial.adoc index 8cdd2fc..8f3dbc0 100644 --- a/doc/tutorial.adoc +++ b/doc/tutorial.adoc @@ -7,7 +7,9 @@ == Install [source,bash] -pip install kapture +---- +$> pip install kapture +---- NOTE: For this tutorial, you also must have __colmap__ version >=3.6. On ubuntu 18.04, __apt__ will install __colmap__ 3.4. @@ -16,8 +18,10 @@ In this case, you will have to compile __colmap__ from source instead. Or you can use the ready-to-use docker image: [source,bash] ---- -docker build . -t kapture/kapture -docker run --runtime=nvidia -it --rm --volume /path/to/dataset/:/dataset kapture/kapture # <1> +$> make build +# or on non gnu platform: +$> docker build . -t kapture/kapture +$> docker run --runtime=nvidia -it --rm --volume /path/to/dataset/:/dataset kapture/kapture # <1> ---- (1) replace `/path/to/dataset/` with the path where you (will) store datasets on the host. @@ -27,13 +31,13 @@ See link:installation.adoc[installation] for detailed instructions. [source,bash] ---- -cd /path/to/dataset +$> cd /path/to/dataset # update the list from repositories -kapture_download_dataset.py update +$> kapture_download_dataset update # display the list dataset -kapture_download_dataset.py list +$> kapture_download_dataset list # install mapping and query of Extended-CMU-Seasons_slice22 -kapture_download_dataset.py install "RobotCar_Seasons-v2_49_*" # <1> +$> kapture_download_dataset install "RobotCar_Seasons-v2_49_*" # <1> ---- <1> uses double quotes (`"`) to make sure the wildcard (`*`) is not interpreted by bash. diff --git a/Dockerfile b/docker/Dockerfile similarity index 59% rename from Dockerfile rename to docker/Dockerfile index 1a8d73e..3a6d6fc 100644 --- a/Dockerfile +++ b/docker/Dockerfile @@ -1,4 +1,4 @@ -FROM ubuntu:20.04 +FROM ubuntu:24.04 MAINTAINER naverlabs "kapture@naverlabs.com" # set local (see more on https://leimao.github.io/blog/Docker-Locale/) @@ -13,24 +13,24 @@ ARG SOURCE_PREFIX="/opt/src" # Get dependencies RUN apt-get update && \ apt-get install -y --no-install-recommends \ - git wget curl pandoc asciidoctor \ - python3 python3-pip python3-dev && \ + nano git wget curl pandoc asciidoctor \ + python3 python3-pip python3-dev python3-venv && \ rm -rf /var/lib/apt/lists/* -# make sure pip 3 is >= 20.0 to enable use-feature=2020-resolver -RUN python3 -m pip install --upgrade pip -RUN python3 -m pip install --upgrade setuptools wheel twine +RUN python3 -m venv /opt/venv +ENV PATH="/opt/venv/bin:$PATH" + +RUN pip install --upgrade pip setuptools wheel ######################################################################################################################## # install kapture env -ADD . ${SOURCE_PREFIX}/kapture +COPY . ${SOURCE_PREFIX}/kapture WORKDIR ${SOURCE_PREFIX}/kapture RUN git submodule update --init --recursive -RUN python3 -m pip install -r requirements.txt RUN python3 -m pip install . -### FINALIZE ################################################################### -# save space: purge apt-get +#### FINALIZE ################################################################### +## save space: purge apt-get RUN rm -rf /var/lib/apt/lists/* USER root -WORKDIR ${SOURCE_PREFIX}/ +WORKDIR ${SOURCE_PREFIX}/ \ No newline at end of file diff --git a/kapture/converter/downloader/archives.py b/kapture/converter/downloader/archives.py index 4b05370..c787a6c 100644 --- a/kapture/converter/downloader/archives.py +++ b/kapture/converter/downloader/archives.py @@ -21,7 +21,7 @@ def untar_file(archive_filepath: str, os.makedirs(install_dirpath, exist_ok=True) with tarfile.open(archive_filepath, 'r:*') as archive: for tarinfo in archive: - archive.extract(tarinfo, path=install_dirpath, set_attrs=False) + archive.extract(tarinfo, path=install_dirpath, set_attrs=False, filter="data") def compute_sha256sum(archive_filepath: str): diff --git a/kapture/converter/virtual_gallery/__init__.py b/kapture/converter/virtual_gallery/__init__.py index 0772c86..092b139 100644 --- a/kapture/converter/virtual_gallery/__init__.py +++ b/kapture/converter/virtual_gallery/__init__.py @@ -3,4 +3,4 @@ """ Virtual gallery to kapture import and export """ -# TODO: import path_to_kapture if needed +# TODO: if needed diff --git a/pyproject.toml b/pyproject.toml new file mode 100644 index 0000000..9ed9521 --- /dev/null +++ b/pyproject.toml @@ -0,0 +1,76 @@ +[build-system] +requires = ["setuptools", "setuptools-scm"] +build-backend = "setuptools.build_meta" + +[project] +name = "kapture" +version="1.2.1" +description = "Kapture is a pivot file format and Python toolkit for SfM and sensor-acquired data." +readme = "README.md" +dependencies = [ + 'dataclasses>=0.3', + 'numpy>=1.16', + 'numpy-quaternion>=2019.3.18.14.33.20', + 'numba>=0.42', + 'matplotlib>=3.0', + 'scipy>=1.10.1', + 'tqdm>=4.30', + 'Pillow>=8.1.1', + 'piexif==1.1.3', + 'requests>=2.21', + 'pyyaml>=5.1', + 'wcmatch>=5.0', + 'tabulate>=0.8.7', + 'pytz>=2021.1', + 'build>=1.0.3', + 'pytest' +] # If project has dependencies + + +[project.optional-dependencies] +zed = ['pyzed'] + +[tool.setuptools] +packages = ['kapture', 'tools'] + + +[project.scripts] +kapture_data_date_ranges="tools.kapture_data_date_ranges:print_command_line" +kapture_download_dataset="tools.kapture_download_dataset:kapture_download_dataset_cli" +kapture_extract_exif="tools.kapture_extract_exif:extract_exif_command_line" +kapture_export_colmap="tools.kapture_export_colmap:colmap_command_line" +kapture_export_image_list="tools.kapture_export_image_list:export_image_list_command_line" +kapture_export_ply="tools.kapture_export_ply:export_ply_command_line" +kapture_export_LTVL2020="tools.kapture_export_LTVL2020:export_ltvl2020_command_line" +kapture_export_openmvg="tools.kapture_export_openmvg:export_openmvg_command_line" +kapture_export_opensfm="tools.kapture_export_opensfm:export_opensfm_command_line" +kapture_export_ETH_MS_LTVL="tools.kapture_export_ETH_MS_LTVL:export_ETH_MS_LTVL_command_line" +kapture_export_depth_images="tools.kapture_export_depth_images:export_depth_images_command_line" +kapture_export_4seasons_pairs="tools.kapture_export_4seasons_pairs:export_4seasons_pairs_command_line" +kapture_import_nvm="tools.kapture_import_nvm:import_nvm_command_line" +kapture_import_utbm="tools.kapture_import_utbm:import_utbm_rosbag_command_line" +kapture_import_RIO10="tools.kapture_import_RIO10:import_rio10_command_line" +kapture_import_silda="tools.kapture_import_silda:import_silda_command_line" +kapture_import_colmap="tools.kapture_import_colmap:colmap_command_line" +kapture_import_rosbag="tools.kapture_import_rosbag:import_rosbag_command_line" +kapture_import_7scenes="tools.kapture_import_7scenes:import_7scenes_command_line" +kapture_import_bundler="tools.kapture_import_bundler:bundler_command_line" +kapture_import_openmvg="tools.kapture_import_openmvg:import_openmvg_command_line" +kapture_import_opensfm="tools.kapture_import_opensfm:import_opensfm_command_line" +kapture_import_12scenes="tools.kapture_import_12scenes:import_12scenes_command_line" +kapture_import_4seasons="tools.kapture_import_4seasons:import_4seasons_command_line" +kapture_import_image_list="tools.kapture_import_image_list:import_image_list_command_line" +kapture_import_stereolabs="tools.kapture_import_stereolabs:kapture_import_zed_command_line" +kapture_import_image_folder="tools.kapture_import_image_folder:import_image_folder_command_line" +kapture_import_virtual_gallery="tools.kapture_import_virtual_gallery:import_virtual_gallery_command_line" +kapture_import_RobotCar_Seasons="tools.kapture_import_RobotCar_Seasons:import_robotcar_seasons_command_line" +kapture_import_symphony_seasons="tools.kapture_import_symphony_seasons:import_symphony_seasons_command_line" +kapture_import_IDL_dataset_cvpr17="tools.kapture_import_IDL_dataset_cvpr17:import_idl_dataset_cvpr17_command_line" +kapture_import_Extended_CMU_Seasons="tools.kapture_import_Extended_CMU_Seasons:import_extended_cmu_seasons_command_line" +kapture_import_image_list_with_poses="tools.kapture_import_image_list_with_poses:import_image_list_with_poses_command_line" +kapture_upgrade_1_0_to_1_1="tools.kapture_upgrade_1_0_to_1_1:upgrade_1_0_to_1_1_command_line" +kapture_upgrade_1_0_to_1_1_inplace="tools.kapture_upgrade_1_0_to_1_1_inplace:upgrade_1_0_to_1_1_inplace_command_line" +kapture_upgrade_1_0_to_1_1_orphan_features="tools.kapture_upgrade_1_0_to_1_1_orphan_features:upgrade_1_0_to_1_1_orphan_features_command_line" +kapture_merge="tools.kapture_merge:merge_command_line" +kapture_print="tools.kapture_print:print_command_line" +kapture_rename_features="tools.kapture_rename_features:rename_features_command_line" diff --git a/requirements.txt b/requirements.txt deleted file mode 100644 index 662e0af..0000000 --- a/requirements.txt +++ /dev/null @@ -1,17 +0,0 @@ -dataclasses>=0.3;python_version<'3.7' -numpy>=1.16 -numpy-quaternion -numba -matplotlib -scipy -tqdm -Pillow>=8.1.1 -piexif==1.1.3 -requests -pyyaml>=5.1 -wcmatch -tabulate>=0.8.7 -pytz>=2021.1 -pytest>=6 -build>=1.0.3 -open3d;python_version<'3.12' diff --git a/setup.py b/setup.py deleted file mode 100644 index 19be7a5..0000000 --- a/setup.py +++ /dev/null @@ -1,88 +0,0 @@ -# Copyright 2020-present NAVER Corp. Under BSD 3-clause license - -import setuptools -import warnings -import os.path as path -from glob import glob -from subprocess import SubprocessError, check_call -import os -import tempfile -import sys - -HERE = path.normpath(path.dirname(__file__)) - - -# Documentation ######################################################################################################## -# setuptools only support md documentation: convert from asciidoc -def read_file(filepath): - with open(filepath, 'r', encoding='utf-8') as f: - return f.read() - - -def read_doc(filepath): - try: # from asciidoc to markdown - # https://tinyapps.org/blog/201701240700_convert_asciidoc_to_markdown.html - with tempfile.TemporaryDirectory() as tmpdirname: - xml_filepath = path.join(tmpdirname, 'README.xml') - md_filepath = path.join(tmpdirname, 'README.md') - use_shell = sys.platform.startswith("win") - check_call(['asciidoctor', '-b', 'docbook', filepath, '-o', xml_filepath], shell=use_shell) - check_call(['pandoc', '-f', 'docbook', '-t', 'markdown_strict', xml_filepath, '-o', md_filepath], - shell=use_shell) - content = read_file(md_filepath) - - except (FileNotFoundError, SubprocessError): - warnings.warn('cannot convert asciidoc to markdown.') - content = read_file(filepath) - - return content - - -readme_filepath = path.join(HERE, 'README.adoc') -long_description = read_doc(readme_filepath) - - -######################################################################################################################## -setuptools.setup( - # description - name='kapture', - version="1.1.10", - author="naverlabs", - author_email="kapture@naverlabs.com", - description="kapture: file format for SfM", - long_description=long_description, - long_description_content_type="text/markdown", - url="https://github.com/naver/kapture/", - classifiers=[ - "Programming Language :: Python :: 3", - "License :: OSI Approved :: BSD License", - "Operating System :: OS Independent", - ], - - # dependencies - python_requires='>=3.8', - install_requires=[ - 'dataclasses>=0.3;python_version<\'3.7\'', - 'numpy>=1.16', - 'numpy-quaternion>=2019.3.18.14.33.20', - 'numba>=0.42', - 'matplotlib>=3.0', - 'scipy>=1.10.1', - 'tqdm>=4.30', - 'Pillow>=8.1.1', - 'piexif==1.1.3', - 'requests>=2.21', - 'pyyaml>=5.1', - 'wcmatch>=5.0', - 'tabulate>=0.8.7', - 'pytz>=2021.1', - 'build>=1.0.3' - ], - extras_require={ - 'dev': ['pytest'], - }, - # sources - packages=setuptools.find_packages(), - data_files=[(".", ["README.adoc"])], - scripts=[f for f in glob(os.path.join(HERE, 'tools', '*.py'))], -) diff --git a/tests/path_to_kapture.py b/tests/path_to_kapture.py deleted file mode 100644 index 8d0ecbf..0000000 --- a/tests/path_to_kapture.py +++ /dev/null @@ -1,7 +0,0 @@ -# Copyright 2020-present NAVER Corp. Under BSD 3-clause license - -import sys -import os.path as path - -# workaround for sibling import -sys.path.insert(0, path.abspath(path.join(path.dirname(__file__), '..'))) diff --git a/tests/test_7scenes.py b/tests/test_7scenes.py index c04e266..132fb96 100755 --- a/tests/test_7scenes.py +++ b/tests/test_7scenes.py @@ -5,7 +5,7 @@ import tempfile import unittest # kapture -import path_to_kapture # enables import kapture # noqa: F401 + # enables import kapture # noqa: F401 from kapture.io.csv import kapture_from_dir from kapture.algo.compare import equal_kapture from kapture.io.records import TransferAction diff --git a/tests/test_bundler.py b/tests/test_bundler.py index 4bb90cc..16fd255 100755 --- a/tests/test_bundler.py +++ b/tests/test_bundler.py @@ -5,7 +5,7 @@ import tempfile import unittest # kapture -import path_to_kapture # enables import kapture # noqa: F401 + # enables import kapture # noqa: F401 import kapture from kapture.io.csv import kapture_from_dir from kapture.algo.compare import equal_kapture diff --git a/tests/test_colmap.py b/tests/test_colmap.py index 3b4557f..a93faad 100755 --- a/tests/test_colmap.py +++ b/tests/test_colmap.py @@ -6,7 +6,7 @@ import tempfile import numpy as np # kapture -import path_to_kapture # enables import kapture # noqa: F401 + # enables import kapture # noqa: F401 import kapture from kapture.io.records import TransferAction, get_image_fullpath from kapture.io.csv import kapture_from_dir diff --git a/tests/test_compare.py b/tests/test_compare.py index 2977d1e..ec2945c 100755 --- a/tests/test_compare.py +++ b/tests/test_compare.py @@ -7,7 +7,7 @@ import copy import os.path as path # kapture -import path_to_kapture # enables import kapture # noqa: F401 + # enables import kapture # noqa: F401 import kapture import kapture.io.csv as csv from kapture.algo.compare import is_distance_within_threshold, pose_transform_distance diff --git a/tests/test_core.py b/tests/test_core.py index e7a3caf..97b91d6 100755 --- a/tests/test_core.py +++ b/tests/test_core.py @@ -11,7 +11,7 @@ from copy import deepcopy from datetime import datetime # kapture -import path_to_kapture # enables import kapture # noqa: F401 + # enables import kapture # noqa: F401 import kapture from kapture.algo.compare import equal_trajectories, equal_rigs, equal_poses diff --git a/tests/test_download.py b/tests/test_download.py index 8fd31e2..ef94a7a 100755 --- a/tests/test_download.py +++ b/tests/test_download.py @@ -9,7 +9,7 @@ import sys import stat # kapture -import path_to_kapture # enables import kapture # noqa: F401 + # enables import kapture # noqa: F401 import kapture.converter.downloader.archives as archives # import tools.kapture_download_dataset as download # from unittest.mock import patch diff --git a/tests/test_exif.py b/tests/test_exif.py index 16fac46..eb9a7fa 100755 --- a/tests/test_exif.py +++ b/tests/test_exif.py @@ -8,7 +8,7 @@ import piexif # kapture -import path_to_kapture # enables import kapture # noqa: F401 + # enables import kapture # noqa: F401 import kapture from kapture.io.records import images_to_filepaths, get_image_fullpath from kapture.converter.exif.import_exif import convert_gps_to_kapture_record, extract_gps_from_exif, \ diff --git a/tests/test_image_folder.py b/tests/test_image_folder.py index 937aa4c..d2eedcb 100644 --- a/tests/test_image_folder.py +++ b/tests/test_image_folder.py @@ -7,7 +7,7 @@ import unittest import sys # kapture -import path_to_kapture # enables import kapture # noqa: F401 + # enables import kapture # noqa: F401 import kapture from kapture.io.csv import kapture_from_dir from kapture.io.records import TransferAction diff --git a/tests/test_image_list.py b/tests/test_image_list.py index c6a8758..b1cef1f 100755 --- a/tests/test_image_list.py +++ b/tests/test_image_list.py @@ -5,7 +5,7 @@ import tempfile import unittest # kapture -import path_to_kapture # enables import kapture # noqa: F401 + # enables import kapture # noqa: F401 import kapture from kapture.io.csv import kapture_from_dir from kapture.algo.compare import equal_kapture diff --git a/tests/test_image_list_with_poses.py b/tests/test_image_list_with_poses.py index 18b163d..7c1a791 100755 --- a/tests/test_image_list_with_poses.py +++ b/tests/test_image_list_with_poses.py @@ -6,7 +6,7 @@ import tempfile import unittest # kapture -import path_to_kapture # enables import kapture # noqa: F401 + # enables import kapture # noqa: F401 from kapture.algo.compare import equal_kapture from kapture.io.csv import kapture_from_dir from kapture.io.records import TransferAction diff --git a/tests/test_io_csv.py b/tests/test_io_csv.py index 18253a6..8d44a14 100755 --- a/tests/test_io_csv.py +++ b/tests/test_io_csv.py @@ -8,7 +8,7 @@ import tempfile import warnings # kapture -import path_to_kapture # enables import kapture # noqa: F401 + # enables import kapture # noqa: F401 import kapture import kapture.io.csv as csv from kapture.io.csv import kapture_linesep diff --git a/tests/test_io_features.py b/tests/test_io_features.py index 4101ca1..f229314 100755 --- a/tests/test_io_features.py +++ b/tests/test_io_features.py @@ -6,7 +6,7 @@ import numpy as np import tempfile # kapture -import path_to_kapture # enables import kapture # noqa: F401 + # enables import kapture # noqa: F401 import kapture import kapture.io.features as binary diff --git a/tests/test_io_records.py b/tests/test_io_records.py index f2e291a..65711d4 100755 --- a/tests/test_io_records.py +++ b/tests/test_io_records.py @@ -7,7 +7,7 @@ import sys import tempfile # kapture -import path_to_kapture # enables import kapture # noqa: F401 + # enables import kapture # noqa: F401 import kapture import kapture.io.records from kapture.io.binary import transfer_files_from_dir_link, transfer_files_from_dir_copy diff --git a/tests/test_nmea.py b/tests/test_nmea.py index ae11b24..2ed7507 100644 --- a/tests/test_nmea.py +++ b/tests/test_nmea.py @@ -6,7 +6,7 @@ import unittest import numpy as np # kapture -import path_to_kapture # enables import kapture # noqa: F401 + # enables import kapture # noqa: F401 import kapture from kapture.converter.nmea.import_nmea import extract_gnss_from_nmea diff --git a/tests/test_nvm.py b/tests/test_nvm.py index fd19724..928ac69 100755 --- a/tests/test_nvm.py +++ b/tests/test_nvm.py @@ -5,7 +5,7 @@ import tempfile import unittest # kapture -import path_to_kapture # enables import kapture # noqa: F401 + # enables import kapture # noqa: F401 import kapture from kapture.io.csv import kapture_from_dir from kapture.algo.compare import equal_kapture diff --git a/tests/test_openmvg.py b/tests/test_openmvg.py index a1704c6..c258c49 100755 --- a/tests/test_openmvg.py +++ b/tests/test_openmvg.py @@ -15,7 +15,7 @@ from typing import Dict, List import unittest # kapture -import path_to_kapture # enables import kapture # noqa: F401 + # enables import kapture # noqa: F401 import kapture from kapture.algo.compare import equal_poses, equal_kapture import kapture.io.csv as kcsv diff --git a/tests/test_opensfm.py b/tests/test_opensfm.py index 9e2f635..5a4ca00 100755 --- a/tests/test_opensfm.py +++ b/tests/test_opensfm.py @@ -8,7 +8,7 @@ import tempfile import unittest # kapture -import path_to_kapture # enables import kapture # noqa: F401 + # enables import kapture # noqa: F401 from kapture.algo.compare import equal_kapture, equal_sensors, equal_records_gnss import kapture.io.csv as csv from kapture.io.records import TransferAction diff --git a/tests/test_ply.py b/tests/test_ply.py index cebd74f..829d38c 100755 --- a/tests/test_ply.py +++ b/tests/test_ply.py @@ -5,7 +5,7 @@ import os.path as path import tempfile # kapture -import path_to_kapture # enables import kapture # noqa: F401 + # enables import kapture # noqa: F401 from tools.kapture_export_ply import export_ply diff --git a/tests/test_rosbag.py b/tests/test_rosbag.py index ca573dd..fba63ed 100755 --- a/tests/test_rosbag.py +++ b/tests/test_rosbag.py @@ -10,7 +10,7 @@ import tempfile import unittest # kapture -import path_to_kapture # enables import kapture # noqa: F401 + # enables import kapture # noqa: F401 import kapture from kapture.algo.compare import equal_kapture from kapture.core.Sensors import Camera, CameraType diff --git a/tests/test_tar.py b/tests/test_tar.py index 8c482c6..045b89b 100755 --- a/tests/test_tar.py +++ b/tests/test_tar.py @@ -4,7 +4,7 @@ import os.path as path import unittest # kapture -import path_to_kapture # enables import kapture # noqa: F401 + # enables import kapture # noqa: F401 import kapture from kapture.io.features import FEATURE_FILE_EXTENSION, get_keypoints_fullpath, image_keypoints_from_file from kapture.algo.compare import equal_kapture, equal_sensors, equal_records_gnss diff --git a/tests/test_utils.py b/tests/test_utils.py index 82d15a0..ab6d599 100755 --- a/tests/test_utils.py +++ b/tests/test_utils.py @@ -10,7 +10,7 @@ import tempfile import unittest # kapture -import path_to_kapture # enables import kapture # noqa: F401 + # enables import kapture # noqa: F401 import kapture import kapture.utils.computation as computation import kapture.utils.paths diff --git a/tests/test_virtual_gallery.py b/tests/test_virtual_gallery.py index 3904286..016243d 100755 --- a/tests/test_virtual_gallery.py +++ b/tests/test_virtual_gallery.py @@ -5,7 +5,7 @@ import os.path as path import tempfile # kapture -import path_to_kapture # enables import kapture # noqa: F401 + # enables import kapture # noqa: F401 from kapture.io.csv import kapture_from_dir from kapture.algo.compare import equal_kapture from kapture.converter.virtual_gallery.import_virtual_gallery import import_virtual_gallery # noqa: E402 diff --git a/tools/kapture_data_date_ranges.py b/tools/kapture_data_date_ranges.py index 3047161..709e52d 100755 --- a/tools/kapture_data_date_ranges.py +++ b/tools/kapture_data_date_ranges.py @@ -12,7 +12,7 @@ import re from datetime import datetime -import path_to_kapture # noqa: F401 + # noqa: F401 import kapture import kapture.utils.computation as computation import kapture.utils.logging diff --git a/tools/kapture_download_dataset.py b/tools/kapture_download_dataset.py index 90b9492..6f52c17 100755 --- a/tools/kapture_download_dataset.py +++ b/tools/kapture_download_dataset.py @@ -16,7 +16,7 @@ from typing import Dict, Optional, List, Set from tqdm import tqdm import textwrap -import path_to_kapture # noqa: F401 + # noqa: F401 # import kapture import kapture.utils.logging from kapture.converter.downloader.download import download_file, get_remote_file_size diff --git a/tools/kapture_export_4seasons_pairs.py b/tools/kapture_export_4seasons_pairs.py index 7d0deb5..01e9049 100755 --- a/tools/kapture_export_4seasons_pairs.py +++ b/tools/kapture_export_4seasons_pairs.py @@ -16,7 +16,7 @@ from tqdm import tqdm # kapture -import path_to_kapture # noqa: F401 + # noqa: F401 import kapture import kapture.utils.logging import kapture.io.csv as csv diff --git a/tools/kapture_export_ETH_MS_LTVL.py b/tools/kapture_export_ETH_MS_LTVL.py index d4f60fc..46920cb 100755 --- a/tools/kapture_export_ETH_MS_LTVL.py +++ b/tools/kapture_export_ETH_MS_LTVL.py @@ -17,7 +17,7 @@ import argparse from tqdm import tqdm -import path_to_kapture # noqa: F401 + # noqa: F401 import kapture from kapture.core.Trajectories import rigs_recover import kapture.utils.logging diff --git a/tools/kapture_export_LTVL2020.py b/tools/kapture_export_LTVL2020.py index 8601fc6..63e1882 100755 --- a/tools/kapture_export_LTVL2020.py +++ b/tools/kapture_export_LTVL2020.py @@ -18,7 +18,7 @@ import argparse from tqdm import tqdm -import path_to_kapture # noqa: F401 + # noqa: F401 import kapture import kapture.utils.logging import kapture.io.features diff --git a/tools/kapture_export_colmap.py b/tools/kapture_export_colmap.py index 25bb7aa..b93e858 100755 --- a/tools/kapture_export_colmap.py +++ b/tools/kapture_export_colmap.py @@ -8,7 +8,7 @@ import argparse import logging import sys -import path_to_kapture # enables import kapture # noqa: F401 + # enables import kapture # noqa: F401 import kapture import kapture.utils.logging from kapture.converter.colmap.export_colmap import export_colmap diff --git a/tools/kapture_export_depth_images.py b/tools/kapture_export_depth_images.py index ffba9fe..114f7af 100644 --- a/tools/kapture_export_depth_images.py +++ b/tools/kapture_export_depth_images.py @@ -12,7 +12,7 @@ from tqdm import tqdm import numpy as np from PIL import Image -import path_to_kapture # noqa: F401 + # noqa: F401 import kapture import kapture.utils.logging import kapture.io.csv as csv diff --git a/tools/kapture_export_image_list.py b/tools/kapture_export_image_list.py index f3bae04..48b6a7d 100755 --- a/tools/kapture_export_image_list.py +++ b/tools/kapture_export_image_list.py @@ -9,7 +9,7 @@ import os import argparse # kapture -import path_to_kapture # noqa: F401 + # noqa: F401 import kapture import kapture.utils.logging from kapture.io.csv import kapture_from_dir diff --git a/tools/kapture_export_openmvg.py b/tools/kapture_export_openmvg.py index 85a7284..74525a6 100755 --- a/tools/kapture_export_openmvg.py +++ b/tools/kapture_export_openmvg.py @@ -10,7 +10,7 @@ import sys import os.path as path # kapture -import path_to_kapture # enables import kapture # noqa: F401 + # enables import kapture # noqa: F401 import kapture.utils.logging from kapture.io.records import TransferAction from kapture.converter.openmvg.export_openmvg import export_openmvg diff --git a/tools/kapture_export_opensfm.py b/tools/kapture_export_opensfm.py index c71b409..5a1a1e1 100755 --- a/tools/kapture_export_opensfm.py +++ b/tools/kapture_export_opensfm.py @@ -4,7 +4,7 @@ import argparse import logging import os.path as path -import path_to_kapture # enables import kapture # noqa: F401 + # enables import kapture # noqa: F401 import kapture import kapture.utils.logging from kapture.io.records import TransferAction diff --git a/tools/kapture_export_ply.py b/tools/kapture_export_ply.py index 17df8c3..7381fcd 100755 --- a/tools/kapture_export_ply.py +++ b/tools/kapture_export_ply.py @@ -13,7 +13,7 @@ from tqdm import tqdm import numpy as np -import path_to_kapture # noqa: F401 + # noqa: F401 import kapture import kapture.utils.logging import kapture.io.csv as csv diff --git a/tools/kapture_extract_exif.py b/tools/kapture_extract_exif.py index c5408eb..8c50e0a 100755 --- a/tools/kapture_extract_exif.py +++ b/tools/kapture_extract_exif.py @@ -6,7 +6,7 @@ import argparse import logging import os.path as path -import path_to_kapture # noqa: F401 + # noqa: F401 import kapture from kapture.converter.exif.import_exif import import_gps_from_exif diff --git a/tools/kapture_import_12scenes.py b/tools/kapture_import_12scenes.py index 932468c..10fdac5 100755 --- a/tools/kapture_import_12scenes.py +++ b/tools/kapture_import_12scenes.py @@ -26,7 +26,7 @@ from tqdm import tqdm from scipy import ndimage # kapture -import path_to_kapture # noqa: F401 + # noqa: F401 import kapture import kapture.utils.logging from kapture.io.structure import delete_existing_kapture_files diff --git a/tools/kapture_import_4seasons.py b/tools/kapture_import_4seasons.py index 5ce64fa..abf6fa8 100755 --- a/tools/kapture_import_4seasons.py +++ b/tools/kapture_import_4seasons.py @@ -44,7 +44,7 @@ from dataclasses import dataclass from typing import List, Dict, Tuple, Union # kapture -import path_to_kapture # noqa: F401 + # noqa: F401 import kapture import kapture.utils.logging from kapture.io.structure import delete_existing_kapture_files diff --git a/tools/kapture_import_7scenes.py b/tools/kapture_import_7scenes.py index a96974d..498de8c 100755 --- a/tools/kapture_import_7scenes.py +++ b/tools/kapture_import_7scenes.py @@ -24,7 +24,7 @@ from PIL import Image from tqdm import tqdm # kapture -import path_to_kapture # noqa: F401 + # noqa: F401 import kapture import kapture.utils.logging from kapture.io.structure import delete_existing_kapture_files diff --git a/tools/kapture_import_Extended_CMU_Seasons.py b/tools/kapture_import_Extended_CMU_Seasons.py index 3c936ca..38e62e3 100755 --- a/tools/kapture_import_Extended_CMU_Seasons.py +++ b/tools/kapture_import_Extended_CMU_Seasons.py @@ -64,7 +64,7 @@ from typing import List, Optional, Tuple # kapture -import path_to_kapture # noqa: F401 + # noqa: F401 import kapture import kapture.utils.logging from kapture.io.structure import delete_existing_kapture_files diff --git a/tools/kapture_import_IDL_dataset_cvpr17.py b/tools/kapture_import_IDL_dataset_cvpr17.py index f2759b3..80e8dad 100755 --- a/tools/kapture_import_IDL_dataset_cvpr17.py +++ b/tools/kapture_import_IDL_dataset_cvpr17.py @@ -37,7 +37,7 @@ from typing import Union # kapture -import path_to_kapture # noqa: F401 + # noqa: F401 import kapture import kapture.utils.logging from kapture.io.structure import delete_existing_kapture_files diff --git a/tools/kapture_import_RIO10.py b/tools/kapture_import_RIO10.py index 59ac00c..95c7b88 100755 --- a/tools/kapture_import_RIO10.py +++ b/tools/kapture_import_RIO10.py @@ -22,7 +22,7 @@ from PIL import Image from tqdm import tqdm # kapture -import path_to_kapture # noqa: F401 + # noqa: F401 import kapture import kapture.utils.logging from kapture.io.structure import delete_existing_kapture_files diff --git a/tools/kapture_import_RobotCar_Seasons.py b/tools/kapture_import_RobotCar_Seasons.py index 2b4410c..f15b1a0 100755 --- a/tools/kapture_import_RobotCar_Seasons.py +++ b/tools/kapture_import_RobotCar_Seasons.py @@ -47,7 +47,7 @@ import re from typing import Dict # kapture -import path_to_kapture # noqa: F401 + # noqa: F401 import kapture import kapture.utils.logging from kapture.io.structure import delete_existing_kapture_files diff --git a/tools/kapture_import_bundler.py b/tools/kapture_import_bundler.py index e84f5a2..a9eb6d3 100755 --- a/tools/kapture_import_bundler.py +++ b/tools/kapture_import_bundler.py @@ -45,7 +45,7 @@ import quaternion from PIL import Image # kapture -import path_to_kapture # noqa: F401 + # noqa: F401 import kapture import kapture.utils.logging from kapture.io.structure import delete_existing_kapture_files diff --git a/tools/kapture_import_colmap.py b/tools/kapture_import_colmap.py index 94ac46f..8d47e3c 100755 --- a/tools/kapture_import_colmap.py +++ b/tools/kapture_import_colmap.py @@ -13,7 +13,7 @@ import os import sys -import path_to_kapture # enables import kapture # noqa: F401 + # enables import kapture # noqa: F401 import kapture import kapture.utils.logging import kapture.io.csv diff --git a/tools/kapture_import_image_folder.py b/tools/kapture_import_image_folder.py index c30c81d..4e27ed7 100755 --- a/tools/kapture_import_image_folder.py +++ b/tools/kapture_import_image_folder.py @@ -13,7 +13,7 @@ from PIL import Image # kapture -import path_to_kapture # noqa: F401 + # noqa: F401 import kapture import kapture.utils.logging from kapture.io.structure import delete_existing_kapture_files diff --git a/tools/kapture_import_image_list.py b/tools/kapture_import_image_list.py index ff1fe1b..eabb91c 100755 --- a/tools/kapture_import_image_list.py +++ b/tools/kapture_import_image_list.py @@ -14,7 +14,7 @@ from typing import List # kapture -import path_to_kapture # noqa: F401 + # noqa: F401 import kapture import kapture.utils.logging from kapture.io.structure import delete_existing_kapture_files diff --git a/tools/kapture_import_image_list_with_poses.py b/tools/kapture_import_image_list_with_poses.py index 9d6f125..299acce 100755 --- a/tools/kapture_import_image_list_with_poses.py +++ b/tools/kapture_import_image_list_with_poses.py @@ -18,7 +18,7 @@ from typing import List # kapture -import path_to_kapture # noqa: F401 + # noqa: F401 import kapture import kapture.utils.logging from kapture.io.csv import table_from_file, kapture_to_dir diff --git a/tools/kapture_import_nvm.py b/tools/kapture_import_nvm.py index 5163040..4c967b6 100755 --- a/tools/kapture_import_nvm.py +++ b/tools/kapture_import_nvm.py @@ -38,7 +38,7 @@ from typing import List, Optional, Set # kapture -import path_to_kapture # noqa: F401 + # noqa: F401 import kapture import kapture.utils.logging from kapture.io.structure import delete_existing_kapture_files diff --git a/tools/kapture_import_openmvg.py b/tools/kapture_import_openmvg.py index 8dce62e..933e623 100755 --- a/tools/kapture_import_openmvg.py +++ b/tools/kapture_import_openmvg.py @@ -11,7 +11,7 @@ import os.path as path # kapture -import path_to_kapture # enables import kapture # noqa: F401 + # enables import kapture # noqa: F401 import kapture.utils.logging from kapture.io.records import TransferAction # openmvg diff --git a/tools/kapture_import_opensfm.py b/tools/kapture_import_opensfm.py index 18c2303..6a91e7d 100755 --- a/tools/kapture_import_opensfm.py +++ b/tools/kapture_import_opensfm.py @@ -4,7 +4,7 @@ import argparse import logging import os.path as path -import path_to_kapture # enables import kapture # noqa: F401 + # enables import kapture # noqa: F401 import kapture from kapture.io.records import TransferAction from kapture.converter.opensfm.import_opensfm import import_opensfm diff --git a/tools/kapture_import_rosbag.py b/tools/kapture_import_rosbag.py index e7a9efb..fc85b0d 100755 --- a/tools/kapture_import_rosbag.py +++ b/tools/kapture_import_rosbag.py @@ -11,7 +11,7 @@ from os import path import sys # kapture -import path_to_kapture # enables import kapture # noqa: F401 + # enables import kapture # noqa: F401 import kapture.io.csv as kcsv import kapture.utils.logging diff --git a/tools/kapture_import_silda.py b/tools/kapture_import_silda.py index efe0907..1bf0ee4 100755 --- a/tools/kapture_import_silda.py +++ b/tools/kapture_import_silda.py @@ -17,7 +17,7 @@ import quaternion from typing import Any, Dict, Optional from tqdm import tqdm -import path_to_kapture # noqa: F401 + # noqa: F401 import kapture import kapture.utils.logging import kapture.io.csv diff --git a/tools/kapture_import_stereolabs.py b/tools/kapture_import_stereolabs.py index 1cc5396..02849ce 100755 --- a/tools/kapture_import_stereolabs.py +++ b/tools/kapture_import_stereolabs.py @@ -15,7 +15,7 @@ from tqdm import tqdm import csv # kapture -import path_to_kapture # noqa: F401 + # noqa: F401 import kapture import kapture.utils.logging from kapture.io.csv import kapture_to_dir diff --git a/tools/kapture_import_symphony_seasons.py b/tools/kapture_import_symphony_seasons.py index 06aeb23..b117e85 100755 --- a/tools/kapture_import_symphony_seasons.py +++ b/tools/kapture_import_symphony_seasons.py @@ -8,7 +8,7 @@ import quaternion from typing import Optional -import path_to_kapture # noqa: F401 + # noqa: F401 import kapture from kapture.io.structure import delete_existing_kapture_files from kapture.io.csv import kapture_to_dir diff --git a/tools/kapture_import_utbm.py b/tools/kapture_import_utbm.py index 5d4c115..10d5b6f 100755 --- a/tools/kapture_import_utbm.py +++ b/tools/kapture_import_utbm.py @@ -14,7 +14,7 @@ import logging import sys # kapture -import path_to_kapture # enables import kapture # noqa: F401 + # enables import kapture # noqa: F401 import kapture.core.Sensors import kapture.utils.logging diff --git a/tools/kapture_import_virtual_gallery.py b/tools/kapture_import_virtual_gallery.py index c98e806..e1646c7 100755 --- a/tools/kapture_import_virtual_gallery.py +++ b/tools/kapture_import_virtual_gallery.py @@ -30,7 +30,7 @@ import logging import argparse # kapture -import path_to_kapture # noqa: F401 + # noqa: F401 import kapture.utils.logging from kapture.converter.virtual_gallery.import_virtual_gallery import import_virtual_gallery from kapture.io.records import TransferAction diff --git a/tools/kapture_merge.py b/tools/kapture_merge.py index aece54a..80f103e 100755 --- a/tools/kapture_merge.py +++ b/tools/kapture_merge.py @@ -10,7 +10,7 @@ import os import sys # kapture -import path_to_kapture # noqa: F401 + # noqa: F401 import kapture import kapture.utils.logging from typing import List diff --git a/tools/kapture_print.py b/tools/kapture_print.py index f68254c..16aa439 100755 --- a/tools/kapture_print.py +++ b/tools/kapture_print.py @@ -14,7 +14,7 @@ from datetime import datetime import time -import path_to_kapture # noqa: F401 + # noqa: F401 import kapture import kapture.utils.logging import kapture.io.csv diff --git a/tools/kapture_rename_features.py b/tools/kapture_rename_features.py index 6f36753..0a8de7c 100755 --- a/tools/kapture_rename_features.py +++ b/tools/kapture_rename_features.py @@ -11,7 +11,7 @@ import argparse import shutil -import path_to_kapture # noqa: F401 + # noqa: F401 import kapture import kapture.utils.logging import kapture.io.features diff --git a/tools/kapture_upgrade_1_0_to_1_1.py b/tools/kapture_upgrade_1_0_to_1_1.py index dabe297..a3331e1 100755 --- a/tools/kapture_upgrade_1_0_to_1_1.py +++ b/tools/kapture_upgrade_1_0_to_1_1.py @@ -15,7 +15,7 @@ # so that types written as "np.float32" are understood by read_old_image_features_csv import numpy as np # noqa: F401 -import path_to_kapture # noqa: F401 + # noqa: F401 import kapture import kapture.utils.logging from kapture.io.structure import delete_existing_kapture_files diff --git a/tools/kapture_upgrade_1_0_to_1_1_inplace.py b/tools/kapture_upgrade_1_0_to_1_1_inplace.py index fac17ff..28d0ded 100755 --- a/tools/kapture_upgrade_1_0_to_1_1_inplace.py +++ b/tools/kapture_upgrade_1_0_to_1_1_inplace.py @@ -11,7 +11,7 @@ # so that types written as "np.float32" are understood by read_old_image_features_csv import numpy as np # noqa: F401 -import path_to_kapture # noqa: F401 + # noqa: F401 import kapture import kapture.utils.logging import kapture.io.features diff --git a/tools/kapture_upgrade_1_0_to_1_1_orphan_features.py b/tools/kapture_upgrade_1_0_to_1_1_orphan_features.py index a923789..5ba19cf 100755 --- a/tools/kapture_upgrade_1_0_to_1_1_orphan_features.py +++ b/tools/kapture_upgrade_1_0_to_1_1_orphan_features.py @@ -8,7 +8,7 @@ import logging import argparse -import path_to_kapture # noqa: F401 + # noqa: F401 import kapture.utils.logging from kapture.utils.upgrade import upgrade_1_0_to_1_1_orphan_features diff --git a/tools/path_to_kapture.py b/tools/path_to_kapture.py deleted file mode 100644 index 511299a..0000000 --- a/tools/path_to_kapture.py +++ /dev/null @@ -1,11 +0,0 @@ -# Copyright 2020-present NAVER Corp. Under BSD 3-clause license - -import sys -import os.path as path -# when developing, prefer local kapture to the one installed on the system -HERE_PATH = path.normpath(path.dirname(__file__)) -REPO_ROOT_PATH = path.normpath(path.dirname(HERE_PATH)) -# check the presence of kapture directory in repo to be sure its not the installed version -if path.isdir(path.join(REPO_ROOT_PATH, 'kapture')): - # workaround for sibling import - sys.path.insert(0, REPO_ROOT_PATH)