Skip to content

Commit

Permalink
Update dataset docs and needed scripts
Browse files Browse the repository at this point in the history
Move flir related file to thermo scenes and update docs
to include all needed files
  • Loading branch information
MalcolmMielle committed Oct 29, 2024
1 parent 8c93588 commit 86cb0cf
Show file tree
Hide file tree
Showing 8 changed files with 67 additions and 7 deletions.
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,5 @@
/data
/outputs
**/__pycache__/**
/env
/env
/FlirImageExtractor
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ packages = ["thermo_nerf", "thermo_scenes"]

[tool.isort]
profile = "black"
known_third_party = ["nerfstudio"]
known_third_party = ["nerfstudio", "FlirImageExtractor"]

[project.scripts]
thermoscenes_images_to_nerf_dataset = "thermo_scenes.scripts.images_to_nerf_dataset:main"
Expand Down
2 changes: 1 addition & 1 deletion tests/test_thermal_conversion.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
import pandas as pd
from numpy.testing import assert_almost_equal

from thermo_nerf.flir_thermal_images.thermal_visualiser import ThermalVisualiser
from thermo_scenes.flir_thermal_images.thermal_visualiser import ThermalVisualiser


class CustomThermalVisualiser(ThermalVisualiser):
Expand Down
63 changes: 61 additions & 2 deletions thermo_scenes/docs/Collect_new_dataset.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ You must use FLIR cloud service to transfer the images to your computer:
- Then, download one by one the RGB DC images by opening them in the gallery.
This step is necessary to align the RGB and thermal image; using the MSX image to extract both will result in non-aligned RGB/thermal images.

Save all your MSX images to one folder and your RGB into another one.
Save all your MSX images to one folder named "MSX" and your RGB into another one.

## Data extraction

Expand Down Expand Up @@ -87,6 +87,37 @@ thermoscenes_rename_files --path-to-folder <path_to_folders>
With `<path_to_folders>` the folder that contains the four folders created earlier.
The renamed files are saved in a folder named "\<FOLDER NAME\>_processed".

To finalize the creation of the dataset, copy all processed thermal and rgb images (train and eval) in (respectively) the folders "images" and "thermal".
You should have a structure like this one in the end:

```python
your_scene
|--images # includes the RGB images
|--frame_eval_0000.jpg
|--...
|--frame_eval_N.jpg
|--frame_train_0000.jpg
|--...
|--frame_train_N2.jpg
|--thermal # includes the thermal images
|--frame_eval_0000.PNG
|--...
|--frame_eval_N.PNG
|--frame_train_0000.PNG
|--...
|--frame_train_N2.PNG
|--msx # includes the MSX images
|--frame_eval_0000.jpg
|--...
|--frame_eval_N.jpg
|--frame_train_0000.jpg
|--...
|--frame_train_N2.jpg
|--temperature_bounds.json
```

> Make sure that the `temperature_bounds.json` file is included.
## Get poses with COLMAP

To run COLMAP on the dataset you created:
Expand All @@ -95,6 +126,34 @@ To run COLMAP on the dataset you created:
thermoscenes_images_to_nerf_dataset --matching_method exhaustive --data <path_to_processed_rgb_train_data> --output-dir <output_folder> --num-downscales 0 --eval-data <path_to_processed_rgb_eval_data> --update-colmap-json
```

In <output_folder> create a folder named "thermal" and copy all processed/renamed thermal images to it.
You should get a file named `transforms_thermal.json` that you can put in the root folder of your scene.
You should end up with a data folder looking like:

```txt
your_scene
|--images
|--frame_eval_0000.jpg
|--...
|--frame_eval_N.jpg
|--frame_train_0000.jpg
|--...
|--frame_train_N2.jpg
|--thermal
|--frame_eval_0000.PNG
|--...
|--frame_eval_N.PNG
|--frame_train_0000.PNG
|--...
|--frame_train_N2.PNG
|--msx
|--frame_eval_0000.jpg
|--...
|--frame_eval_N.jpg
|--frame_train_0000.jpg
|--...
|--frame_train_N2.jpg
|--temperature_bounds.json
|--transforms_thermal.json
```

The new scene dataset is complete.
2 changes: 1 addition & 1 deletion thermo_scenes/scripts/preprocess_thermal.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

import tyro

from thermo_nerf.flir_thermal_images.custom_flir import CustomFlir
from thermo_scenes.flir_thermal_images.custom_flir import CustomFlir


@dataclass
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
import matplotlib.pyplot as plt
import tyro

from rebel_nerf.flir_themral_images.thermal_visualiser import ThermalVisualiser
from thermo_scenes.flir_thermal_images.thermal_visualiser import ThermalVisualiser


@dataclass
Expand Down

0 comments on commit 86cb0cf

Please sign in to comment.