naver / kapture

kapture is a file format as well as a set of tools for manipulating datasets, and in particular Visual Localization and Structure from Motion data.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

module 'kapture.io.csv' has no attribute 'get_all_tar_handlers'

IaroslavS opened this issue · comments

Hi !
I have an error "module 'kapture.io.csv' has no attribute 'get_all_tar_handlers'" after executing string in python

tar_handlers = csv.get_all_tar_handlers(dataset_path)

Here are my steps:

Have cloned this repo, created docker images in according to guide, then I had to correct launch of docker container in order to launch jupyter notebook inside docker container:

docker run -it --rm --runtime=nvidia \
                  --volume <path_to_all_my_dataset>:/dataset:rw kapture/kapture --privileged --net "host" -p 8888:8888

Then I had to install jupterlab inside docker container due to absence this package in DockerFile for kapture:

 pip install jupyterlab notebook

After that I launched jupyter notebook:

jupyter notebook --ip 0.0.0.0 --port 8888 --no-browser --allow-root

Then I opened jupyter notebook and executed the following strings:

import sys
REPO_ROOT_PATH = '/opt/src/kapture/'
sys.path.insert(0, REPO_ROOT_PATH)
import kapture
import kapture.io.csv as csv

dataset_path = '/dataset/NAVER_Labs/'
tar_handlers = csv.get_all_tar_handlers(dataset_path)

After the last command I got the error :

---------------------------------------------------------------------------
AttributeError                            Traceback (most recent call last)
<ipython-input-7-958e2eb94904> in <module>
----> 1 tar_handlers = csv.get_all_tar_handlers(dataset_path)

AttributeError: module 'kapture.io.csv' has no attribute 'get_all_tar_handlers'

How to resolve this error ?

commented

Hi,

Thanks for reporting this error.
Unfortunately I am unable to reproduce this error.
I have to do some slight differences though :

  1. dataset
    I don not have the dataset of you example, so I am using one of the repo:
dataset_path = REPO_ROOT_PATH + 'dataset/symphony/mapping'
  1. docker run invocation
docker run -it --rm --runtime=nvidia -p 8888:8888 kapture/kapture

No need for mount nor privilges
Make sure port mapping comes before image name, and you have the latest version of docker image :

docker pull kapture/kapture:latest
  1. handler exists:
import sys
REPO_ROOT_PATH = '/opt/src/kapture/'
sys.path.insert(0, REPO_ROOT_PATH)
import kapture
import kapture.io.csv as csv

dataset_path = REPO_ROOT_PATH + 'dataset/symphony/mapping'
tar_handlers = csv.get_all_tar_handlers(dataset_path)

print(tar_handlers)

outputs:

<kapture.io.tar.TarCollection object at 0x7f7aa0416e10>

Maybe the bug is related to your specific dataset. Can you send it ?

Maybe the bug is related to your specific dataset. Can you send it ?

I've downloaded some parts of dataset "Gangnam Station and Hyundai Department Store Datasets" (https://www.visuallocalization.net/datasets/).
I created folder "NAVER_Labs" and put downloaded "GangnamStation_B1_release_mapping.tar.gz" and "HyundaiDepartmentStore_1F_release_mapping.tar.gz" there. Then I tried to call tar_handlers = csv.get_all_tar_handlers(dataset_path) when dataset_path is a folder to "NAVER_Labs".

I realised my mistake, I should have downloaded this dataset via kapture, not manually.

Manual download should work as well. Is it possible that you did not uncompress 'GangnamStation_B1_release_mapping.tar.gz' before calling the function?

commented

The kapture downloader will automatically untar the archive, and thus you will no longer need to use get_all_tar_handlers.
But as Martin mentioned, you still can untar manually.
If for some reasons you still want to use tar datasets you cannot use it like this, on the all dataset, but refer to :
https://github.com/naver/kapture#example-file-structure

Thanks, I see. My dataset was not organised as in https://github.com/naver/kapture#example-file-structure