From a43725d63aeb2c9ec1509c0f5495d59905ff862b Mon Sep 17 00:00:00 2001 From: Malcolm Mielle Date: Tue, 19 Mar 2024 09:43:54 +0100 Subject: [PATCH] Fix pipeline --- .flake8 | 2 +- thermo_nerf/flir_thermal_images/custom_flir.py | 7 +------ thermo_nerf/thermal_nerf/thermal_dataparser.py | 3 ++- thermo_nerf/thermal_nerf/thermal_field_head.py | 3 ++- thermo_nerf/thermal_nerf/thermal_renderer.py | 3 ++- 5 files changed, 8 insertions(+), 10 deletions(-) diff --git a/.flake8 b/.flake8 index e0ea542..d988e59 100644 --- a/.flake8 +++ b/.flake8 @@ -1,3 +1,3 @@ [flake8] max-line-length = 88 -extend-ignore = E203 \ No newline at end of file +extend-ignore = E203, F722, F821 \ No newline at end of file diff --git a/thermo_nerf/flir_thermal_images/custom_flir.py b/thermo_nerf/flir_thermal_images/custom_flir.py index 199510a..e93378e 100644 --- a/thermo_nerf/flir_thermal_images/custom_flir.py +++ b/thermo_nerf/flir_thermal_images/custom_flir.py @@ -3,11 +3,10 @@ import numpy as np import pandas as pd +from FlirImageExtractor.flir_image_extractor import FlirImageExtractor from matplotlib import cm from PIL import Image -from FlirImageExtractor.flir_image_extractor import FlirImageExtractor - def get_min_max_temperatures(path_to_csv_files: str) -> tuple[float, float]: """ @@ -87,10 +86,6 @@ def save_normalised_thermal_images( self.absolute_max_temperature, ) - # temperature = temperature.reshape(640, 480) - # image = Image.fromarray(temperature) - # image.save(Path(path_to_thermal_images_curated, Path(path).stem + ".tiff")) - gray_scale_image = temperature.reshape(640, 480).astype("uint8") Image.fromarray(gray_scale_image, mode="L").save( diff --git a/thermo_nerf/thermal_nerf/thermal_dataparser.py b/thermo_nerf/thermal_nerf/thermal_dataparser.py index 9a2e40a..f3dc96d 100644 --- a/thermo_nerf/thermal_nerf/thermal_dataparser.py +++ b/thermo_nerf/thermal_nerf/thermal_dataparser.py @@ -222,7 +222,8 @@ def _generate_dataparser_outputs(self, split: str = "train") -> DataparserOutput poses[:, :3, 3] *= scale_factor - # Choose image_filenames and poses based on split, but after auto orient and scaling the poses. + # Choose image_filenames and poses based on split, but after auto orient + # and scaling the poses. image_filenames = [image_filenames[i] for i in indices] thermal_filenames = ( diff --git a/thermo_nerf/thermal_nerf/thermal_field_head.py b/thermo_nerf/thermal_nerf/thermal_field_head.py index 4b4c58a..0e30bcd 100644 --- a/thermo_nerf/thermal_nerf/thermal_field_head.py +++ b/thermo_nerf/thermal_nerf/thermal_field_head.py @@ -62,7 +62,8 @@ def forward( """ if not self.net: raise SystemError( - "in_dim not set. Must be provided to constructor, or set_in_dim() should be called." + "in_dim not set. Must be provided to constructor, or set_in_dim()" + " should be called." ) out_tensor = self.net(in_tensor) if self.activation: diff --git a/thermo_nerf/thermal_nerf/thermal_renderer.py b/thermo_nerf/thermal_nerf/thermal_renderer.py index 27c74d7..2e1cfea 100644 --- a/thermo_nerf/thermal_nerf/thermal_renderer.py +++ b/thermo_nerf/thermal_nerf/thermal_renderer.py @@ -33,7 +33,8 @@ def combine_thermal( num_rays: Optional[int] = None, ) -> Float[Tensor, "*bs 3"]: """Composite samples along ray and render color image. - If background color is random, no BG color is added - as if the background was black! + If background color is random, no BG color is added - as if the background was + black! Args: thermal: thermal for each sample