Skip to content

Commit

Permalink
Add conversion code to the BOP format (#12)
Browse files Browse the repository at this point in the history
Summary:
This PR contains 3 scripts to convert the HOT3D-Clips dataset from its native format to the BOP format. The BOP format had to be extended because the original format only included RGB and depth modalities. This extension made it possible to include a varying number of modalities (RGB, gray1, gray2) with separate annotations for each modality. The dataset has already been converted using these scripts and uploaded to the [BOP website](https://bop.felk.cvut.cz/datasets/). These scripts went through several revisions, as the conversion process required multiple changes to adapt the dataset to the new standard format, which was initially not strictly defined and required frequent adjustments. The scripts in this PR are isolated and do not make any changes to the existing code in the repository.

The 3 Scripts are:
1. hot3d_models_to_bop.py : Script that converts the 3D object (full) models from the GLTF format to the PLY format
2. hot3d_models_eval_to_bop.py: Script to convert the eval object model
3. hot3d_clips_to_bop_scenewise.py: Script to convert the dataset itself

Pull Request resolved: #12

Reviewed By: prithvirb

Differential Revision: D62526222

Pulled By: SeaOtocinclus

fbshipit-source-id: 8ff1cb1f0368d91d7b1ad63300ecf7e9146cdb5d
  • Loading branch information
AnasIbrahim authored and facebook-github-bot committed Sep 16, 2024
1 parent 09b62e6 commit 1d766a3
Show file tree
Hide file tree
Showing 4 changed files with 653 additions and 0 deletions.
48 changes: 48 additions & 0 deletions hot3d/clips/bop_format_converters/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
# Scripts to convert HOT3D dataset from its native format to the BOP format.

### Set Environment Variables

Before running the scripts, set the following environment variables:

- `HOT3D_DIR`: Path to the HOT3D dataset directory. Converted data will be saved to the same folder.

```bash
export HOT3D_DIR=<PATH_TO_HOT3D_DATASET>
```

### Convert the object models from HOT3D format to BOP format

To convert (full) models:

```bash
python hot3d_models_to_bop.py --input-gltf-dir $HOT3D_DIR/object_models --output-bop-dir $HOT3D_DIR/models
```

To convert eval models:

```bash
python hot3d_models_eval_to_bop.py --input-gltf-dir $HOT3D_DIR/object_models_eval --output-bop-dir $HOT3D_DIR/models_eval
```

Copy the models info from both models and models_eval to the same directory:

```bash
cp $HOT3D_DIR/object_models/models_info.json $HOT3D_DIR/models/models_info.json
cp $HOT3D_DIR/object_models_eval/models_info.json $HOT3D_DIR/models_eval/models_info.json
```

### Convert HOT3D clips to BOP format

To convert HOT3D clips to BOP format, run the following command:

Parameters:
- --split: Options are "train_aria", "train_quest3", "test_aria", or "test_quest3"
- --num-threads: Optional, with a default of 4. You can use 4 or 8 threads for better performance.

```bash
# converted data to be saved to $HOT3D_DIR/<SPLIT_NAME>_scenewise
python hot3d_clips_to_bop_scenewise.py \
--hot3d-dataset-path $HOT3D_DIR \
--split <SPLIT_NAME> \
--num-threads <NUM_THREADS>
```
Loading

0 comments on commit 1d766a3

Please sign in to comment.