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.
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
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.
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.
For fast CPU-based rendering on a headless server, we recommend installing bop_renderer, an off-screen C++ renderer with Python bindings.
Download the BOP datasets and make sure they are in the expected folder structure.
Estimate poses and save them in one .csv file per dataset (format description).
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.
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).
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
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
.
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.
python scripts/calc_gt_coco.py
Set the dataset and split parameters in the top section of the script.
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
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