Skip to content

kzorina/vojta_bop

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:

conda create -n bop python=3.10
pip install scipy kiwisolver matplotlib imageio pypng Cython PyOpenGL triangle opencv-python Pillow vispy webdataset numpy
pip install -e .

Old install

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

python scripts/eval_bop19.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).

5. 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

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages