Skip to content

A Python toolkit of the BOP benchmark for 6D object pose estimation.

License

Notifications You must be signed in to change notification settings

thodan/bop_toolkit

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

BOP Toolkit

A Python toolkit of the BOP benchmark for 6D object pose estimation (http://bop.felk.cvut.cz).

  • bop_toolkit_lib - The core Python library for i/o operations, calculation of pose errors, Python based rendering etc.
  • docs - Documentation and conventions.
  • scripts - Scripts for evaluation, rendering of training images, visualization of 6D object poses etc.

Installation

Python Dependencies

To install the required python libraries, run:

pip install -r requirements.txt -e .

In the case of problems, try to first run: pip install --upgrade pip setuptools

Vispy Renderer (default)

The Python based headless renderer with egl backend is implemented using Vispy. Vispy is installed using the pip command above. Note that the nvidia opengl driver might be required in case of any errors.

Python Renderer (deprecated)

Another Python based renderer is implemented using Glumpy which depends on freetype and GLFW. This implementation is similar to the vispy renderer since glumpy and vispy have similar apis, but this renderer does not support headless rendering. Glumpy is installed using the pip command above. On Linux, freetype and GLFW can be installed by:

apt-get install freetype
apt-get install libglfw3

To install freetype and GLFW on Windows, follow these instructions.

GLFW serves as a backend of Glumpy. Another backend can be used but were not tested with our code.

C++ Renderer

For fast CPU-based rendering on a headless server, we recommend installing bop_renderer, an off-screen C++ renderer with Python bindings.

Usage

1. Get the BOP datasets

Download the BOP datasets and make sure they are in the expected folder structure.

2. Run your method

Estimate poses and save them in one .csv file per dataset (format description).

3. Configure the BOP Toolkit

In bop_toolkit_lib/config.py, set paths to the BOP datasets, to a folder with results to be evaluated, and to a folder for the evaluation output. The other parameters are necessary only if you want to visualize results or run the C++ Renderer.

4. Evaluate the pose estimates for 6D detection task

python scripts/eval_bop24_pose.py --result_filenames=NAME_OF_CSV_WITH_RESULTS --use_gpu

--use_gpu: Use GPU for the evaluation which requires PyTorch installed and a GPU with CUDA support. The current implementation limits GPU memory usage to less than 2GB for BOP servers. If you have GPUs with larger memory, you can increase the limit by setting the max_batch_size parameter. If GPU is not used, the evaluation is performed on CPU with 10 parallel processes. You can change the number of processes by setting the --num_worker 1.

--result_filenames: Comma-separated filenames with pose estimates in .csv (examples).

HOT3D special case

The Hand Tracking Toolkit Fisheye camera implementation is necessary for evaluation on the HOT3D dataset. Install with:

pip install git+https://github.com/facebookresearch/hand_tracking_toolkit

5. Evaluate the pose estimates for 6D localization task

python scripts/eval_bop19_pose.py --renderer_type=vispy --result_filenames=NAME_OF_CSV_WITH_RESULTS

--renderer_type: "vispy", "python", or "cpp" (We recommend using "vispy" since it is easy to install and works headlessly. For "cpp", you need to install the C++ Renderer bop_renderer.).

--result_filenames: Comma-separated filenames with pose estimates in .csv (examples).

By default, this script is run with 10 parallel processes. You can change the number of processes by setting the --num_worker 1.

6. Evaluate the detections / instance segmentations

python scripts/eval_bop22_coco.py --result_filenames=NAME_OF_JSON_WITH_COCO_RESULTS --ann_type='bbox'

--result_filenames: Comma-separated filenames with per-dataset coco results (place them under your results_path defined in your config.py).
--ann_type: 'bbox' to evaluate amodal bounding boxes. 'segm' to evaluate segmentation masks.

Convert BOP to COCO format

python scripts/calc_gt_coco.py

Set the dataset and split parameters in the top section of the script.

Manual annotation tool

To annotate a new dataset in BOP format use this tool.

First install Open3d dependency

pip install open3d==0.15.2

Edit the file paths in parameters section at the beginning of the file then run:

python scripts/annotation_tool.py

Interface:

Control the object pose with the following keys i: up, ,: down, j: front, k:back, h:left, l:right

Translation/rotation mode:

  • Shift not clicked: translation mode
  • Shift clicked: rotation model

Distance/angle big or small:

  • Ctrl not clicked: small distance(1mm) / angle(2deg)
  • Ctrl clicked: big distance(5cm) / angle(90deg)

R or "Refine" button will call ICP algorithm to do local refinement of the annotation

About

A Python toolkit of the BOP benchmark for 6D object pose estimation.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages