# Copyright (c) OpenMMLab. All rights reserved. """ Hyperspectral Dataset Pipelines for MMDetection This file contains data pipelines for various hyperspectral datasets adapted from the ARMhsi/utils/datasets_maskgen.py file. """ import numpy as np from skimage.transform import resize as sk_resize import torch import torch.distributed as dist from scipy.io import loadmat import mmcv from mmcv.transforms import BaseTransform from mmcv.transforms.utils import cache_randomness from mmdet.registry import TRANSFORMS from mmdet.datasets.transforms import LoadAnnotations import mmengine from mmengine.registry import TRANSFORMS as MMENGINE_TRANSFORMS from mmengine.fileio import get import os from PIL import Image import cv2 import h5py import hdf5plugin import rasterio import spectral.io.envi as envi import tifffile import random from configs.hypervision import ds_load from configs.hypervision.hsi3d import get_image_loader import cupy as cp from typing import Dict, Iterable, List, Optional, Sequence, Tuple, Union import logging # from mmengine.logging import MMLogger from mmengine.logging import MMLogger from mmengine.runner import Runner _PIPELINE_RANK_LOGGERS: Dict[str, logging.Logger] = {} def _get_rank_logger( base_name: str = 'pipeline', logger_cache: Optional[Dict[str, logging.Logger]] = None, enable: bool = False, ) -> tuple[int, Optional[logging.Logger]]: if dist.is_available() and dist.is_initialized(): rank = dist.get_rank() else: rank = 0 if not enable: return rank, None cache = logger_cache if logger_cache is not None else _PIPELINE_RANK_LOGGERS logger_key = f'{base_name}.rank{rank}' logger = cache.get(logger_key) if logger is not None: return rank, logger work_dir = os.environ.get('MMDET_WORK_DIR', './work_dirs') try: runner = Runner.get_instance() if runner is not None and getattr(runner, 'work_dir', None): work_dir = runner.work_dir except Exception: pass log_dir = os.path.join(work_dir, 'rank_logs') os.makedirs(log_dir, exist_ok=True) log_path = os.path.join(log_dir, f'{base_name}_rank{rank}.log') logger = logging.getLogger(logger_key) if not logger.handlers: logger.setLevel(logging.INFO) logger.propagate = False handler = logging.FileHandler(log_path) formatter = logging.Formatter('%(asctime)s - %(levelname)s - %(message)s') handler.setFormatter(formatter) logger.addHandler(handler) cache[logger_key] = logger return rank, logger def read_HSD(filename): data = np.fromfile('%s' % filename, dtype=np.int32) height = data[0] width = data[1] SR = data[2] D = data[3] data = np.fromfile('%s' % filename, dtype=np.float32) a = 7 average = data[a:a + SR.item()] a = a + SR.item() coeff = data[a:a + D.item() * SR.item()].reshape((D.item(), SR.item())) a = a + D.item() * SR.item() scoredata = data[a:a + height.item() * width.item() * D.item()].reshape((height.item() * width.item(), D.item())) temp = np.dot(scoredata, coeff) data = (temp + average).reshape((height.item(), width.item(), SR.item())) # data = np.asnumpy(data) return data @TRANSFORMS.register_module() @MMENGINE_TRANSFORMS.register_module() class LoadHyperspectralImage(BaseTransform): """Load hyperspectral image from various formats. This transform handles loading of hyperspectral images from different file formats (.mat, .npy, .tif, .png) and normalizes them according to dataset-specific parameters. Required Keys: - img_path Modified Keys: - img - img_shape - ori_shape - img_path Args: dataset_type (str): Type of dataset ('harvard', 'umld2015', etc.) to_float32 (bool): Whether to convert to float32. Defaults to True. append_rgb (bool): Whether to append RGB channels. Defaults to False. """ def __init__( self, dataset_type='harvard', to_float32=True, append_rgb=True, enable_rank_logging=False, rank_logger_cache: Optional[Dict[str, logging.Logger]] = None, ): self.dataset_type = dataset_type self.to_float32 = to_float32 self.append_rgb = append_rgb self.enable_rank_logging = enable_rank_logging self.rank_logger_cache = rank_logger_cache # Dataset-specific parameters self._init_dataset_params() # Initialize wavelength information self._init_wavelength_params() def _init_dataset_params(self): """Initialize dataset-specific normalization parameters.""" if self.dataset_type == 'harvard': self.mean = [0.00050713, 0.00070553, 0.0011365, 0.00149156, 0.00197441, 0.00223908, 0.00271003, 0.00345612, 0.00369303, 0.00385219, 0.00435618, 0.00506823, 0.0070418, 0.00800666, 0.0064554, 0.00628767, 0.00703461, 0.00775983, 0.00832022, 0.00929337, 0.00898094, 0.00748522, 0.00755848, 0.00718764, 0.00699057, 0.00689327, 0.00674753, 0.00671624, 0.00751943, 0.00741207, 0.00676514] + [0.485, 0.456, 0.406] self.std = [0.00035424, 0.00053509, 0.0009189, 0.00122868, 0.00164547, 0.00186258, 0.00224559, 0.00286002, 0.0030474, 0.00315195, 0.00353866, 0.00406267, 0.0055249, 0.00622435, 0.00500298, 0.00480104, 0.0052598, 0.00571489, 0.00601454, 0.00659049, 0.00634349, 0.00530685, 0.00537778, 0.00513787, 0.00498475, 0.00488729, 0.00471964, 0.00454973, 0.00490581, 0.0046964, 0.00421346] + [0.229, 0.224, 0.225] self.max_val = 1.0 self.min_val = 0.0 self.bands = 31 elif self.dataset_type == 'umld2015': self.mean = [0.00049507, 0.00077369, 0.00086868, 0.00092949, 0.00106588, 0.00134611, 0.00148952, 0.00138134, 0.00147178, 0.00140757, 0.00146943, 0.0014896, 0.00158795, 0.0017375, 0.00171897, 0.00186404, 0.00182205, 0.00166717, 0.00176569, 0.00172996, 0.00177187, 0.00178079, 0.00172655, 0.00166295, 0.00167107, 0.0016319, 0.00167044, 0.00166259, 0.00153768, 0.0013869, 0.00148293, 0.0015571, 0.00129303] + [0.485, 0.456, 0.406] self.std = [0.0004163, 0.00053372, 0.00057629, 0.00060292, 0.00068114, 0.00085653, 0.00095103, 0.0008941, 0.00095387, 0.00092446, 0.00096502, 0.00096958, 0.00102551, 0.00111695, 0.00109679, 0.00118504, 0.00117788, 0.00107841, 0.00114765, 0.00113261, 0.00116322, 0.00116857, 0.0011256, 0.0010963, 0.00110381, 0.00108571, 0.00111103, 0.00111677, 0.00103602, 0.00092566, 0.0009724, 0.00101692, 0.00085337] + [0.229, 0.224, 0.225] self.max_val = 795.4633697273729 self.min_val = -1.2406029247200091e-05 self.bands = 33 elif self.dataset_type == 'umns2002': # UMNS2002 dataset parameters (31 bands) self.mean = [0.00050713, 0.00070553, 0.0011365, 0.00149156, 0.00197441, 0.00223908, 0.00271003, 0.00345612, 0.00369303, 0.00385219, 0.00435618, 0.00506823, 0.0070418, 0.00800666, 0.0064554, 0.00628767, 0.00703461, 0.00775983, 0.00832022, 0.00929337, 0.00898094, 0.00748522, 0.00755848, 0.00718764, 0.00699057, 0.00689327, 0.00674753, 0.00671624, 0.00751943, 0.00741207, 0.00676514] + [0.485, 0.456, 0.406] self.std = [0.00035424, 0.00053509, 0.0009189, 0.00122868, 0.00164547, 0.00186258, 0.00224559, 0.00286002, 0.0030474, 0.00315195, 0.00353866, 0.00406267, 0.0055249, 0.00622435, 0.00500298, 0.00480104, 0.0052598, 0.00571489, 0.00601454, 0.00659049, 0.00634349, 0.00530685, 0.00537778, 0.00513787, 0.00498475, 0.00488729, 0.00471964, 0.00454973, 0.00490581, 0.0046964, 0.00421346] + [0.229, 0.224, 0.225] self.max_val = 1.0 self.min_val = 0.0 self.bands = 31 elif self.dataset_type == 'umns2004': # UMNS2004 dataset parameters (33 bands) self.mean = [0.00049507, 0.00077369, 0.00086868, 0.00092949, 0.00106588, 0.00134611, 0.00148952, 0.00138134, 0.00147178, 0.00140757, 0.00146943, 0.0014896, 0.00158795, 0.0017375, 0.00171897, 0.00186404, 0.00182205, 0.00166717, 0.00176569, 0.00172996, 0.00177187, 0.00178079, 0.00172655, 0.00166295, 0.00167107, 0.0016319, 0.00167044, 0.00166259, 0.00153768, 0.0013869, 0.00148293, 0.0015571, 0.00129303] + [0.485, 0.456, 0.406] self.std = [0.0004163, 0.00053372, 0.00057629, 0.00060292, 0.00068114, 0.00085653, 0.00095103, 0.0008941, 0.00095387, 0.00092446, 0.00096502, 0.00096958, 0.00102551, 0.00111695, 0.00109679, 0.00118504, 0.00117788, 0.00107841, 0.00114765, 0.00113261, 0.00116322, 0.00116857, 0.0011256, 0.0010963, 0.00110381, 0.00108571, 0.00111103, 0.00111677, 0.00103602, 0.00092566, 0.0009724, 0.00101692, 0.00085337] + [0.229, 0.224, 0.225] self.max_val = 795.4633697273729 self.min_val = -1.2406029247200091e-05 self.bands = 33 elif self.dataset_type == 'umos': # UMOS dataset parameters (31 bands) self.mean = [0.00050713, 0.00070553, 0.0011365, 0.00149156, 0.00197441, 0.00223908, 0.00271003, 0.00345612, 0.00369303, 0.00385219, 0.00435618, 0.00506823, 0.0070418, 0.00800666, 0.0064554, 0.00628767, 0.00703461, 0.00775983, 0.00832022, 0.00929337, 0.00898094, 0.00748522, 0.00755848, 0.00718764, 0.00699057, 0.00689327, 0.00674753, 0.00671624, 0.00751943, 0.00741207, 0.00676514] + [0.485, 0.456, 0.406] self.std = [0.00035424, 0.00053509, 0.0009189, 0.00122868, 0.00164547, 0.00186258, 0.00224559, 0.00286002, 0.0030474, 0.00315195, 0.00353866, 0.00406267, 0.0055249, 0.00622435, 0.00500298, 0.00480104, 0.0052598, 0.00571489, 0.00601454, 0.00659049, 0.00634349, 0.00530685, 0.00537778, 0.00513787, 0.00498475, 0.00488729, 0.00471964, 0.00454973, 0.00490581, 0.0046964, 0.00421346] + [0.229, 0.224, 0.225] self.max_val = 1.0 self.min_val = 0.0 self.bands = 31 elif self.dataset_type == 'umri2015': # UMRI2015 dataset parameters (33 bands) self.mean = [0.00049507, 0.00077369, 0.00086868, 0.00092949, 0.00106588, 0.00134611, 0.00148952, 0.00138134, 0.00147178, 0.00140757, 0.00146943, 0.0014896, 0.00158795, 0.0017375, 0.00171897, 0.00186404, 0.00182205, 0.00166717, 0.00176569, 0.00172996, 0.00177187, 0.00178079, 0.00172655, 0.00166295, 0.00167107, 0.0016319, 0.00167044, 0.00166259, 0.00153768, 0.0013869, 0.00148293, 0.0015571, 0.00129303] + [0.485, 0.456, 0.406] self.std = [0.0004163, 0.00053372, 0.00057629, 0.00060292, 0.00068114, 0.00085653, 0.00095103, 0.0008941, 0.00095387, 0.00092446, 0.00096502, 0.00096958, 0.00102551, 0.00111695, 0.00109679, 0.00118504, 0.00117788, 0.00107841, 0.00114765, 0.00113261, 0.00116322, 0.00116857, 0.0011256, 0.0010963, 0.00110381, 0.00108571, 0.00111103, 0.00111677, 0.00103602, 0.00092566, 0.0009724, 0.00101692, 0.00085337] + [0.229, 0.224, 0.225] self.max_val = 795.4633697273729 self.min_val = -1.2406029247200091e-05 self.bands = 33 elif self.dataset_type == 'umemm': self.mean = [0.01173168, 0.01234073, 0.01300494, 0.01367329, 0.01436883, 0.0151207, 0.0155524, 0.01612679, 0.01647242, 0.0169334, 0.01737261, 0.01776505, 0.01821689, 0.01851488, 0.01895346, 0.01905013, 0.01976628, 0.02014966, 0.02034537, 0.02077717, 0.02100478, 0.02121398, 0.0215768, 0.02184028, 0.02216735, 0.02231407, 0.02260189, 0.02286339, 0.02325497, 0.0233728, 0.02365622, 0.02380282, 0.02444496] + [0.485, 0.456, 0.406] self.std = [0.00483212, 0.00528087, 0.00574404, 0.00611767, 0.00647407, 0.00695638, 0.0072416, 0.00756005, 0.00780453, 0.00815911, 0.00851377, 0.00878704, 0.00913599, 0.0093712, 0.0096884, 0.00983615, 0.01027443, 0.01053299, 0.01056043, 0.01087872, 0.01099751, 0.01115679, 0.01137956, 0.01154608, 0.01175272, 0.01184787, 0.01195576, 0.01215307, 0.0123245, 0.01232338, 0.01237378, 0.01234926, 0.01252923] + [0.229, 0.224, 0.225] self.max_val = 4.380079501083187 self.min_val = -0.08767047645618645 self.bands = 33 elif self.dataset_type == 'hyperblood': # HyperBlood dataset parameters (113 bands) self.mean = [0.11792768, 0.12286566, 0.13354243, 0.12907951, 0.09845191, 0.13444436, 0.14597324, 0.14484807, 0.12660842, 0.08799646, 0.11882777, 0.13161479, 0.10589161, 0.09883164, 0.08022733, 0.09555449, 0.10218862, 0.09988686, 0.09676628, 0.08561739, 0.1227139, 0.13198491, 0.13013612, 0.12793193, 0.09031978] + [0.485, 0.456, 0.406] self.std = [0.06492269, 0.06635557, 0.07162475, 0.07012394, 0.05701815, 0.07323762, 0.0766644, 0.07810237, 0.07141274, 0.05436147, 0.06862938, 0.07280301, 0.0626632, 0.05946415, 0.05017714, 0.05620537, 0.0591019, 0.05838145, 0.05704834, 0.05148091, 0.06747658, 0.07073647, 0.07083215, 0.07006211, 0.05280771] + [0.229, 0.224, 0.225] self.max_val = 4.0 self.min_val = 0.0 self.bands = 113 elif self.dataset_type == 'hsidrive20': self.mean = [0.11792768, 0.12286566, 0.13354243, 0.12907951, 0.09845191, 0.13444436, 0.14597324, 0.14484807, 0.12660842, 0.08799646, 0.11882777, 0.13161479, 0.10589161, 0.09883164, 0.08022733, 0.09555449, 0.10218862, 0.09988686, 0.09676628, 0.08561739, 0.1227139, 0.13198491, 0.13013612, 0.12793193, 0.09031978] + [0.485, 0.456, 0.406] self.std = [0.06492269, 0.06635557, 0.07162475, 0.07012394, 0.05701815, 0.07323762, 0.0766644, 0.07810237, 0.07141274, 0.05436147, 0.06862938, 0.07280301, 0.0626632, 0.05946415, 0.05017714, 0.05620537, 0.0591019, 0.05838145, 0.05704834, 0.05148091, 0.06747658, 0.07073647, 0.07083215, 0.07006211, 0.05280771] + [0.229, 0.224, 0.225] self.max_val = 4.0 self.min_val = 0.0 self.bands = 25 elif self.dataset_type == 'hotrednir': self.mean = [0.28415901, 0.21461861, 0.18719398, 0.19470588, 0.20235114, 0.20367749, 0.2163216, 0.21995637, 0.2168878, 0.20578036, 0.20192309, 0.217628, 0.17708894, 0.17544539, 0.16722978] + [0.485, 0.456, 0.406] self.std = [0.2247296, 0.17951354, 0.15692467, 0.15598073, 0.16016452, 0.15911849, 0.16180973, 0.15985215, 0.15849979, 0.15031793, 0.146697, 0.14847991, 0.13463819, 0.13324966, 0.12782383] + [0.229, 0.224, 0.225] self.max_val = 254.0 self.min_val = 0.0 self.bands = 15 elif self.dataset_type == 'arad_1k_31': # ARAD_1K_31 dataset parameters (31 bands) self.mean = [0.00050713, 0.00070553, 0.0011365, 0.00149156, 0.00197441, 0.00223908, 0.00271003, 0.00345612, 0.00369303, 0.00385219, 0.00435618, 0.00506823, 0.0070418, 0.00800666, 0.0064554, 0.00628767, 0.00703461, 0.00775983, 0.00832022, 0.00929337, 0.00898094, 0.00748522, 0.00755848, 0.00718764, 0.00699057, 0.00689327, 0.00674753, 0.00671624, 0.00751943, 0.00741207, 0.00676514] + [0.485, 0.456, 0.406] self.std = [0.00035424, 0.00053509, 0.0009189, 0.00122868, 0.00164547, 0.00186258, 0.00224559, 0.00286002, 0.0030474, 0.00315195, 0.00353866, 0.00406267, 0.0055249, 0.00622435, 0.00500298, 0.00480104, 0.0052598, 0.00571489, 0.00601454, 0.00659049, 0.00634349, 0.00530685, 0.00537778, 0.00513787, 0.00498475, 0.00488729, 0.00471964, 0.00454973, 0.00490581, 0.0046964, 0.00421346] + [0.229, 0.224, 0.225] self.max_val = 1.0 self.min_val = 0.0 self.bands = 31 elif self.dataset_type == 'arad_1k_16': # ARAD_1K_16 dataset parameters (16 bands) self.mean = [0.00050713, 0.00070553, 0.0011365, 0.00149156, 0.00197441, 0.00223908, 0.00271003, 0.00345612, 0.00369303, 0.00385219, 0.00435618, 0.00506823, 0.0070418, 0.00800666, 0.0064554, 0.00628767] + [0.485, 0.456, 0.406] self.std = [0.00035424, 0.00053509, 0.0009189, 0.00122868, 0.00164547, 0.00186258, 0.00224559, 0.00286002, 0.0030474, 0.00315195, 0.00353866, 0.00406267, 0.0055249, 0.00622435, 0.00500298, 0.00480104] + [0.229, 0.224, 0.225] self.max_val = 1.0 self.min_val = 0.0 self.bands = 16 elif self.dataset_type == 'cave': # CAVE dataset parameters (31 bands) self.mean = [0.00050713, 0.00070553, 0.0011365, 0.00149156, 0.00197441, 0.00223908, 0.00271003, 0.00345612, 0.00369303, 0.00385219, 0.00435618, 0.00506823, 0.0070418, 0.00800666, 0.0064554, 0.00628767, 0.00703461, 0.00775983, 0.00832022, 0.00929337, 0.00898094, 0.00748522, 0.00755848, 0.00718764, 0.00699057, 0.00689327, 0.00674753, 0.00671624, 0.00751943, 0.00741207, 0.00676514] + [0.485, 0.456, 0.406] self.std = [0.00035424, 0.00053509, 0.0009189, 0.00122868, 0.00164547, 0.00186258, 0.00224559, 0.00286002, 0.0030474, 0.00315195, 0.00353866, 0.00406267, 0.0055249, 0.00622435, 0.00500298, 0.00480104, 0.0052598, 0.00571489, 0.00601454, 0.00659049, 0.00634349, 0.00530685, 0.00537778, 0.00513787, 0.00498475, 0.00488729, 0.00471964, 0.00454973, 0.00490581, 0.0046964, 0.00421346] + [0.229, 0.224, 0.225] self.max_val = 1.0 self.min_val = 0.0 self.bands = 31 elif self.dataset_type == 'icvl': # ICVL dataset parameters (31 bands) self.mean = [0.00050713, 0.00070553, 0.0011365, 0.00149156, 0.00197441, 0.00223908, 0.00271003, 0.00345612, 0.00369303, 0.00385219, 0.00435618, 0.00506823, 0.0070418, 0.00800666, 0.0064554, 0.00628767, 0.00703461, 0.00775983, 0.00832022, 0.00929337, 0.00898094, 0.00748522, 0.00755848, 0.00718764, 0.00699057, 0.00689327, 0.00674753, 0.00671624, 0.00751943, 0.00741207, 0.00676514] + [0.485, 0.456, 0.406] self.std = [0.00035424, 0.00053509, 0.0009189, 0.00122868, 0.00164547, 0.00186258, 0.00224559, 0.00286002, 0.0030474, 0.00315195, 0.00353866, 0.00406267, 0.0055249, 0.00622435, 0.00500298, 0.00480104, 0.0052598, 0.00571489, 0.00601454, 0.00659049, 0.00634349, 0.00530685, 0.00537778, 0.00513787, 0.00498475, 0.00488729, 0.00471964, 0.00454973, 0.00490581, 0.0046964, 0.00421346] + [0.229, 0.224, 0.225] self.max_val = 1.0 self.min_val = 0.0 self.bands = 31 elif self.dataset_type == 'hs_sod': # HSSOD dataset parameters (81 bands) self.mean = [0.00505788, 0.00601034, 0.00747643, 0.00959971, 0.0147855, 0.01898453, 0.0239441, 0.03211231, 0.03791218, 0.04520133, 0.04938109, 0.05594452, 0.06514561, 0.07837064, 0.08795061, 0.10231026, 0.1106684, 0.12345689, 0.13252559, 0.14111, 0.15414085, 0.16602382, 0.16550444, 0.1745532, 0.18869128, 0.19148134, 0.19939337, 0.20783469, 0.20828562, 0.21840917, 0.23144286, 0.24558449, 0.25482584, 0.25775317, 0.26426578, 0.27155495, 0.27239095, 0.2683785, 0.26598797, 0.26503738, 0.26443645, 0.26481411, 0.25628452, 0.2493137, 0.25782899, 0.26621533, 0.26577412, 0.26109554, 0.26062482, 0.26170838, 0.25086012, 0.24544579, 0.2453043, 0.24627007, 0.23747638, 0.22964289, 0.22108862, 0.22013535, 0.2160363, 0.21200803, 0.21234002, 0.20738988, 0.18760026, 0.17716606, 0.18474978, 0.20061198, 0.2190922, 0.23057194, 0.20136807, 0.18552641, 0.18074632, 0.20211651, 0.22420212, 0.25190136, 0.26552015, 0.26589699, 0.23496681, 0.15726452, 0.18386361, 0.22457717, 0.23622217] + [0.485, 0.456, 0.406] self.std = [0.00335335, 0.00379358, 0.00453958, 0.0057187, 0.00848124, 0.01070781, 0.01339494, 0.01787782, 0.02111595, 0.02536344, 0.02784967, 0.03205192, 0.03756858, 0.04570729, 0.05158716, 0.06053343, 0.06596695, 0.07434336, 0.08030715, 0.0860997, 0.09462209, 0.10215146, 0.10232753, 0.10816608, 0.11646034, 0.11808529, 0.12236777, 0.12631026, 0.12541599, 0.12993119, 0.13554931, 0.14209915, 0.14627095, 0.14776726, 0.1509073, 0.15434794, 0.15478504, 0.15323047, 0.15261152, 0.15322816, 0.15360044, 0.15428015, 0.1509565, 0.14847103, 0.15334979, 0.15741342, 0.1573434, 0.15556864, 0.15630692, 0.15746275, 0.15289239, 0.1505807, 0.15081839, 0.15202881, 0.14851399, 0.1455947, 0.14142634, 0.14174904, 0.14012646, 0.13851422, 0.13887505, 0.13566844, 0.12321144, 0.11449433, 0.11628917, 0.12220737, 0.1309691, 0.13637021, 0.12087113, 0.112728, 0.11086555, 0.12307407, 0.13483802, 0.14899566, 0.15559294, 0.15502698, 0.13857946, 0.09519617, 0.10987266, 0.13104544, 0.13648109] + [0.229, 0.224, 0.225] self.max_val = 4095.0 self.min_val = 0.0 self.bands = 81 elif self.dataset_type == 'hsodbit_v2': # HSODBIT-V2 dataset parameters (31 bands) self.mean = [0.00050713, 0.00070553, 0.0011365, 0.00149156, 0.00197441, 0.00223908, 0.00271003, 0.00345612, 0.00369303, 0.00385219, 0.00435618, 0.00506823, 0.0070418, 0.00800666, 0.0064554, 0.00628767, 0.00703461, 0.00775983, 0.00832022, 0.00929337, 0.00898094, 0.00748522, 0.00755848, 0.00718764, 0.00699057, 0.00689327, 0.00674753, 0.00671624, 0.00751943, 0.00741207, 0.00676514] + [0.485, 0.456, 0.406] self.std = [0.00035424, 0.00053509, 0.0009189, 0.00122868, 0.00164547, 0.00186258, 0.00224559, 0.00286002, 0.0030474, 0.00315195, 0.00353866, 0.00406267, 0.0055249, 0.00622435, 0.00500298, 0.00480104, 0.0052598, 0.00571489, 0.00601454, 0.00659049, 0.00634349, 0.00530685, 0.00537778, 0.00513787, 0.00498475, 0.00488729, 0.00471964, 0.00454973, 0.00490581, 0.0046964, 0.00421346] + [0.229, 0.224, 0.225] self.max_val = 1.0 self.min_val = 0.0 self.bands = 31 elif self.dataset_type == 'vnihdhiatlimafb': # VNIHDHIATLIMAFB dataset parameters (204 bands) self.mean = [0.11792768, 0.12286566, 0.13354243, 0.12907951, 0.09845191, 0.13444436, 0.14597324, 0.14484807, 0.12660842, 0.08799646, 0.11882777, 0.13161479, 0.10589161, 0.09883164, 0.08022733, 0.09555449, 0.10218862, 0.09988686, 0.09676628, 0.08561739, 0.1227139, 0.13198491, 0.13013612, 0.12793193, 0.09031978] + [0.485, 0.456, 0.406] # Placeholder for 204 bands self.std = [0.06492269, 0.06635557, 0.07162475, 0.07012394, 0.05701815, 0.07323762, 0.0766644, 0.07810237, 0.07141274, 0.05436147, 0.06862938, 0.07280301, 0.0626632, 0.05946415, 0.05017714, 0.05620537, 0.0591019, 0.05838145, 0.05704834, 0.05148091, 0.06747658, 0.07073647, 0.07083215, 0.07006211, 0.05280771] + [0.229, 0.224, 0.225] # Placeholder for 204 bands self.max_val = 6.7395835 self.min_val = 0.0 self.bands = 204 elif self.dataset_type == 'deephsnir': # DeepHSNIR dataset parameters (252 bands) self.mean = [0.31596533, 0.31582026, 0.31591017, 0.31598633, 0.31596835, 0.31598215, 0.31601244, 0.31609212, 0.31615184, 0.31636028, 0.31626798, 0.31632993, 0.31630893, 0.31629821, 0.31628198, 0.31629123, 0.31628992, 0.31628988, 0.31629121, 0.31629341, 0.31629719, 0.31630189, 0.31630792, 0.31631442, 0.31632174, 0.31632916, 0.31633725, 0.31634579, 0.31635505, 0.31636362, 0.31637288, 0.31638203, 0.31639112, 0.31640022, 0.31640956, 0.31641804, 0.3164259, 0.31643368, 0.31644078, 0.31644723, 0.31645304, 0.31645748, 0.31646186, 0.31646554, 0.31646728, 0.3164684, 0.31646862, 0.31646795, 0.31646639, 0.31646393, 0.31646071, 0.31645649, 0.3164517, 0.31644626, 0.31643993, 0.3164326, 0.31642488, 0.31641591, 0.316406, 0.31639471, 0.31638239, 0.3163689, 0.31635382, 0.31633678, 0.3163173, 0.31629476, 0.31626924, 0.31624086, 0.31621267, 0.31618586, 0.31616282, 0.31614348, 0.31612933, 0.31611873, 0.31611115, 0.31610538, 0.31610125, 0.3160978, 0.31609544, 0.31609292, 0.31609089, 0.31608857, 0.31608667, 0.31608452, 0.31608326, 0.31608272, 0.31608313, 0.31608345, 0.31608475, 0.31608608, 0.31608797, 0.31609013, 0.31609267, 0.31609534, 0.31609833, 0.31610108, 0.31610388, 0.3161063, 0.31610849, 0.31611045, 0.3161125, 0.31611421, 0.31611564, 0.31611635, 0.31611742, 0.31611747, 0.31611709, 0.31611633, 0.31611496, 0.31611284, 0.3161104, 0.31610654, 0.31610262, 0.31609754, 0.31609167, 0.31608465, 0.31607718, 0.31606815, 0.3160589, 0.31604863, 0.3160373, 0.3160252, 0.3160125, 0.31599887, 0.31598522, 0.31597137, 0.31595758, 0.31594364, 0.31593029, 0.31591749, 0.31590532, 0.31589336, 0.31588242, 0.31587171, 0.31586104, 0.31584994, 0.31583816, 0.31582486, 0.3158098, 0.31579286, 0.31577426, 0.31575404, 0.31573181, 0.31570692, 0.31568126, 0.31565632, 0.31563368, 0.31561237, 0.31559422, 0.31557927, 0.31556712, 0.31555746, 0.31554977, 0.31554326, 0.31553813, 0.31553397, 0.31553063, 0.31552774, 0.31552526, 0.31552339, 0.31552228, 0.315521, 0.31552015, 0.31551944, 0.31551878, 0.31551817, 0.31551761, 0.31551709, 0.31551661, 0.31551617, 0.31551576, 0.31551538, 0.31551503, 0.31551471, 0.31551441, 0.31551414, 0.31551389, 0.31551366, 0.31551345, 0.31551326, 0.31551309, 0.31551294, 0.3155128, 0.31551268, 0.31551257, 0.31551248, 0.3155124, 0.31551233, 0.31551227, 0.31551222, 0.31551218, 0.31551215, 0.31551213, 0.31551211, 0.3155121, 0.31551209, 0.31551209, 0.31551209, 0.3155121, 0.31551211, 0.31551213, 0.31551215, 0.31551218, 0.31551222, 0.31551227, 0.31551233, 0.3155124, 0.31551248, 0.31551257, 0.31551268, 0.3155128, 0.31551294, 0.31551309, 0.31551326, 0.31551345, 0.31551366, 0.31551389, 0.31551414, 0.31551441, 0.31551471, 0.31551503, 0.31551538, 0.31551576, 0.31551617, 0.31551661, 0.31551709, 0.31551761, 0.31551817, 0.31551878, 0.31551944, 0.31552015, 0.315521, 0.31552228, 0.31552339, 0.31552526, 0.31552774, 0.31553063, 0.31553397, 0.31553813, 0.31554326, 0.31554977, 0.31555746, 0.31556712, 0.31557927, 0.31559422, 0.31561237, 0.31563368, 0.31565632, 0.31568126, 0.31570692, 0.31573181, 0.31575404, 0.31577426, 0.31579286, 0.3158098, 0.31582486, 0.31583816, 0.31584994, 0.31586104, 0.31587171, 0.31588242, 0.31589336, 0.31590532, 0.31591749, 0.31593029, 0.31594364, 0.31595758, 0.31597137, 0.31598522, 0.31599887, 0.3160125, 0.3160252, 0.3160373, 0.31604863, 0.3160589, 0.31606815, 0.31607718, 0.31608465, 0.31609167, 0.31609754, 0.31610262, 0.31610654, 0.3161104, 0.31611284, 0.31611496, 0.31611633, 0.31611709, 0.31611747, 0.31611742, 0.31611635, 0.31611564, 0.31611421, 0.3161125, 0.31611045, 0.31610849, 0.3161063, 0.31610388, 0.31610108, 0.31609833, 0.31609534, 0.31609267, 0.31609013, 0.31608797, 0.31608608, 0.31608475, 0.31608345, 0.31608313, 0.31608272, 0.31608326, 0.31608452, 0.31608667, 0.31608857, 0.31609089, 0.31609292, 0.31609544, 0.3160978, 0.31610125, 0.31610538, 0.31611115, 0.31611873, 0.31612933, 0.31614348, 0.31616282, 0.31618586, 0.31621267, 0.31624086, 0.31626924, 0.31629476, 0.3163173, 0.31633678, 0.31635382, 0.3163689, 0.31638239, 0.31639471, 0.316406, 0.31641591, 0.31642488, 0.3164326, 0.31643993, 0.31644626, 0.3164517, 0.31645649, 0.31646071, 0.31646393, 0.31646639, 0.31646795, 0.31646862, 0.3164684, 0.31646728, 0.31646554, 0.31646186, 0.31645748, 0.31645304, 0.31644723, 0.31644078, 0.31643368, 0.3164259, 0.31641804, 0.31640956, 0.31640022, 0.31639112, 0.31638203, 0.31637288, 0.31636362, 0.31635505, 0.31634579, 0.31633725, 0.31632916, 0.31632174, 0.31631442, 0.31630792, 0.31630189, 0.31629719, 0.31629341, 0.31629121, 0.31628988, 0.31628992, 0.31629123, 0.31628198, 0.31629821, 0.31630893, 0.31632993, 0.31626798, 0.31636028, 0.31615184, 0.31609212, 0.31601244, 0.31598215, 0.31596835, 0.31598633, 0.31591017, 0.31582026, 0.31596533] + [0.485, 0.456, 0.406] self.std = [0.00079037, 0.0007425, 0.00065591, 0.00051521, 0.00042861, 0.00035781, 0.00030852, 0.00027553, 0.00024972, 0.00023215, 0.00021762, 0.00020285, 0.00019168, 0.00018386, 0.0001759, 0.00017044, 0.00016426, 0.00016082, 0.00015763, 0.00015393, 0.00015311, 0.00015134, 0.00014883, 0.00014749, 0.00014741, 0.00014516, 0.00014332, 0.00014341, 0.00014184, 0.00014089, 0.00014032, 0.00014022, 0.00013943, 0.00014008, 0.00014015, 0.00014017, 0.00014134, 0.0001425, 0.00014354, 0.00014468, 0.00014716, 0.00015027, 0.00015342, 0.00015756, 0.00016252, 0.00016839, 0.00017464, 0.00018131, 0.00018895, 0.00019656, 0.00020385, 0.00021131, 0.00021835, 0.00022541, 0.00023273, 0.00023976, 0.00024745, 0.00025497, 0.00026362, 0.00027079, 0.00027759, 0.00028338, 0.00028929, 0.00029449, 0.00029914, 0.00030325, 0.00030718, 0.00031107, 0.00031513, 0.00031871, 0.00032228, 0.00032645, 0.00033152, 0.00033614, 0.00034014, 0.00034409, 0.00034907, 0.00035414, 0.00035885, 0.00036213, 0.00036416, 0.00036582, 0.00036737, 0.00036871, 0.00037023, 0.00037181, 0.00037464, 0.00037864, 0.00038216, 0.00038387, 0.00038331, 0.0003815, 0.00037921, 0.00037672, 0.00037407, 0.00037124, 0.00036876, 0.0003665, 0.00036421, 0.00036161, 0.00035823, 0.00035554, 0.00035111, 0.00034814, 0.00034807, 0.00035138, 0.00035852, 0.00036978, 0.00038696, 0.00040979, 0.00043873, 0.00047688, 0.00052208, 0.00057209, 0.00062645, 0.00067932, 0.00072609, 0.00076801, 0.00080663, 0.0008454, 0.0008833, 0.0009198, 0.0009528, 0.00098305, 0.00101078, 0.00103879, 0.0010646, 0.00108751, 0.00110426, 0.00111807, 0.00113049, 0.00114154, 0.00115239, 0.0011625, 0.00117243, 0.00118141, 0.00118918, 0.00119544, 0.00120023, 0.00120341, 0.00120584, 0.0012085, 0.00121261, 0.00121765, 0.0012236, 0.00122975, 0.00123565, 0.00124077, 0.0012446, 0.0012474, 0.00124991, 0.00125278, 0.00125682, 0.0012612, 0.00126572, 0.00127012, 0.00127315, 0.00127535, 0.00127643, 0.0012759, 0.0012735, 0.00127003, 0.00126723, 0.00126586, 0.00126587, 0.0012669, 0.00126801, 0.00126928, 0.00127057, 0.00127182, 0.0012726, 0.00127326, 0.00127344, 0.00127358, 0.00127316, 0.00127243, 0.00127118, 0.00127005, 0.00126892, 0.00126813, 0.00126719, 0.00126615, 0.00126527, 0.00126412, 0.00126246, 0.00126066, 0.00125855, 0.00125606, 0.00125331, 0.00124968, 0.00124578, 0.00124186, 0.00123847, 0.00123427, 0.00122877, 0.00122099, 0.00121079, 0.00120015, 0.00118775, 0.00117478, 0.00116004, 0.00114472, 0.00112692, 0.00110748, 0.00108788, 0.00106712, 0.00104644, 0.00102789, 0.00101468, 0.00100716, 0.00100281, 0.00099826, 0.00099611, 0.00099268, 0.00099213, 0.00099252, 0.00099448, 0.00099648, 0.00099991, 0.00100328, 0.00100812, 0.00101217, 0.00101756, 0.00102464] + [0.229, 0.224, 0.225] self.max_val = 1.0 self.min_val = -0.091662824 self.bands = 249 elif self.dataset_type == 'deephsvis': # DeepHSVIS dataset parameters (249 bands) self.mean = [0.31596533] * 249 + [0.485, 0.456, 0.406] # Placeholder values self.std = [0.00079012] * 249 + [0.229, 0.224, 0.225] # Placeholder values self.max_val = 1.0 self.min_val = -0.091662824 self.bands = 249 elif self.dataset_type == 'deephsviscor': # DeepHSVISCOR dataset parameters (249 bands) self.mean = [0.31596533] * 249 + [0.485, 0.456, 0.406] # Placeholder values self.std = [0.00079012] * 249 + [0.229, 0.224, 0.225] # Placeholder values self.max_val = 1.0 self.min_val = -0.091662824 self.bands = 249 elif self.dataset_type == 'hsodbitv2': # HSODBITV2 dataset parameters (200 bands) self.mean = [0.00858756] * 200 + [0.485, 0.456, 0.406] # Placeholder values self.std = [0.00751322] * 200 + [0.229, 0.224, 0.225] # Placeholder values self.max_val = 2.0 self.min_val = 0.0 self.bands = 200 elif self.dataset_type == 'hotvis': # HOTVIS dataset parameters (16 bands) self.mean = [0.17354311, 0.16689073, 0.14970031, 0.14982351, 0.17244257, 0.16725978, 0.17544793, 0.18323516, 0.16343771, 0.18044153, 0.18598581, 0.1752639, 0.17251257, 0.20304256, 0.19737918, 0.20113443] + [0.485, 0.456, 0.406] self.std = [0.14717741, 0.14833903, 0.14008888, 0.14012565, 0.14750255, 0.14482089, 0.1488135, 0.14891803, 0.14469542, 0.14839285, 0.14959444, 0.136904, 0.14140587, 0.14981111, 0.14334199, 0.15056744] + [0.229, 0.224, 0.225] self.max_val = 254 self.min_val = 0 self.bands = 16 elif self.dataset_type == 'hotnir': # HOTNIR dataset parameters (128 bands) self.mean = [0.17354311] * 128 + [0.485, 0.456, 0.406] # Placeholder values self.std = [0.00202992] * 128 + [0.229, 0.224, 0.225] # Placeholder values self.max_val = 2.742662 self.min_val = -1.432596 self.bands = 128 elif self.dataset_type == 'hsiroad': # HSIROAD dataset parameters (128 bands) self.mean = [0.17354311] * 128 + [0.485, 0.456, 0.406] # Placeholder values self.std = [0.00202992] * 128 + [0.229, 0.224, 0.225] # Placeholder values self.max_val = 2.742662 self.min_val = -1.432596 self.bands = 128 elif self.dataset_type == 'hyperspectralcityv2': # hyperspectralcityv2 dataset parameters (128 bands) self.mean = [0.17354311] * 128 + [0.485, 0.456, 0.406] # Placeholder values self.std = [0.00202992] * 128 + [0.229, 0.224, 0.225] # Placeholder values self.max_val = 2.742662 self.min_val = -1.432596 self.bands = 128 elif self.dataset_type == 'hykov2nir': # hykov2nir dataset parameters (25 bands) self.mean = [0.1] * 25 + [0.485, 0.456, 0.406] # Placeholder values self.std = [0.05] * 25 + [0.229, 0.224, 0.225] # Placeholder values self.max_val = 1.0 self.min_val = 0.0 self.bands = 25 elif self.dataset_type == 'hykov2vis': # hykov2vis dataset parameters (15 bands) self.mean = [0.1] * 15 + [0.485, 0.456, 0.406] # Placeholder values self.std = [0.05] * 15 + [0.229, 0.224, 0.225] # Placeholder values self.max_val = 1.0 self.min_val = 0.0 self.bands = 15 elif self.dataset_type == 'hyperdrive': # Hyperdrive dataset parameters (128 bands) self.mean = [0.17354311] * 128 + [0.485, 0.456, 0.406] # Placeholder values self.std = [0.00202992] * 128 + [0.229, 0.224, 0.225] # Placeholder values self.max_val = 2.742662 self.min_val = -1.432596 self.bands = 128 elif self.dataset_type == 'hyperdrivevnir': # HyperdriveVNIR dataset parameters (128 bands) self.mean = [0.17354311] * 128 + [0.485, 0.456, 0.406] # Placeholder values self.std = [0.00202992] * 128 + [0.229, 0.224, 0.225] # Placeholder values self.max_val = 2.742662 self.min_val = -1.432596 self.bands = 128 elif self.dataset_type == 'hyperdriveswir': # HyperdriveSWIR dataset parameters (128 bands) self.mean = [0.17354311] * 128 + [0.485, 0.456, 0.406] # Placeholder values self.std = [0.00202992] * 128 + [0.229, 0.224, 0.225] # Placeholder values self.max_val = 2.742662 self.min_val = -1.432596 self.bands = 128 elif self.dataset_type == 'libhsi': # LIBHSI dataset parameters (204 bands) self.mean = [0.1] * 204 + [0.485, 0.456, 0.406] # Placeholder values self.std = [0.05] * 204 + [0.229, 0.224, 0.225] # Placeholder values self.max_val = 1.0 self.min_val = 0.0 self.bands = 204 elif self.dataset_type == 'virginia_tech_tree': # VirginiaTechTrees dataset parameters (420 bands) self.mean = [0.1] * 420 + [0.485, 0.456, 0.406] # Placeholder values self.std = [0.05] * 420 + [0.229, 0.224, 0.225] # Placeholder values self.max_val = 65535.0 self.min_val = 0.0 self.bands = 420 elif self.dataset_type == 'fiftyoutdoor': # FiftyOutdoor dataset parameters (33 bands) self.mean = [0.5] * 33 + [0.485, 0.456, 0.406] # 33 HSI bands + 3 RGB bands self.std = [0.5] * 33 + [0.229, 0.224, 0.225] # 33 HSI bands + 3 RGB bands self.max_val = 1.0 self.min_val = 0.0 self.bands = 33 elif self.dataset_type == 'aphid': # APHID (Agricultural plant hyperspectral imaging dataset) parameters (237 bands) self.mean = [0.01749677, 0.01863154, 0.01968502, 0.02096651, 0.0222703, 0.02343416, 0.02486456, 0.02623226, 0.02711628, 0.02806029, 0.029251, 0.03039208, 0.03149611, 0.0324034, 0.03310641, 0.03367099, 0.03440539, 0.03559069, 0.03706571, 0.03864252, 0.04023792, 0.04108739, 0.04091695, 0.04059534, 0.04176284, 0.04384956, 0.04603461, 0.04808683, 0.04970166, 0.05056294, 0.05120134, 0.05231753, 0.05404492, 0.05613217, 0.05841183, 0.06040159, 0.06176928, 0.06352201, 0.06672157, 0.07070624, 0.07452483, 0.07856132, 0.08336198, 0.08813702, 0.09218899, 0.0957341, 0.09813736, 0.09948482, 0.10089726, 0.10222418, 0.10359852, 0.10576257, 0.10874553, 0.1115804, 0.11350075, 0.11437227, 0.11461496, 0.11388246, 0.11216935, 0.11024847, 0.1088342, 0.1087843, 0.1095063, 0.11013955, 0.11095031, 0.11238496, 0.11351851, 0.11270449, 0.10897382, 0.10531164, 0.10361046, 0.10310593, 0.10363231, 0.10527451, 0.107754, 0.11062107, 0.11306273, 0.11433087, 0.11441181, 0.11306909, 0.110761, 0.10861859, 0.10717231, 0.10603203, 0.10528735, 0.10519255, 0.10547309, 0.10642145, 0.10789556, 0.10951177, 0.11057608, 0.11080275, 0.11043563, 0.10899756, 0.10621833, 0.10343582, 0.10152958, 0.09933766, 0.09696239, 0.09659571, 0.09835973, 0.09998306, 0.10117153, 0.10197631, 0.10239724, 0.10213523, 0.10149442, 0.10068651, 0.09948141, 0.09803665, 0.09656651, 0.09445546, 0.09231605, 0.09290426, 0.09721154, 0.10396054, 0.11291141, 0.12304567, 0.13413498, 0.14725136, 0.16233688, 0.17846247, 0.19488951, 0.20931178, 0.21713638, 0.21432398, 0.21035695, 0.21707963, 0.22783414, 0.23649397, 0.24813107, 0.26640504, 0.29275966, 0.32234601, 0.34856743, 0.37127585, 0.39328289, 0.41307188, 0.4276742, 0.4356971, 0.43781677, 0.43502193, 0.42373551, 0.39014824, 0.32058243, 0.25648081, 0.24593042, 0.27940771, 0.32313044, 0.35244421, 0.3646437, 0.36728434, 0.36622976, 0.36283905, 0.35801778, 0.35183559, 0.34352493, 0.33310404, 0.32312864, 0.31559416, 0.30912014, 0.30196878, 0.29375823, 0.28506906, 0.27649879, 0.26673254, 0.25346453, 0.23533093, 0.21329628, 0.19368162, 0.1830368, 0.17975254, 0.17868787, 0.17938373, 0.18064577, 0.18095194, 0.18175849, 0.18480291, 0.18925455, 0.19289429, 0.19460079, 0.19428892, 0.19203493, 0.18722012, 0.17995, 0.1717305, 0.16454595, 0.15969452, 0.15656967, 0.15329931, 0.14871182, 0.14348243, 0.13973992, 0.13788484, 0.13644798, 0.13451014, 0.13252546, 0.13048483, 0.1283227, 0.12643253, 0.124531, 0.12215579, 0.1183463, 0.11226351, 0.10376037, 0.0947622, 0.08802142, 0.08586727, 0.08575157, 0.0836123, 0.07931947, 0.07523115, 0.07192349, 0.06935133, 0.06830636, 0.06826021, 0.06710699, 0.06376308, 0.05800961, 0.05036524, 0.04200856, 0.03558817, 0.03223782, 0.03177794, 0.03210223, 0.03172927, 0.03087431, 0.03024037, 0.02975344, 0.02941706, 0.0293257, 0.02927379, 0.0292441, 0.02950881, 0.03002286, 0.03068394, 0.03161591] + [0.485, 0.456, 0.406] self.std = [0.01152971, 0.01246639, 0.0133121, 0.01436954, 0.01541135, 0.01638534, 0.01757471, 0.01858997, 0.01925267, 0.02002466, 0.02094319, 0.02179194, 0.02270399, 0.02341295, 0.02388981, 0.02430273, 0.02488912, 0.0258316, 0.02695783, 0.02815591, 0.02925099, 0.02986218, 0.02970572, 0.02945916, 0.03035832, 0.0318107, 0.03328634, 0.0347459, 0.03576967, 0.03619796, 0.03647458, 0.03704743, 0.03800565, 0.03917259, 0.04039074, 0.0413286, 0.04171075, 0.04219915, 0.04369529, 0.04580031, 0.0479429, 0.05019833, 0.05293343, 0.05563171, 0.05788512, 0.05989067, 0.06113891, 0.06171445, 0.06234663, 0.06307677, 0.06400757, 0.06546068, 0.06730459, 0.06902729, 0.07008141, 0.07033944, 0.07022615, 0.06977442, 0.06894731, 0.06814718, 0.06774428, 0.06810594, 0.06882164, 0.06934666, 0.06990361, 0.07078452, 0.07139315, 0.07079498, 0.06857792, 0.06630415, 0.06526684, 0.06512386, 0.06568101, 0.06689893, 0.06856078, 0.07039654, 0.07184651, 0.07240477, 0.07209843, 0.07100998, 0.06943199, 0.06802907, 0.0671699, 0.06662852, 0.06625083, 0.0661338, 0.06617793, 0.06658512, 0.06730466, 0.06812465, 0.06866366, 0.06868333, 0.06821723, 0.06712205, 0.06523205, 0.06327473, 0.06186961, 0.06043651, 0.05888788, 0.05861247, 0.05975403, 0.06084589, 0.06163529, 0.0619789, 0.06194087, 0.061432, 0.06063354, 0.05966061, 0.05842775, 0.05710185, 0.05577594, 0.05394797, 0.05187146, 0.05152278, 0.0534283, 0.05664466, 0.06106503, 0.06604659, 0.07145322, 0.07784917, 0.08533052, 0.09329414, 0.1011765, 0.10791616, 0.11120184, 0.10852307, 0.1045392, 0.10643732, 0.11066276, 0.11409803, 0.11902983, 0.12698301, 0.13902298, 0.15237588, 0.1633798, 0.17212956, 0.179671, 0.18561263, 0.18925252, 0.19040748, 0.18937401, 0.18703309, 0.18260644, 0.17033362, 0.14077065, 0.11084724, 0.1030968, 0.11741595, 0.13745567, 0.15110533, 0.15682253, 0.15812345, 0.15755359, 0.15585662, 0.15368759, 0.15086846, 0.14702306, 0.14210789, 0.1372956, 0.13339315, 0.12988061, 0.1262256, 0.12216039, 0.1178111, 0.11358331, 0.10918471, 0.1034911, 0.09589767, 0.08665663, 0.07825239, 0.07361674, 0.07224158, 0.07199165, 0.07257136, 0.07346027, 0.07374678, 0.07415465, 0.07543777, 0.07721565, 0.07861143, 0.07911456, 0.07863731, 0.07730382, 0.0749192, 0.07162238, 0.06797465, 0.06475224, 0.06266206, 0.06146712, 0.06030559, 0.05864737, 0.05667419, 0.05525446, 0.05461379, 0.05417626, 0.05354191, 0.05284226, 0.05207279, 0.05124803, 0.05051118, 0.04972649, 0.04876982, 0.04732547, 0.04493024, 0.04143843, 0.03756908, 0.03454615, 0.03337561, 0.03325491, 0.03246053, 0.03074391, 0.02899512, 0.02752891, 0.02636907, 0.02590251, 0.02585678, 0.02543508, 0.02426568, 0.02216031, 0.01917821, 0.01588485, 0.01322024, 0.0117436, 0.01146387, 0.0116006, 0.01157587, 0.01135505, 0.01116603, 0.01104617, 0.01098228, 0.01100889, 0.01104027, 0.01109781, 0.01125572, 0.01149373, 0.01179753, 0.01218904] + [0.229, 0.224, 0.225] self.max_val = 255.0 self.min_val = 0.0 self.bands = 237 else: raise ValueError(f"Unsupported dataset type: {self.dataset_type}") def _init_wavelength_params(self): """Initialize wavelength information based on dataset type.""" if self.dataset_type == 'harvard': # Harvard wavelengths (31 bands from 420.0 to 720.0) self.wavelengths = [420.0, 430.0, 440.0, 450.0, 460.0, 470.0, 480.0, 490.0, 500.0, 510.0, 520.0, 530.0, 540.0, 550.0, 560.0, 570.0, 580.0, 590.0, 600.0, 610.0, 620.0, 630.0, 640.0, 650.0, 660.0, 670.0, 680.0, 690.0, 700.0, 710.0, 720.0] elif self.dataset_type == 'umld2015': self.wavelengths = [400.0, 410.0, 420.0, 430.0, 440.0, 450.0, 460.0, 470.0, 480.0, 490.0, 500.0, 510.0, 520.0, 530.0, 540.0, 550.0, 560.0, 570.0, 580.0, 590.0, 600.0, 610.0, 620.0, 630.0, 640.0, 650.0, 660.0, 670.0, 680.0, 690.0, 700.0, 710.0, 720.0] elif self.dataset_type == 'umns2002': # UMNS2002 wavelengths (31 bands from 410.0 to 710.0) self.wavelengths = [410.0, 420.0, 430.0, 440.0, 450.0, 460.0, 470.0, 480.0, 490.0, 500.0, 510.0, 520.0, 530.0, 540.0, 550.0, 560.0, 570.0, 580.0, 590.0, 600.0, 610.0, 620.0, 630.0, 640.0, 650.0, 660.0, 670.0, 680.0, 690.0, 700.0, 710.0] elif self.dataset_type == 'umns2004': # UMNS2004 wavelengths (33 bands from 400.0 to 720.0) self.wavelengths = [400.0, 410.0, 420.0, 430.0, 440.0, 450.0, 460.0, 470.0, 480.0, 490.0, 500.0, 510.0, 520.0, 530.0, 540.0, 550.0, 560.0, 570.0, 580.0, 590.0, 600.0, 610.0, 620.0, 630.0, 640.0, 650.0, 660.0, 670.0, 680.0, 690.0, 700.0, 710.0, 720.0] elif self.dataset_type == 'umos': # UMOS wavelengths (31 bands from 400.0 to 700.0) self.wavelengths = [400.0, 410.0, 420.0, 430.0, 440.0, 450.0, 460.0, 470.0, 480.0, 490.0, 500.0, 510.0, 520.0, 530.0, 540.0, 550.0, 560.0, 570.0, 580.0, 590.0, 600.0, 610.0, 620.0, 630.0, 640.0, 650.0, 660.0, 670.0, 680.0, 690.0, 700.0] elif self.dataset_type == 'umri2015': # UMRI2015 wavelengths (33 bands from 400.0 to 720.0) self.wavelengths = [400.0, 410.0, 420.0, 430.0, 440.0, 450.0, 460.0, 470.0, 480.0, 490.0, 500.0, 510.0, 520.0, 530.0, 540.0, 550.0, 560.0, 570.0, 580.0, 590.0, 600.0, 610.0, 620.0, 630.0, 640.0, 650.0, 660.0, 670.0, 680.0, 690.0, 700.0, 710.0, 720.0] elif self.dataset_type == 'umemm': self.wavelengths = [400.0, 410.0, 420.0, 430.0, 440.0, 450.0, 460.0, 470.0, 480.0, 490.0, 500.0, 510.0, 520.0, 530.0, 540.0, 550.0, 560.0, 570.0, 580.0, 590.0, 600.0, 610.0, 620.0, 630.0, 640.0, 650.0, 660.0, 670.0, 680.0, 690.0, 700.0, 710.0, 720.0] elif self.dataset_type == 'hyperblood': self.wavelengths = [ 401.5636, 406.528 , 411.4977, 416.4725, 421.4525, 426.4379, 431.4284, 436.4241, 441.4251, 446.4313, 451.4427, 456.4594, 461.4813, 466.5084, 471.5408, 476.5783, 481.6211, 486.6691, 491.7224, 496.7808, 501.8445, 506.9134, 511.9876, 517.067 , 522.1515, 527.2413, 532.3364, 537.4367, 542.5422, 547.6529, 552.7689, 557.8901, 563.0164, 568.1481, 573.2849, 578.427 , 583.5743, 588.7269, 593.8846, 599.0476, 604.2158, 609.3892, 614.5679, 635.3348, 640.5396, 645.7496, 650.9649, 656.1853, 661.4111, 666.642 , 671.8782, 677.1195, 682.3661, 687.6179, 692.875 , 698.1372, 703.4047, 708.6775, 713.9554, 719.2386, 724.5271, 729.8207, 735.1196, 740.4236, 745.7329, 751.0475, 756.3672, 761.6923, 767.0225, 772.358 , 777.6987, 783.0445, 788.3956, 793.752 , 799.1135, 804.4803, 809.8524, 815.2296, 820.6121, 825.9998, 831.3927, 836.7909, 842.1942, 847.6028, 853.0167, 858.4358, 863.86 , 869.2896, 874.7243, 880.1642, 885.6095, 891.0598, 896.5155, 901.9764, 907.4425, 912.9138, 918.3903, 923.8721, 929.3591, 934.8514, 940.3488, 945.8514, 951.3594, 956.8725, 962.3909, 967.9144, 973.4432, 978.9773, 984.5165, 990.061 , 995.6107, 1001.1656, 1006.7258] elif self.dataset_type == 'hsidrive20': self.wavelengths = [600.0, 615.625, 631.25, 646.875, 662.5, 678.125, 693.75, 709.375, 725.0, 740.625, 756.25, 771.875, 787.5, 803.125, 818.75, 834.375, 850.0, 865.625, 881.25, 896.875, 912.5, 928.125, 943.75, 959.375, 975.0] elif self.dataset_type == 'hotrednir': self.wavelengths = [600.0, 617.857143, 635.714286, 653.571429, 671.428571, 689.285714, 707.142857, 725.0, 742.857143, 760.714286, 778.571429, 796.428571, 814.285714, 832.142857, 850.0] elif self.dataset_type == 'arad_1k_31': self.wavelengths = [400.0, 410.0, 420.0, 430.0, 440.0, 450.0, 460.0, 470.0, 480.0, 490.0, 500.0, 510.0, 520.0, 530.0, 540.0, 550.0, 560.0, 570.0, 580.0, 590.0, 600.0, 610.0, 620.0, 630.0, 640.0, 650.0, 660.0, 670.0, 680.0, 690.0, 700.0] elif self.dataset_type == 'arad_1k_16': self.wavelengths = [400.0, 440.0, 480.0, 520.0, 560.0, 600.0, 640.0, 680.0, 720.0, 760.0, 800.0, 840.0, 880.0, 920.0, 960.0, 1000.0] elif self.dataset_type == 'cave': self.wavelengths = [400.0, 410.0, 420.0, 430.0, 440.0, 450.0, 460.0, 470.0, 480.0, 490.0, 500.0, 510.0, 520.0, 530.0, 540.0, 550.0, 560.0, 570.0, 580.0, 590.0, 600.0, 610.0, 620.0, 630.0, 640.0, 650.0, 660.0, 670.0, 680.0, 690.0, 700.0] elif self.dataset_type == 'icvl': self.wavelengths = [400.0, 410.0, 420.0, 430.0, 440.0, 450.0, 460.0, 470.0, 480.0, 490.0, 500.0, 510.0, 520.0, 530.0, 540.0, 550.0, 560.0, 570.0, 580.0, 590.0, 600.0, 610.0, 620.0, 630.0, 640.0, 650.0, 660.0, 670.0, 680.0, 690.0, 700.0] elif self.dataset_type == 'hs_sod': # HSSOD wavelengths (81 bands from 380.0 to 720.0) self.wavelengths = [380.0, 384.25, 388.5, 392.75, 397.0, 401.25, 405.5, 409.75, 414.0, 418.25, 422.5, 426.75, 431.0, 435.25, 439.5, 443.75, 448.0, 452.25, 456.5, 460.75, 465.0, 469.25, 473.5, 477.75, 482.0, 486.25, 490.5, 494.75, 499.0, 503.25, 507.5, 511.75, 516.0, 520.25, 524.5, 528.75, 533.0, 537.25, 541.5, 545.75, 550.0, 554.25, 558.5, 562.75, 567.0, 571.25, 575.5, 579.75, 584.0, 588.25, 592.5, 596.75, 601.0, 605.25, 609.5, 613.75, 618.0, 622.25, 626.5, 630.75, 635.0, 639.25, 643.5, 647.75, 652.0, 656.25, 660.5, 664.75, 669.0, 673.25, 677.5, 681.75, 686.0, 690.25, 694.5, 698.75, 703.0, 707.25, 711.5, 715.75, 720.0] elif self.dataset_type == 'hsodbit_v2': self.wavelengths = [401.5, 404.5, 407.5, 410.5, 413.5, 416.5, 419.5, 422.5, 425.5, 428.5, 431.5, 434.5, 437.5, 440.5, 443.5, 446.5, 449.5, 452.5, 455.5, 458.5, 461.5, 464.5, 467.5, 470.5, 473.5, 476.5, 479.5, 482.5, 485.5, 488.5, 491.5, 494.5, 497.5, 500.5, 503.5, 506.5, 509.5, 512.5, 515.5, 518.5, 521.5, 524.5, 527.5, 530.5, 533.5, 536.5, 539.5, 542.5, 545.5, 548.5, 551.5, 554.5, 557.5, 560.5, 563.5, 566.5, 569.5, 572.5, 575.5, 578.5, 581.5, 584.5, 587.5, 590.5, 593.5, 596.5, 599.5, 602.5, 605.5, 608.5, 611.5, 614.5, 617.5, 620.5, 623.5, 626.5, 629.5, 632.5, 635.5, 638.5, 641.5, 644.5, 647.5, 650.5, 653.5, 656.5, 659.5, 662.5, 665.5, 668.5, 671.5, 674.5, 677.5, 680.5, 683.5, 686.5, 689.5, 692.5, 695.5, 698.5, 701.5, 704.5, 707.5, 710.5, 713.5, 716.5, 719.5, 722.5, 725.5, 728.5, 731.5, 734.5, 737.5, 740.5, 743.5, 746.5, 749.5, 752.5, 755.5, 758.5, 761.5, 764.5, 767.5, 770.5, 773.5, 776.5, 779.5, 782.5, 785.5, 788.5, 791.5, 794.5, 797.5, 800.5, 803.5, 806.5, 809.5, 812.5, 815.5, 818.5, 821.5, 824.5, 827.5, 830.5, 833.5, 836.5, 839.5, 842.5, 845.5, 848.5, 851.5, 854.5, 857.5, 860.5, 863.5, 866.5, 869.5, 872.5, 875.5, 878.5, 881.5, 884.5, 887.5, 890.5, 893.5, 896.5, 899.5, 902.5, 905.5, 908.5, 911.5, 914.5, 917.5, 920.5, 923.5, 926.5, 929.5, 932.5, 935.5, 938.5, 941.5, 944.5, 947.5, 950.5, 953.5, 956.5, 959.5, 962.5, 965.5, 968.5, 971.5, 974.5, 977.5, 980.5, 983.5, 986.5, 989.5, 992.5, 995.5, 998.5] elif self.dataset_type == 'vnihdhiatlimafb': # VNIHDHIATLIMAFB wavelengths (204 bands from 397.32 to 1000.0) self.wavelengths = [397.32, 400.20, 403.09, 405.97, 408.85, 411.74, 414.63, 417.52, 420.40, 423.29, 426.19, 429.08, 431.97, 434.87, 437.76, 440.66, 443.56, 446.45, 449.35, 452.25, 455.16, 458.06, 460.96, 463.87, 466.77, 469.68, 472.59, 475.50, 478.41, 481.32, 484.23, 487.14, 490.06, 492.97, 495.89, 498.80, 501.72, 504.64, 507.56, 510.48, 513.40, 516.33, 519.25, 522.18, 525.10, 528.03, 530.96, 533.89, 536.82, 539.75, 542.68, 545.62, 548.55, 551.49, 554.43, 557.36, 560.30, 563.24, 566.18, 569.12, 572.07, 575.01, 577.96, 580.90, 583.85, 586.80, 589.75, 592.70, 595.65, 598.60, 601.55, 604.51, 607.46, 610.42, 613.38, 616.34, 619.30, 622.26, 625.22, 628.18, 631.15, 634.11, 637.08, 640.04, 643.01, 645.98, 648.95, 651.92, 654.89, 657.87, 660.84, 663.81, 666.79, 669.77, 672.75, 675.73, 678.71, 681.69, 684.67, 687.65, 690.64, 693.62, 696.61, 699.60, 702.58, 705.57, 708.57, 711.56, 714.55, 717.54, 720.54, 723.53, 726.53, 729.53, 732.53, 735.53, 738.53, 741.53, 744.53, 747.54, 750.54, 753.55, 756.56, 759.56, 762.57, 765.58, 768.60, 771.61, 774.62, 777.64, 780.65, 783.67, 786.68, 789.70, 792.72, 795.74, 798.77, 801.79, 804.81, 807.84, 810.86, 813.89, 816.92, 819.95, 822.98, 826.01, 829.04, 832.07, 835.11, 838.14, 841.18, 844.22, 847.25, 850.29, 853.33, 856.37, 859.42, 862.46, 865.50, 868.55, 871.60, 874.64, 877.69, 880.74, 883.79, 886.84, 889.90, 892.95, 896.01, 899.06, 902.12, 905.18, 908.24, 911.30, 914.36, 917.42, 920.48, 923.55, 926.61, 929.68, 932.74, 935.81, 938.88, 941.95, 945.02, 948.10, 951.17, 954.24, 957.32, 960.40, 963.47, 966.55, 969.63, 972.71, 975.79, 978.88, 981.96, 985.05, 988.13, 991.22, 994.31, 997.40, 1000.49, 1003.58] elif self.dataset_type == 'deephsnir': self.wavelengths = [950.0, 952.988048, 955.976096, 958.964143, 961.952191, 964.940239, 967.928287, 970.916335, 973.904382, 976.89243, 979.880478, 982.868526, 985.856574, 988.844622, 991.832669, 994.820717, 997.808765, 1000.796813, 1003.784861, 1006.772908, 1009.760956, 1012.749004, 1015.737052, 1018.7251, 1021.713147, 1024.701195, 1027.689243, 1030.677291, 1033.665339, 1036.653386, 1039.641434, 1042.629482, 1045.61753, 1048.605578, 1051.593625, 1054.581673, 1057.569721, 1060.557769, 1063.545817, 1066.533865, 1069.521912, 1072.50996, 1075.498008, 1078.486056, 1081.474104, 1084.462151, 1087.450199, 1090.438247, 1093.426295, 1096.414343, 1099.40239, 1102.390438, 1105.378486, 1108.366534, 1111.354582, 1114.342629, 1117.330677, 1120.318725, 1123.306773, 1126.294821, 1129.282869, 1132.270916, 1135.258964, 1138.247012, 1141.23506, 1144.223108, 1147.211155, 1150.199203, 1153.187251, 1156.175299, 1159.163347, 1162.151394, 1165.139442, 1168.12749, 1171.115538, 1174.103586, 1177.091633, 1180.079681, 1183.067729, 1186.055777, 1189.043825, 1192.031873, 1195.01992, 1198.007968, 1200.996016, 1203.984064, 1206.972112, 1209.960159, 1212.948207, 1215.936255, 1218.924303, 1221.912351, 1224.900398, 1227.888446, 1230.876494, 1233.864542, 1236.85259, 1239.840637, 1242.828685, 1245.816733, 1248.804781, 1251.792829, 1254.780876, 1257.768924, 1260.756972, 1263.74502, 1266.733068, 1269.721116, 1272.709163, 1275.697211, 1278.685259, 1281.673307, 1284.661355, 1287.649402, 1290.63745, 1293.625498, 1296.613546, 1299.601594, 1302.589641, 1305.577689, 1308.565737, 1311.553785, 1314.541833, 1317.52988, 1320.517928, 1323.505976, 1326.494024, 1329.482072, 1332.47012, 1335.458167, 1338.446215, 1341.434263, 1344.422311, 1347.410359, 1350.398406, 1353.386454, 1356.374502, 1359.36255, 1362.350598, 1365.338645, 1368.326693, 1371.314741, 1374.302789, 1377.290837, 1380.278884, 1383.266932, 1386.25498, 1389.243028, 1392.231076, 1395.219124, 1398.207171, 1401.195219, 1404.183267, 1407.171315, 1410.159363, 1413.14741, 1416.135458, 1419.123506, 1422.111554, 1425.099602, 1428.087649, 1431.075697, 1434.063745, 1437.051793, 1440.039841, 1443.027888, 1446.015936, 1449.003984, 1451.992032, 1454.98008, 1457.968127, 1460.956175, 1463.944223, 1466.932271, 1469.920319, 1472.908367, 1475.896414, 1478.884462, 1481.87251, 1484.860558, 1487.848606, 1490.836653, 1493.824701, 1496.812749, 1499.800797, 1502.788845, 1505.776892, 1508.76494, 1511.752988, 1514.741036, 1517.729084, 1520.717131, 1523.705179, 1526.693227, 1529.681275, 1532.669323, 1535.657371, 1538.645418, 1541.633466, 1544.621514, 1547.609562, 1550.59761, 1553.585657, 1556.573705, 1559.561753, 1562.549801, 1565.537849, 1568.525896, 1571.513944, 1574.501992, 1577.49004, 1580.478088, 1583.466135, 1586.454183, 1589.442231, 1592.430279, 1595.418327, 1598.406375, 1601.394422, 1604.38247, 1607.370518, 1610.358566, 1613.346614, 1616.334661, 1619.322709, 1622.310757, 1625.298805, 1628.286853, 1631.2749, 1634.262948, 1637.250996, 1640.239044, 1643.227092, 1646.215139, 1649.203187, 1652.191235, 1655.179283, 1658.167331, 1661.155378, 1664.143426, 1667.131474, 1670.119522, 1673.10757, 1676.095618, 1679.083665, 1682.071713, 1685.059761, 1688.047809, 1691.035857, 1694.023904, 1697.011952, 1700.0] elif self.dataset_type == 'deephsvis': self.wavelengths = [400.0, 402.690583, 405.381166, 408.071749, 410.762332, 413.452915, 416.143498, 418.834081, 421.524664, 424.215247, 426.90583, 429.596413, 432.286996, 434.977578, 437.668161, 440.358744, 443.049327, 445.73991, 448.430493, 451.121076, 453.811659, 456.502242, 459.192825, 461.883408, 464.573991, 467.264574, 469.955157, 472.64574, 475.336323, 478.026906, 480.717489, 483.408072, 486.098655, 488.789238, 491.479821, 494.170404, 496.860987, 499.55157, 502.242152, 504.932735, 507.623318, 510.313901, 513.004484, 515.695067, 518.38565, 521.076233, 523.766816, 526.457399, 529.147982, 531.838565, 534.529148, 537.219731, 539.910314, 542.600897, 545.29148, 547.982063, 550.672646, 553.363229, 556.053812, 558.744395, 561.434978, 564.125561, 566.816143, 569.506726, 572.197309, 574.887892, 577.578475, 580.269058, 582.959641, 585.650224, 588.340807, 591.03139, 593.721973, 596.412556, 599.103139, 601.793722, 604.484305, 607.174888, 609.865471, 612.556054, 615.246637, 617.93722, 620.627803, 623.318386, 626.008969, 628.699552, 631.390135, 634.080717, 636.7713, 639.461883, 642.152466, 644.843049, 647.533632, 650.224215, 652.914798, 655.605381, 658.295964, 660.986547, 663.67713, 666.367713, 669.058296, 671.748879, 674.439462, 677.130045, 679.820628, 682.511211, 685.201794, 687.892377, 690.58296, 693.273543, 695.964126, 698.654709, 701.345291, 704.035874, 706.726457, 709.41704, 712.107623, 714.798206, 717.488789, 720.179372, 722.869955, 725.560538, 728.251121, 730.941704, 733.632287, 736.32287, 739.013453, 741.704036, 744.394619, 747.085202, 749.775785, 752.466368, 755.156951, 757.847534, 760.538117, 763.2287, 765.919283, 768.609865, 771.300448, 773.991031, 776.681614, 779.372197, 782.06278, 784.753363, 787.443946, 790.134529, 792.825112, 795.515695, 798.206278, 800.896861, 803.587444, 806.278027, 808.96861, 811.659193, 814.349776, 817.040359, 819.730942, 822.421525, 825.112108, 827.802691, 830.493274, 833.183857, 835.874439, 838.565022, 841.255605, 843.946188, 846.636771, 849.327354, 852.017937, 854.70852, 857.399103, 860.089686, 862.780269, 865.470852, 868.161435, 870.852018, 873.542601, 876.233184, 878.923767, 881.61435, 884.304933, 886.995516, 889.686099, 892.376682, 895.067265, 897.757848, 900.44843, 903.139013, 905.829596, 908.520179, 911.210762, 913.901345, 916.591928, 919.282511, 921.973094, 924.663677, 927.35426, 930.044843, 932.735426, 935.426009, 938.116592, 940.807175, 943.497758, 946.188341, 948.878924, 951.569507, 954.26009, 956.950673, 959.641256, 962.331839, 965.022422, 967.713004, 970.403587, 973.09417, 975.784753, 978.475336, 981.165919, 983.856502, 986.547085, 989.237668, 991.928251, 994.618834, 997.309417, 1000.0] elif self.dataset_type == 'deephsviscor': # DeepHS wavelengths (249 bands from 400.0 to 1000.0) self.wavelengths = [400.0, 402.690583, 405.381166, 408.071749, 410.762332, 413.452915, 416.143498, 418.834081, 421.524664, 424.215247, 426.90583, 429.596413, 432.286996, 434.977578, 437.668161, 440.358744, 443.049327, 445.73991, 448.430493, 451.121076, 453.811659, 456.502242, 459.192825, 461.883408, 464.573991, 467.264574, 469.955157, 472.64574, 475.336323, 478.026906, 480.717489, 483.408072, 486.098655, 488.789238, 491.479821, 494.170404, 496.860987, 499.55157, 502.242152, 504.932735, 507.623318, 510.313901, 513.004484, 515.695067, 518.38565, 521.076233, 523.766816, 526.457399, 529.147982, 531.838565, 534.529148, 537.219731, 539.910314, 542.600897, 545.29148, 547.982063, 550.672646, 553.363229, 556.053812, 558.744395, 561.434978, 564.125561, 566.816143, 569.506726, 572.197309, 574.887892, 577.578475, 580.269058, 582.959641, 585.650224, 588.340807, 591.03139, 593.721973, 596.412556, 599.103139, 601.793722, 604.484305, 607.174888, 609.865471, 612.556054, 615.246637, 617.93722, 620.627803, 623.318386, 626.008969, 628.699552, 631.390135, 634.080717, 636.7713, 639.461883, 642.152466, 644.843049, 647.533632, 650.224215, 652.914798, 655.605381, 658.295964, 660.986547, 663.67713, 666.367713, 669.058296, 671.748879, 674.439462, 677.130045, 679.820628, 682.511211, 685.201794, 687.892377, 690.58296, 693.273543, 695.964126, 698.654709, 701.345291, 704.035874, 706.726457, 709.41704, 712.107623, 714.798206, 717.488789, 720.179372, 722.869955, 725.560538, 728.251121, 730.941704, 733.632287, 736.32287, 739.013453, 741.704036, 744.394619, 747.085202, 749.775785, 752.466368, 755.156951, 757.847534, 760.538117, 763.2287, 765.919283, 768.609865, 771.300448, 773.991031, 776.681614, 779.372197, 782.06278, 784.753363, 787.443946, 790.134529, 792.825112, 795.515695, 798.206278, 800.896861, 803.587444, 806.278027, 808.96861, 811.659193, 814.349776, 817.040359, 819.730942, 822.421525, 825.112108, 827.802691, 830.493274, 833.183857, 835.874439, 838.565022, 841.255605, 843.946188, 846.636771, 849.327354, 852.017937, 854.70852, 857.399103, 860.089686, 862.780269, 865.470852, 868.161435, 870.852018, 873.542601, 876.233184, 878.923767, 881.61435, 884.304933, 886.995516, 889.686099, 892.376682, 895.067265, 897.757848, 900.44843, 903.139013, 905.829596, 908.520179, 911.210762, 913.901345, 916.591928, 919.282511, 921.973094, 924.663677, 927.35426, 930.044843, 932.735426, 935.426009, 938.116592, 940.807175, 943.497758, 946.188341, 948.878924, 951.569507, 954.26009, 956.950673, 959.641256, 962.331839, 965.022422, 967.713004, 970.403587, 973.09417, 975.784753, 978.475336, 981.165919, 983.856502, 986.547085, 989.237668, 991.928251, 994.618834, 997.309417, 1000.0] elif self.dataset_type == 'hsodbitv2': # HSODBITV2 wavelengths (200 bands from 401.5 to 998.5) self.wavelengths = [401.5, 404.5, 407.5, 410.5, 413.5, 416.5, 419.5, 422.5, 425.5, 428.5, 431.5, 434.5, 437.5, 440.5, 443.5, 446.5, 449.5, 452.5, 455.5, 458.5, 461.5, 464.5, 467.5, 470.5, 473.5, 476.5, 479.5, 482.5, 485.5, 488.5, 491.5, 494.5, 497.5, 500.5, 503.5, 506.5, 509.5, 512.5, 515.5, 518.5, 521.5, 524.5, 527.5, 530.5, 533.5, 536.5, 539.5, 542.5, 545.5, 548.5, 551.5, 554.5, 557.5, 560.5, 563.5, 566.5, 569.5, 572.5, 575.5, 578.5, 581.5, 584.5, 587.5, 590.5, 593.5, 596.5, 599.5, 602.5, 605.5, 608.5, 611.5, 614.5, 617.5, 620.5, 623.5, 626.5, 629.5, 632.5, 635.5, 638.5, 641.5, 644.5, 647.5, 650.5, 653.5, 656.5, 659.5, 662.5, 665.5, 668.5, 671.5, 674.5, 677.5, 680.5, 683.5, 686.5, 689.5, 692.5, 695.5, 698.5, 701.5, 704.5, 707.5, 710.5, 713.5, 716.5, 719.5, 722.5, 725.5, 728.5, 731.5, 734.5, 737.5, 740.5, 743.5, 746.5, 749.5, 752.5, 755.5, 758.5, 761.5, 764.5, 767.5, 770.5, 773.5, 776.5, 779.5, 782.5, 785.5, 788.5, 791.5, 794.5, 797.5, 800.5, 803.5, 806.5, 809.5, 812.5, 815.5, 818.5, 821.5, 824.5, 827.5, 830.5, 833.5, 836.5, 839.5, 842.5, 845.5, 848.5, 851.5, 854.5, 857.5, 860.5, 863.5, 866.5, 869.5, 872.5, 875.5, 878.5, 881.5, 884.5, 887.5, 890.5, 893.5, 896.5, 899.5, 902.5, 905.5, 908.5, 911.5, 914.5, 917.5, 920.5, 923.5, 926.5, 929.5, 932.5, 935.5, 938.5, 941.5, 944.5, 947.5, 950.5, 953.5, 956.5, 959.5, 962.5, 965.5, 968.5, 971.5, 974.5, 977.5, 980.5, 983.5, 986.5, 989.5, 992.5, 995.5, 998.5] elif self.dataset_type == 'hotvis': # HOT VIS wavelengths (16 bands) self.wavelengths = [463.0, 472.0, 481.0, 490.0, 499.0, 508.0, 517.0, 526.0, 535.0, 544.0, 553.0, 562.0, 571.0, 580.0, 589.0, 598.0] elif self.dataset_type == 'hotnir': # HOT NIR wavelengths (25 bands) self.wavelengths = [668.0, 680.0, 692.0, 704.0, 716.0, 728.0, 740.0, 752.0, 764.0, 776.0, 788.0, 800.0, 812.0, 824.0, 836.0, 848.0, 860.0, 872.0, 884.0, 896.0, 908.0, 920.0, 932.0, 944.0, 956.0] elif self.dataset_type == 'hsiroad': # HSI Road wavelengths (25 bands) self.wavelengths = [600.0, 615.0, 630.0, 645.0, 660.0, 675.0, 690.0, 705.0, 720.0, 735.0, 750.0, 765.0, 780.0, 795.0, 810.0, 825.0, 840.0, 855.0, 870.0, 885.0, 900.0, 915.0, 930.0, 945.0, 960.0] elif self.dataset_type == 'hyperspectralcityv2': # hyperspectralcityv2 wavelengths (128 bands) self.wavelengths = [450.0, 453.937008, 457.874016, 461.811024, 465.748031, 469.685039, 473.622047, 477.559055, 481.496063, 485.433071, 489.370079, 493.307087, 497.244094, 501.181102, 505.11811, 509.055118, 512.992126, 516.929134, 520.866142, 524.80315, 528.740157, 532.677165, 536.614173, 540.551181, 544.488189, 548.425197, 552.362205, 556.299213, 560.23622, 564.173228, 568.110236, 572.047244, 575.984252, 579.92126, 583.858268, 587.795276, 591.732283, 595.669291, 599.606299, 603.543307, 607.480315, 611.417323, 615.354331, 619.291339, 623.228346, 627.165354, 631.102362, 635.03937, 638.976378, 642.913386, 646.850394, 650.787402, 654.724409, 658.661417, 662.598425, 666.535433, 670.472441, 674.409449, 678.346457, 682.283465, 686.220472, 690.15748, 694.094488, 698.031496, 701.968504, 705.905512, 709.84252, 713.779528, 717.716535, 721.653543, 725.590551, 729.527559, 733.464567, 737.401575, 741.338583, 745.275591, 749.212598, 753.149606, 757.086614, 761.023622, 764.96063, 768.897638, 772.834646, 776.771654, 780.708661, 784.645669, 788.582677, 792.519685, 796.456693, 800.393701, 804.330709, 808.267717, 812.204724, 816.141732, 820.07874, 824.015748, 827.952756, 831.889764, 835.826772, 839.76378, 843.700787, 847.637795, 851.574803, 855.511811, 859.448819, 863.385827, 867.322835, 871.259843, 875.19685, 879.133858, 883.070866, 887.007874, 890.944882, 894.88189, 898.818898, 902.755906, 906.692913, 910.629921, 914.566929, 918.503937, 922.440945, 926.377953, 930.314961, 934.251969, 938.188976, 942.125984, 946.062992, 950.0] elif self.dataset_type == 'hyperdrive': # Hyperdrive full dataset wavelengths (33 bands: 24 VNIR + 9 SWIR) self.wavelengths = [660.0, 670.434783, 680.869565, 691.304348, 701.73913, 712.173913, 722.608696, 733.043478, 743.478261, 753.913043, 764.347826, 774.782609, 785.217391, 795.652174, 806.086957, 816.521739, 826.956522, 837.391304, 847.826087, 858.26087, 868.695652, 879.130435, 889.565217, 900.0] + [1100.0, 1175.0, 1250.0, 1325.0, 1400.0, 1475.0, 1550.0, 1625.0, 1700.0] elif self.dataset_type == 'hyperdrivevnir': # HyperdriveVNIR wavelengths (24 VNIR bands only) self.wavelengths = [660.0, 670.434783, 680.869565, 691.304348, 701.73913, 712.173913, 722.608696, 733.043478, 743.478261, 753.913043, 764.347826, 774.782609, 785.217391, 795.652174, 806.086957, 816.521739, 826.956522, 837.391304, 847.826087, 858.26087, 868.695652, 879.130435, 889.565217, 900.0] elif self.dataset_type == 'hyperdriveswir': # HyperdriveSWIR wavelengths (9 SWIR bands only) self.wavelengths = [1100.0, 1175.0, 1250.0, 1325.0, 1400.0, 1475.0, 1550.0, 1625.0, 1700.0] elif self.dataset_type == 'hykov2nir': # hykov2nir wavelengths (25 bands) self.wavelengths = [ 673.37, 674.88, 689.24, 714.08, 728.15, 740.42, 754.96, 767.18, 780.18, 791.21, 803.8, 822.46, 834.33, 844.29, 855.44, 865.25, 875.2, 884.62, 893.66, 909.95, 917.28, 924.59, 930.97, 939.62, 944.82] elif self.dataset_type == 'hykov2vis': # hykov2vis wavelengths (15 bands) self.wavelengths = [ 468.2, 478.34, 490.83, 503.56, 514.11, 526.92, 541.8, 555.12, 569.3, 578.54, 592.71, 600.25, 611.57, 622.49, 642.55] elif self.dataset_type == 'libhsi': # LIBHSI wavelengths (204 bands from 397.32 to 1003.58) self.wavelengths = [397.32,400.20,403.09,405.97,408.85,411.74,414.63,417.52,420.40,423.29,426.19,429.08,431.97,434.87,437.76,440.66,443.56,446.45,449.35,452.25,455.16,458.06,460.96,463.87,466.77,469.68,472.59,475.50,478.41,481.32,484.23,487.14,490.06,492.97,495.89,498.80,501.72,504.64,507.56,510.48,513.40,516.33,519.25,522.18,525.10,528.03,530.96,533.89,536.82,539.75,542.68,545.62,548.55,551.49,554.43,557.36,560.30,563.24,566.18,569.12,572.07,575.01,577.96,580.90,583.85,586.80,589.75,592.70,595.65,598.60,601.55,604.51,607.46,610.42,613.38,616.34,619.30,622.26,625.22,628.18,631.15,634.11,637.08,640.04,643.01,645.98,648.95,651.92,654.89,657.87,660.84,663.81,666.79,669.77,672.75,675.73,678.71,681.69,684.67,687.65,690.64,693.62,696.61,699.60,702.58,705.57,708.57,711.56,714.55,717.54,720.54,723.53,726.53,729.53,732.53,735.53,738.53,741.53,744.53,747.54,750.54,753.55,756.56,759.56,762.57,765.58,768.60,771.61,774.62,777.64,780.65,783.67,786.68,789.70,792.72,795.74,798.77,801.79,804.81,807.84,810.86,813.89,816.92,819.95,822.98,826.01,829.04,832.07,835.11,838.14,841.18,844.22,847.25,850.29,853.33,856.37,859.42,862.46,865.50,868.55,871.60,874.64,877.69,880.74,883.79,886.84,889.90,892.95,896.01,899.06,902.12,905.18,908.24,911.30,914.36,917.42,920.48,923.55,926.61,929.68,932.74,935.81,938.88,941.95,945.02,948.10,951.17,954.24,957.32,960.40,963.47,966.55,969.63,972.71,975.79,978.88,981.96,985.05,988.13,991.22,994.31,997.40,1000.49,1003.58] elif self.dataset_type == 'virginiatree': # VirginiaTechTrees wavelengths (420 bands from 394.7 to 1005.86) self.wavelengths = [394.7, 396.09, 397.48, 398.87, 400.26, 401.66, 403.05, 404.44, 405.83, 407.22, 408.62, 410.01, 411.4, 412.8, 414.19, 415.58, 416.98, 418.37, 419.77, 421.17, 422.56, 423.96, 425.35, 426.75, 428.15, 429.55, 430.94, 432.34, 433.74, 435.14, 436.54, 437.94, 439.34, 440.74, 442.14, 443.54, 444.94, 446.34, 447.75, 449.15, 450.55, 451.95, 453.36, 454.76, 456.17, 457.57, 458.97, 460.38, 461.78, 463.19, 464.6, 466, 467.41, 468.82, 470.22, 471.63, 473.04, 474.45, 475.86, 477.26, 478.67, 480.08, 481.49, 482.9, 484.31, 485.72, 487.14, 488.55, 489.96, 491.37, 492.78, 494.2, 495.61, 497.02, 498.44, 499.85, 501.27, 502.68, 504.1, 505.51, 506.93, 508.34, 509.76, 511.18, 512.59, 514.01, 515.43, 516.85, 518.27, 519.68, 521.1, 522.52, 523.94, 525.36, 526.78, 528.2, 529.62, 531.05, 532.47, 533.89, 535.31, 536.74, 538.16, 539.58, 541.01, 542.43, 543.85, 545.28, 546.7, 548.13, 549.55, 550.98, 552.41, 553.83, 555.26, 556.69, 558.12, 559.54, 560.97, 562.4, 563.83, 565.26, 566.69, 568.12, 569.55, 570.98, 572.41, 573.84, 575.27, 576.71, 578.14, 579.57, 581, 582.44, 583.87, 585.3, 586.74, 588.17, 589.61, 591.04, 592.48, 593.91, 595.35, 596.79, 598.22, 599.66, 601.1, 602.54, 603.97, 605.41, 606.85, 608.29, 609.73, 611.17, 612.61, 614.05, 615.49, 616.93, 618.37, 619.82, 621.26, 622.7, 624.14, 625.59, 627.03, 628.47, 629.92, 631.36, 632.81, 634.25, 635.7, 637.14, 638.59, 640.04, 641.48, 642.93, 644.38, 645.83, 647.27, 648.72, 650.17, 651.62, 653.07, 654.52, 655.97, 657.42, 658.87, 660.32, 661.77, 663.22, 664.68, 666.13, 667.58, 669.03, 670.49, 671.94, 673.4, 674.85, 676.3, 677.76, 679.21, 680.67, 682.13, 683.58, 685.04, 686.5, 687.95, 689.41, 690.87, 692.33, 693.79, 695.24, 696.7, 698.16, 699.62, 701.08, 702.54, 704.01, 705.47, 706.93, 708.39, 709.85, 711.32, 712.78, 714.24, 715.7, 717.17, 718.63, 720.1, 721.56, 723.03, 724.49, 725.96, 727.42, 728.89, 730.36, 731.83, 733.29, 734.76, 736.23, 737.7, 739.17, 740.64, 742.1, 743.57, 745.04, 746.52, 747.99, 749.46, 750.93, 752.4, 753.87, 755.35, 756.82, 758.29, 759.76, 761.24, 762.71, 764.19, 765.66, 767.14, 768.61, 770.09, 771.56, 773.04, 774.52, 775.99, 777.47, 778.95, 780.43, 781.91, 783.38, 784.86, 786.34, 787.82, 789.3, 790.78, 792.26, 793.74, 795.23, 796.71, 798.19, 799.67, 801.15, 802.64, 804.12, 805.6, 807.09, 808.57, 810.06, 811.54, 813.03, 814.51, 816, 817.48, 818.97, 820.46, 821.95, 823.43, 824.92, 826.41, 827.9, 829.39, 830.88, 832.37, 833.86, 835.35, 836.84, 838.33, 839.82, 841.31, 842.8, 844.29, 845.79, 847.28, 848.77, 850.27, 851.76, 853.25, 854.75, 856.24, 857.74, 859.23, 860.73, 862.23, 863.72, 865.22, 866.72, 868.21, 869.71, 871.21, 872.71, 874.21, 875.71, 877.21, 878.71, 880.21, 881.71, 883.21, 884.71, 886.21, 887.71, 889.21, 890.72, 892.22, 893.72, 895.22, 896.73, 898.23, 899.74, 901.24, 902.75, 904.25, 905.76, 907.26, 908.77, 910.28, 911.78, 913.29, 914.8, 916.31, 917.82, 919.32, 920.83, 922.34, 923.85, 925.36, 926.87, 928.38, 929.89, 931.4, 932.92, 934.43, 935.94, 937.45, 938.97, 940.48, 941.99, 943.51, 945.02, 946.54, 948.05, 949.57, 951.08, 952.6, 954.11, 955.63, 957.15, 958.66, 960.18, 961.7, 963.22, 964.74, 966.26, 967.77, 969.29, 970.81, 972.33, 973.85, 975.38, 976.9, 978.42, 979.94, 981.46, 982.98, 984.51, 986.03, 987.55, 989.08, 990.6, 992.13, 993.65, 995.18, 996.7, 998.23, 999.75, 1001.28, 1002.81, 1004.33, 1005.86 ] elif self.dataset_type == 'fiftyoutdoor': # FiftyOutdoor wavelengths (33 bands from 400.0 to 720.0) self.wavelengths = [400.0, 410.0, 420.0, 430.0, 440.0, 450.0, 460.0, 470.0, 480.0, 490.0, 500.0, 510.0, 520.0, 530.0, 540.0, 550.0, 560.0, 570.0, 580.0, 590.0, 600.0, 610.0, 620.0, 630.0, 640.0, 650.0, 660.0, 670.0, 680.0, 690.0, 700.0, 710.0, 720.0] elif self.dataset_type == 'aphid': # APHID wavelengths (237 bands from 436.0 to 965.0) self.wavelengths = [436.0, 438.0, 440.0, 442.0, 445.0, 447.0, 449.0, 451.0, 454.0, 456.0, 458.0, 460.0, 463.0, 465.0, 467.0, 469.0, 472.0, 474.0, 476.0, 478.0, 481.0, 483.0, 485.0, 487.0, 490.0, 492.0, 494.0, 496.0, 499.0, 501.0, 503.0, 505.0, 508.0, 510.0, 512.0, 514.0, 516.0, 519.0, 521.0, 523.0, 525.0, 528.0, 530.0, 532.0, 534.0, 537.0, 539.0, 541.0, 543.0, 546.0, 548.0, 550.0, 552.0, 555.0, 557.0, 559.0, 561.0, 564.0, 566.0, 568.0, 570.0, 573.0, 575.0, 577.0, 579.0, 582.0, 584.0, 586.0, 588.0, 591.0, 593.0, 595.0, 597.0, 600.0, 602.0, 604.0, 606.0, 609.0, 611.0, 613.0, 615.0, 617.0, 620.0, 622.0, 624.0, 626.0, 629.0, 631.0, 633.0, 635.0, 638.0, 640.0, 642.0, 644.0, 647.0, 649.0, 651.0, 653.0, 656.0, 658.0, 660.0, 662.0, 665.0, 667.0, 669.0, 671.0, 674.0, 676.0, 678.0, 680.0, 683.0, 685.0, 687.0, 689.0, 692.0, 694.0, 696.0, 698.0, 701.0, 703.0, 705.0, 707.0, 709.0, 712.0, 714.0, 716.0, 718.0, 721.0, 723.0, 725.0, 727.0, 730.0, 732.0, 734.0, 736.0, 739.0, 741.0, 743.0, 745.0, 748.0, 750.0, 752.0, 754.0, 757.0, 759.0, 761.0, 763.0, 766.0, 768.0, 770.0, 772.0, 775.0, 777.0, 779.0, 781.0, 784.0, 786.0, 788.0, 790.0, 793.0, 795.0, 797.0, 799.0, 801.0, 804.0, 806.0, 808.0, 810.0, 813.0, 815.0, 817.0, 819.0, 822.0, 824.0, 826.0, 828.0, 831.0, 833.0, 835.0, 837.0, 840.0, 842.0, 844.0, 846.0, 849.0, 851.0, 853.0, 855.0, 858.0, 860.0, 862.0, 864.0, 867.0, 869.0, 871.0, 873.0, 876.0, 878.0, 880.0, 882.0, 885.0, 887.0, 889.0, 891.0, 894.0, 896.0, 898.0, 900.0, 902.0, 905.0, 907.0, 909.0, 911.0, 914.0, 916.0, 918.0, 920.0, 923.0, 925.0, 927.0, 929.0, 932.0, 934.0, 936.0, 938.0, 941.0, 943.0, 945.0, 947.0, 950.0, 952.0, 954.0, 956.0, 959.0, 961.0, 963.0, 965.0] else: # Default wavelength range for unknown datasets self.wavelengths = [400.0, 410.0, 420.0, 430.0, 440.0, 450.0, 460.0, 470.0, 480.0, 490.0, 500.0, 510.0, 520.0, 530.0, 540.0, 550.0, 560.0, 570.0, 580.0, 590.0, 600.0, 610.0, 620.0, 630.0, 640.0, 650.0, 660.0, 670.0, 680.0, 690.0, 700.0] def transform(self, results: dict) -> dict: """Transform function to load hyperspectral image. Args: results (dict): Result dict containing img_path. Returns: dict: The dict contains loaded image and meta information. """ _, logger = _get_rank_logger( 'pipeline', logger_cache=self.rank_logger_cache, enable=self.enable_rank_logging, ) dataset_name = results.get('dataset_name', results.get('dataset', 'unknown')) img_path = results['img_path'] if logger is not None: logger.info(f"Loading : {img_path}") # Load image based on dataset type if self.dataset_type == 'harvard': img = self._load_harvard_image(img_path) elif self.dataset_type == 'umld2015': img = self._load_umld2015_image(img_path) elif self.dataset_type == 'umns2002': img = self._load_umns2002_image(img_path) elif self.dataset_type == 'umns2004': img = self._load_umns2004_image(img_path) elif self.dataset_type == 'umos': img = self._load_umos_image(img_path) elif self.dataset_type == 'umri2015': img = self._load_umri2015_image(img_path) elif self.dataset_type == 'umemm': img = self._load_umemm_image(img_path) elif self.dataset_type == 'hyperblood': img = self._load_hyperblood_image(img_path) elif self.dataset_type == 'hsidrive20': img = self._load_hsidrive20_image(img_path) elif self.dataset_type == 'hotrednir': img = self._load_hotrednir_image(img_path) elif self.dataset_type == 'arad_1k_31': img = self._load_arad_1k_31_image(img_path) elif self.dataset_type == 'arad_1k_16': img = self._load_arad_1k_16_image(img_path) elif self.dataset_type == 'cave': img = self._load_cave_image(img_path) elif self.dataset_type == 'icvl': img = self._load_icvl_image(img_path) elif self.dataset_type == 'hs_sod': img = self._load_hs_sod_image(img_path) elif self.dataset_type == 'vnihdhiatlimafb': img = self._load_vnihdhiatlimafb_image(img_path) elif self.dataset_type == 'deephsnir': img = self._load_deephsnir_image(img_path) elif self.dataset_type == 'deephsvis': img = self._load_deephsvis_image(img_path) elif self.dataset_type == 'deephsviscor': img = self._load_deephsviscor_image(img_path) elif self.dataset_type == 'hsodbitv2': img = self._load_hsodbit_v2_image(img_path) elif self.dataset_type == 'hotvis': img = self._load_hotvis_image(img_path) elif self.dataset_type == 'hotnir': img = self._load_hotnir_image(img_path) elif self.dataset_type == 'hsiroad': img = self._load_hsiroad_image(img_path) elif self.dataset_type == 'hyperspectralcityv2': img = self._load_hyperspectralcityv2_image(img_path) elif self.dataset_type == 'hykov2nir': img = self._load_hykov2nir_image(img_path) elif self.dataset_type == 'hykov2vis': img = self._load_hykov2vis_image(img_path) elif self.dataset_type == 'hyperdrive': img = self._load_hyperdrive_image(img_path) elif self.dataset_type == 'hyperdrivevnir': img = self._load_hyperdrivevnir_image(img_path) elif self.dataset_type == 'hyperdriveswir': img = self._load_hyperdriveswir_image(img_path) elif self.dataset_type == 'libhsi': img = self._load_libhsi_image(img_path) elif self.dataset_type == 'virginia_tech_tree': img = self._load_virginiatree_image(img_path) elif self.dataset_type == 'fiftyoutdoor': img = self._load_fiftyoutdoor_image(img_path) elif self.dataset_type == 'aphid': img = self._load_aphid_image(img_path) else: raise ValueError(f"Unsupported dataset type: {self.dataset_type}") # Convert to float32 if needed if self.to_float32: img = img.astype(np.float32) results['img'] = img results['img_shape'] = img.shape[:2] results['ori_shape'] = img.shape[:2] results['wavelengths'] = self.wavelengths if logger is not None: logger.info(f"Finished: {img_path}") return results def _load_harvard_image(self, img_path): """Load Harvard dataset image (.mat file).""" img_cube = loadmat(img_path) img_hsi = img_cube['ref'][:].astype(np.float32) if self.append_rgb: # Harvard RGB bands: [22, 13, 5] corresponding to red, green, blue img_rgb = img_hsi[:, :, [22, 13, 5]] img = np.concatenate((img_hsi, img_rgb), axis=2) else: img = img_hsi return img def _load_umld2015_image(self, img_path): """Load UMDL2015 dataset image (.mat file).""" img_cube = loadmat(img_path) img_hsi = img_cube[list(img_cube.keys())[-1]][:].astype(np.float32) if self.append_rgb: # UMDL2015 RGB bands: [24, 15, 7] corresponding to red, green, blue img_rgb = img_hsi[:, :, [24, 15, 7]] img = np.concatenate((img_hsi, img_rgb), axis=2) else: img = img_hsi return img def _load_umns2002_image(self, img_path): """Load UMNS2002 dataset image (.mat file).""" img_cube = loadmat(img_path) img_hsi = img_cube[list(img_cube.keys())[-1]][:].astype(np.float32) if self.append_rgb: # UMNS2002 RGB bands: [22, 13, 5] corresponding to red, green, blue img_rgb = img_hsi[:,:,[23,14,6]] img = np.concatenate((img_hsi, img_rgb), axis=2) else: img = img_hsi return img def _load_umns2004_image(self, img_path): """Load UMNS2004 dataset image (.mat file).""" img_cube = loadmat(img_path) img_hsi = img_cube[list(img_cube.keys())[-1]][:].astype(np.float32) if self.append_rgb: # UMNS2004 RGB bands: [24, 15, 7] corresponding to red, green, blue img_rgb = img_hsi[:, :, [24, 15, 7]] img = np.concatenate((img_hsi, img_rgb), axis=2) else: img = img_hsi return img def _load_umos_image(self, img_path): """Load UMOS dataset image (.mat file).""" img_cube = loadmat(img_path) img_hsi = img_cube[list(img_cube.keys())[-1]][:].astype(np.float32) if self.append_rgb: # UMOS RGB bands: [22, 13, 5] corresponding to red, green, blue img_rgb = img_hsi[:,:,[24,15,7]] img = np.concatenate((img_hsi, img_rgb), axis=2) else: img = img_hsi return img def _load_umri2015_image(self, img_path): """Load UMRI2015 dataset image (.mat file).""" img_cube = loadmat(img_path) img_hsi = img_cube[list(img_cube.keys())[-1]][:].astype(np.float32) if self.append_rgb: # UMRI2015 RGB bands: [24, 15, 7] corresponding to red, green, blue img_rgb = img_hsi[:, :, [24, 15, 7]] img = np.concatenate((img_hsi, img_rgb), axis=2) else: img = img_hsi return img def _load_umemm_image(self, img_path): """Load UMEMM dataset image (.mat file).""" img_cube = loadmat(img_path) img_hsi = img_cube[list(img_cube.keys())[-1]][:].astype(np.float32) if self.append_rgb: # UMEMM RGB bands: [24, 15, 7] corresponding to red, green, blue img_rgb = img_hsi[:,:,[23,14,6]] img = np.concatenate((img_hsi, img_rgb), axis=2) else: img = img_hsi return img def _load_hyperblood_image(self, img_path): #print(img_path) # with rasterio.open('/home/ps/Documents/data/'+img_path) as data: # img = data.read() # (c, h, w) # img_cube = np.load(img_path).transpose(1,2,0) img_cube,wav = ds_load.get_data(img_path) # hsi.shape = (519, 696, 113) # anno = ds_load.get_anno(filename) img_rgb = ds_load.get_rgb(img_cube, wav) img_hsi = img_cube # img_hsi = (img_hsi - self.min) / (self.max - self.min) if self.append_rgb: img_rgb = ds_load.get_rgb(img_cube, wav) img = np.concatenate((img_hsi, img_rgb), axis=2) else: img = img_hsi # kid = (img - img.min(axis=(0, 1), keepdims=True)) # mom = (img.max(axis=(0, 1), keepdims=True) - img.min(axis=(0, 1), keepdims=True)) # img = kid / (mom+1e-10) # # return img.transpose(1, 2, 0).astype(np.float32) # (h, w, c) return img def _load_hsidrive20_image(self, img_path): """Load HSI-Drive20 dataset image (.npy file).""" img_cube = np.load(img_path) img_hsi = img_cube.astype(np.float32) if self.append_rgb: # HSI-Drive20 special handling for RGB images rgb_path = img_path.replace('_TC.npy', '_pseudocolor.png') rgb_path = rgb_path.replace('_MF', '') rgb_path = rgb_path.replace('/images/', '/RGB/') rgb_path = rgb_path.replace('/test/', '/') rgb_path = rgb_path.replace('/training/', '/') rgb_path = rgb_path.replace('/validation/', '/') if os.path.exists(rgb_path): img_rgb = Image.open(rgb_path) img_rgb = np.asanyarray(img_rgb).astype(np.float32) / 255 img = np.concatenate((img_hsi, img_rgb), axis=2) else: # Fallback: use bands around 650nm, 550nm, 450nm for RGB if img_hsi.shape[2] >= 25: img_rgb = img_hsi[:, :, [20, 15, 10]] # Approximate RGB bands img = np.concatenate((img_hsi, img_rgb), axis=2) else: img = img_hsi else: img = img_hsi return img def _load_hotrednir_image(self, img_path): """Load HOTRedNIR dataset image (.png file).""" # Try to use the original hsi3d module img_cube = get_image_loader(img_file=img_path, cellSize=4)[:, :, :-1] img_hsi = img_cube.astype(np.float32) if self.append_rgb: rgb_path = img_path.replace('/HSI-RedNIR/', '/HSI-RedNIR-FalseColor/').replace(".png", ".jpg") rgb_cube = get_image_loader(rgb_path, cellSize=-1) img_rgb = np.array(rgb_cube).astype(np.float32) / 255 img = np.concatenate((img_hsi, img_rgb), axis=2) else: img = img_hsi return img def _load_arad_1k_31_image(self, img_path): """Load ARAD_1K_31 dataset image (.mat file).""" #print(img_path) # with rasterio.open('/home/ps/Documents/data/'+img_path) as data: # img = data.read() # (c, h, w) img_cube = h5py.File(img_path, 'r') img_hsi = img_cube['cube'][:].transpose(2, 1, 0).astype(np.float32) # img_hsi = (img_hsi - self.min) / (self.max - self.min) if self.append_rgb: rgb_cube_path = img_path.replace('mats', 'rgb') rgb_cube_path = rgb_cube_path.replace('.mat', '.jpg') rgb_cube = Image.open(rgb_cube_path) img_rgb = np.array(rgb_cube).astype(np.float32)/255 img = np.concatenate((img_hsi, img_rgb), axis=2) else: img = img_hsi # kid = (img - img.min(axis=(0, 1), keepdims=True)) # mom = (img.max(axis=(0, 1), keepdims=True) - img.min(axis=(0, 1), keepdims=True)) # img = kid / (mom+1e-10) # # return img.transpose(1, 2, 0).astype(np.float32) # (h, w, c) return img def _load_arad_1k_16_image(self, img_path): """Load ARAD_1K_16 dataset image (.mat file).""" #print(img_path) # with rasterio.open('/home/ps/Documents/data/'+img_path) as data: # img = data.read() # (c, h, w) img_cube = h5py.File(img_path, 'r') img_hsi = img_cube['cube'][:].transpose(2, 1, 0).astype(np.float32) # img_hsi = (img_hsi - self.min) / (self.max - self.min) if self.append_rgb: img = np.concatenate((img_hsi, img_hsi[:,:,[7,4,1]]), axis=2) # kid = (img - img.min(axis=(0, 1), keepdims=True)) # mom = (img.max(axis=(0, 1), keepdims=True) - img.min(axis=(0, 1), keepdims=True)) # img = kid / (mom+1e-10) # # return img.transpose(1, 2, 0).astype(np.float32) # (h, w, c) return img def _load_cave_image(self, img_path): """Load CAVE dataset image (.mat file).""" img_cube = loadmat(img_path) img_hsi = img_cube['DataCube'][:].astype(np.float32) if self.append_rgb: img_rgb = img_hsi[:, :, [24, 15, 7]] img = np.concatenate((img_hsi, img_rgb), axis=2) else: img = img_hsi return img def _load_icvl_image(self, img_path): """Load ICVL dataset image (.h5 file).""" img_cube = h5py.File(img_path, 'r') img_hsi = img_cube['rad'][:].astype(np.float32) img_rgb = img_cube['rgb'][:].astype(np.float32) if self.append_rgb: img_hsi = np.transpose(img_hsi, (2, 1, 0)) img_hsi = np.rot90(img_hsi) img_rgb = np.transpose(img_rgb, (2, 1, 0)) rgb_height, rgb_width = img_rgb.shape[:2] img_hsi = cv2.resize(img_hsi, (rgb_width, rgb_height)) img = np.concatenate((img_hsi, img_rgb), axis=2) else: img = img_hsi def _load_hs_sod_image(self, img_path): """Load HSSOD dataset image (.h5 file).""" try: img_cube = h5py.File(img_path, 'r') img_hsi = img_cube['hypercube'][:].astype(np.float32) img_hsi = np.transpose(img_hsi, (2, 1, 0)) except Exception: img_cube = loadmat(img_path) img_hsi = img_cube['hypercube'].astype(np.float32) if self.append_rgb: rgb_cube_path = img_path.replace('hyperspectral', 'color') rgb_cube_path = rgb_cube_path.replace('.mat', '.jpg') rgb_cube = Image.open(rgb_cube_path) img_rgb = np.array(rgb_cube).astype(np.float32) / 255 img = np.concatenate((img_hsi, img_rgb), axis=2) else: img = img_hsi return img def _load_hsodbit_v2_image(self, img_path): """Load HSODBIT-V2 dataset image (.mat file).""" #print(img_path) try: img_cube = h5py.File(img_path) img_hsi = img_cube['dataset'][:].transpose(2,1,0) except Exception: img_cube = loadmat(img_path) img_hsi = img_cube['dataset'].astype(np.float32) # img_hsi = (img_hsi - self.min) / (self.max - self.min) if self.append_rgb: rgb_path = img_path.replace("/hyperspectral/","/color/") rgb_path = rgb_path.replace(".h5",".jpg") rgb_cube = Image.open(rgb_path) img_rgb = np.array(rgb_cube).astype(np.float32)/255 img = np.concatenate((img_hsi, img_rgb), axis=2) else: img = img_hsi # kid = (img - img.min(axis=(0, 1), keepdims=True)) # mom = (img.max(axis=(0, 1), keepdims=True) - img.min(axis=(0, 1), keepdims=True)) # img = kid / (mom+1e-10) # # return img.transpose(1, 2, 0).astype(np.float32) # (h, w, c) img = img.transpose(1, 0, 2) return img def _load_vnihdhiatlimafb_image(self, img_path): """Load VNIHDHIATLIMAFB dataset image (.hdr file).""" #print(img_path) img_cube = envi.open(img_path).asarray() img_hsi = img_cube # img_hsi = (img_hsi - self.min) / (self.max - self.min) if self.append_rgb: img_rgb = img_hsi[:,:,[90, 40, 28]] img = np.concatenate((img_hsi, img_rgb), axis=2) else: img = img_hsi # kid = (img - img.min(axis=(0, 1), keepdims=True)) # mom = (img.max(axis=(0, 1), keepdims=True) - img.min(axis=(0, 1), keepdims=True)) # img = kid / (mom+1e-10) # # return img.transpose(1, 2, 0).astype(np.float32) # (h, w, c) img = img.transpose(1, 0, 2) return img def _load_deephsnir_image(self, img_path): """Load DeepHSNIR dataset image (.bin file).""" #print(img_path) img_cube = envi.open(img_path.replace('.bin','.hdr'), img_path).asarray() img_hsi = img_cube # img_hsi = (img_hsi - self.min) / (self.max - self.min) if self.append_rgb: img = np.concatenate((img_hsi, img_hsi[:,:,[206,124,42]]), axis=2) # kid = (img - img.min(axis=(0, 1), keepdims=True)) # mom = (img.max(axis=(0, 1), keepdims=True) - img.min(axis=(0, 1), keepdims=True)) # img = kid / (mom+1e-10) # # return img.transpose(1, 2, 0).astype(np.float32) # (h, w, c) return img def _load_deephsvis_image(self, img_path): """Load DeepHSVIS dataset image (.bin file).""" #print(img_path) img_cube = envi.open(img_path.replace('.bin','.hdr'), img_path).asarray() img_hsi = img_cube # img_hsi = (img_hsi - self.min) / (self.max - self.min) if self.append_rgb: img = np.concatenate((img_hsi, img_hsi[:,:,[74,56,19]]), axis=2) # kid = (img - img.min(axis=(0, 1), keepdims=True)) # mom = (img.max(axis=(0, 1), keepdims=True) - img.min(axis=(0, 1), keepdims=True)) # img = kid / (mom+1e-10) # # return img.transpose(1, 2, 0).astype(np.float32) # (h, w, c) return img def _load_deephsviscor_image(self, img_path): """Load DeepHSVISCOR dataset image (.bin file).""" #print(img_path) img_cube = envi.open(img_path.replace('.bin','.hdr'), img_path).asarray() img_hsi = img_cube # img_hsi = (img_hsi - self.min) / (self.max - self.min) if self.append_rgb: img = np.concatenate((img_hsi, img_hsi[:,:,[100,75,24]]), axis=2) # kid = (img - img.min(axis=(0, 1), keepdims=True)) # mom = (img.max(axis=(0, 1), keepdims=True) - img.min(axis=(0, 1), keepdims=True)) # img = kid / (mom+1e-10) # # return img.transpose(1, 2, 0).astype(np.float32) # (h, w, c) return img def _load_hotvis_image(self, img_path): """Load HOTVIS dataset image (.png file).""" # print(img_path) img_cube = get_image_loader(img_file = img_path, cellSize=4) img_hsi = img_cube # img_hsi = (img_hsi - self.min) / (self.max - self.min) if self.append_rgb: rgb_path = img_path.replace('/HSI-VIS/', '/HSI-VIS-FalseColor/').replace(".png",".jpg") rgb_cube = get_image_loader(rgb_path, cellSize=-1) img_rgb = np.array(rgb_cube).astype(np.float32)/255 img = np.concatenate((img_hsi, img_rgb), axis=2) else: img = img_hsi # kid = (img - img.min(axis=(0, 1), keepdims=True)) # mom = (img.max(axis=(0, 1), keepdims=True) - img.min(axis=(0, 1), keepdims=True)) # img = kid / (mom+1e-10) # # return img.transpose(1, 2, 0).astype(np.float32) # (h, w, c) return img def _load_hotnir_image(self, img_path): """Load HOTNIR dataset image (.png file).""" # print(img_path) img_cube = get_image_loader(img_file = img_path, cellSize=5) img_hsi = img_cube # img_hsi = (img_hsi - self.min) / (self.max - self.min) if self.append_rgb: rgb_path = img_path.replace('/HSI-NIR/', '/HSI-NIR-FalseColor/').replace(".png",".jpg") rgb_cube = get_image_loader(rgb_path, cellSize=-1) img_rgb = np.array(rgb_cube).astype(np.float32)/255 img = np.concatenate((img_hsi, img_rgb), axis=2) else: img = img_hsi # kid = (img - img.min(axis=(0, 1), keepdims=True)) # mom = (img.max(axis=(0, 1), keepdims=True) - img.min(axis=(0, 1), keepdims=True)) # img = kid / (mom+1e-10) # # return img.transpose(1, 2, 0).astype(np.float32) # (h, w, c) return img def _load_hsiroad_image(self, img_path): """Load HSIROAD dataset image (.tif file).""" # print(img_path) img_hsi = tifffile.imread(img_path).astype(np.float32) / 255 if self.append_rgb: # rgb_path = img_path.replace('_nir.tif', '_rgb.tif') # img_rgb = tiffile.imread(rgb_path).astype(np.float32) / 255 img_rgb = img_hsi[[21,13,5],...] img = np.concatenate((img_hsi, img_rgb), axis=0) else: img = img_hsi img = img.transpose(1,2,0) # kid = (img - img.min(axis=(0, 1), keepdims=True)) # mom = (img.max(axis=(0, 1), keepdims=True) - img.min(axis=(0, 1), keepdims=True)) # img = kid / (mom+1e-10) # # return img.transpose(1, 2, 0).astype(np.float32) # (h, w, c) return img def _load_hyperspectralcityv2_image(self, img_path): """Load hyperspectralcityv2 dataset image (.hsd file).""" # Read HSD file data= read_HSD(img_path) # Normalize data # data = (data - self.min) / (self.max - self.min) # data = (data - data.min()) / (data.max() - data.min()) if self.append_rgb: # Create pseudo-RGB from spectral bands (using first 3 bands as placeholder) # Update with appropriate band indices for RGB representation if data.shape[2] >= 3: img_rgb = data[:, :,[51, 15, 6]] # Using first 3 bands for RGB else: # If fewer than 3 bands, duplicate available bands img_rgb = np.repeat(data[:, :, :3], 3, axis=2) img = np.concatenate((data, img_rgb), axis=2) else: img = data return img def _load_hykov2nir_image(self, img_path): # Read .mat file img_cube = loadmat(img_path) # Extract the data cube - assuming the last key is the data img_hsi = img_cube['data'] # Normalize data # img_hsi = (img_hsi - self.min) / (self.max - self.min) if self.append_rgb: # Create pseudo-RGB from spectral bands (using appropriate bands for RGB) # For now, using first 3 bands as placeholder if img_hsi.shape[2] >= 3: img_rgb = img_hsi[:, :, [20, 12, 4]] else: img_rgb = np.repeat(img_hsi[:, :, :3], 3, axis=2) img = np.concatenate((img_hsi, img_rgb), axis=2) else: img = img_hsi return img def _load_hykov2vis_image(self, img_path): """Load hykov2vis dataset image (.mat file).""" # Read .mat file img_cube = loadmat(img_path) # Extract the data cube - assuming the last key is the data img_hsi = img_cube['data'] # Normalize data # img_hsi = (img_hsi - self.min) / (self.max - self.min) if self.append_rgb: # Create pseudo-RGB from spectral bands (using appropriate bands for RGB) # For now, using first 3 bands as placeholder if img_hsi.shape[2] >= 3: img_rgb = img_hsi[:, :, [14, 5, 0]] else: img_rgb = np.repeat(img_hsi[:, :, :3], 3, axis=2) img = np.concatenate((img_hsi, img_rgb), axis=2) else: img = img_hsi return img def _load_hyperdrive_image(self, img_path): """Load Hyperdrive dataset image (.npz file).""" img_hsi = np.load(img_path)['cube.npy'] if self.append_rgb: # Create pseudo-RGB from VNIR bands if img_hsi.shape[2] >= 3: rgb_path = img_path.replace('.npz', '.png').replace('/HSI_REGISTERED/', '/RGB_REGISTERED/') img_rgb = np.asarray(Image.open(rgb_path)).astype(np.float32)/255 # img_rgb = np.asanyarray(img_rgb).astype(np.float32)/255 # Use appropriate VNIR bands for RGB representation # img_rgb = img_hsi[:, :, [20, 12, 4]] # Adjust indices based on actual data else: img_rgb = np.repeat(img_hsi[:, :, :3], 3, axis=2) img = np.concatenate((img_hsi, img_rgb), axis=2) else: img = img_hsi return img def _load_hyperdrivevnir_image(self, img_path): """ Load VNIR hyperspectral image from file (first 24 bands only). """ img_hsi = np.load(img_path)['cube.npy'] # Select only the first 24 bands (VNIR) img_hsi = img_hsi[:, :, :24] if self.append_rgb: # Create pseudo-RGB from VNIR bands if img_hsi.shape[2] >= 3: img_rgb = img_hsi[:, :, [20, 12, 4]] else: img_rgb = np.repeat(img_hsi[:, :, :3], 3, axis=2) img = np.concatenate((img_hsi, img_rgb), axis=2) else: img = img_hsi return img def _load_hyperdriveswir_image(self, img_path): """ Load SWIR hyperspectral image from file (last 9 bands only). """ img_hsi = np.load(img_path)['cube.npy'] # Select only the last 9 bands (SWIR) img_hsi = img_hsi[:, :, 24:33] if self.append_rgb: # Create pseudo-RGB from SWIR bands if img_hsi.shape[2] >= 3: img_rgb = img_hsi[:, :, [7,4,1]] else: img_rgb = np.repeat(img_hsi[:, :, :3], 3, axis=2) img = np.concatenate((img_hsi, img_rgb), axis=2) else: img = img_hsi return img def _load_libhsi_image(self, img_path): """Load LIBHSI dataset image (.hdr file).""" img_hsi = np.rot90(envi.open(img_path).asarray().astype(np.float32), -1,axes=(0,1)) if self.append_rgb: # Get corresponding RGB image rgb_path = img_path.replace('.hdr', '.png').replace('reflectance_cubes', 'rgb') # Load RGB image using Pillow img_rgb_pil = Image.open(rgb_path) if img_rgb_pil.mode != 'RGB': img_rgb_pil = img_rgb_pil.convert('RGB') # Convert to numpy array and normalize to [0, 1] img_rgb = np.array(img_rgb_pil).astype(np.float32) / 255.0 # Ensure both images have the same spatial dimensions hsi_h, hsi_w = img_hsi.shape[:2] rgb_h, rgb_w = img_rgb.shape[:2] if hsi_h != rgb_h or hsi_w != rgb_w: # Resize RGB to match HSI dimensions using Pillow img_rgb_pil_resized = img_rgb_pil.resize((hsi_w, hsi_h), Image.LANCZOS) img_rgb = np.array(img_rgb_pil_resized).astype(np.float32) / 255.0 # Concatenate HSI and RGB channels img = np.concatenate((img_hsi, img_rgb), axis=2) else: img = img_hsi return img def _load_virginiatree_image(self, img_path): """Load VirginiaTechTrees dataset image (.hdr file).""" # Load hyperspectral image using spectral library img_hsi = envi.open(img_path).asarray().astype(np.float32) # Normalize to [0, 1] range img_hsi = img_hsi / 4096 # Normalize 16-bit data if self.append_rgb: # Extract RGB channels from hyperspectral data # Using bands that correspond to red, green, blue wavelengths # These indices may need adjustment based on actual wavelength mapping red_band = 163 # Approximate red band index green_band = 93 # Approximate green band index blue_band = 50 # Approximate blue band index img_rgb = img_hsi[:, :, [red_band, green_band, blue_band]] # Concatenate HSI and RGB channels img = np.concatenate((img_hsi, img_rgb), axis=2) else: img = img_hsi img = img.transpose(1, 0, 2) return img def _load_fiftyoutdoor_image(self, img_path): """Load FiftyOutdoor dataset image (.mat file).""" # Load hyperspectral image from .mat file data = loadmat(img_path) img_hsi = data['hsi'].astype(np.float32) # Normalize to [0, 1] range if needed if img_hsi.max() > 1.0: img_hsi = img_hsi / img_hsi.max() if self.append_rgb: # Extract RGB channels from hyperspectral data # Using bands that correspond to red, green, blue wavelengths # For 33 bands with wavelengths 400-720nm, select appropriate bands: # Red: ~650nm (band 25), Green: ~550nm (band 15), Blue: ~450nm (band 5) img_rgb = img_hsi[:, :, [22, 12, 6]] # Concatenate HSI and RGB channels img = np.concatenate((img_hsi, img_rgb), axis=2) else: img = img_hsi return img def _load_aphid_image(self, img_path): """Load APHID dataset image (.npy file).""" #print(img_path) # with rasterio.open('/home/ps/Documents/data/'+img_path) as data: # img = data.read() # (c, h, w) img_cube = np.load(img_path).transpose(1,2,0) img_hsi = img_cube # img_hsi = (img_hsi - self.min) / (self.max - self.min) if self.append_rgb: img_rgb = img_hsi[:,:,[84, 40, 13]] img = np.concatenate((img_hsi, img_rgb), axis=2) else: img = img_hsi # kid = (img - img.min(axis=(0, 1), keepdims=True)) # mom = (img.max(axis=(0, 1), keepdims=True) - img.min(axis=(0, 1), keepdims=True)) # img = kid / (mom+1e-10) # # return img.transpose(1, 2, 0).astype(np.float32) # (h, w, c) return img def _normalize_image(self, img): """Normalize image using dataset-specific parameters.""" # Normalize to [0, 1] range img = (img - self.min_val) / (self.max_val - self.min_val) return img # Pipeline configurations for different datasets harvard_pipeline = [ dict(type='LoadHyperspectralImage', dataset_type='harvard', to_float32=True, append_rgb=True), dict(type='LoadAnnotations', with_bbox=True, with_mask=True), dict(type='PackDetInputs', meta_keys=('img_id', 'img_path', 'ori_shape', 'img_shape', 'scale_factor', 'flip', 'flip_direction', 'wavelengths')) ] umld2015_pipeline = [ dict(type='LoadHyperspectralImage', dataset_type='umld2015', to_float32=True, append_rgb=True), dict(type='LoadAnnotations', with_bbox=True, with_mask=True), dict(type='PackDetInputs', meta_keys=('img_id', 'img_path', 'ori_shape', 'img_shape', 'scale_factor', 'flip', 'flip_direction', 'wavelengths')) ] umemm_pipeline = [ dict(type='LoadHyperspectralImage', dataset_type='umemm', to_float32=True, append_rgb=True), dict(type='LoadAnnotations', with_bbox=True, with_mask=True), dict(type='PackDetInputs', meta_keys=('img_id', 'img_path', 'ori_shape', 'img_shape', 'scale_factor', 'flip', 'flip_direction', 'wavelengths')) ] umns2002_pipeline = [ dict(type='LoadHyperspectralImage', dataset_type='umns2002', to_float32=True, append_rgb=True), dict(type='LoadAnnotations', with_bbox=True, with_mask=True), dict(type='PackDetInputs', meta_keys=('img_id', 'img_path', 'ori_shape', 'img_shape', 'scale_factor', 'flip', 'flip_direction', 'wavelengths')) ] umns2004_pipeline = [ dict(type='LoadHyperspectralImage', dataset_type='umns2004', to_float32=True, append_rgb=True), dict(type='LoadAnnotations', with_bbox=True, with_mask=True), dict(type='PackDetInputs', meta_keys=('img_id', 'img_path', 'ori_shape', 'img_shape', 'scale_factor', 'flip', 'flip_direction', 'wavelengths')) ] umos_pipeline = [ dict(type='LoadHyperspectralImage', dataset_type='umos', to_float32=True, append_rgb=True), dict(type='LoadAnnotations', with_bbox=True, with_mask=True), dict(type='PackDetInputs', meta_keys=('img_id', 'img_path', 'ori_shape', 'img_shape', 'scale_factor', 'flip', 'flip_direction', 'wavelengths')) ] umri2015_pipeline = [ dict(type='LoadHyperspectralImage', dataset_type='umri2015', to_float32=True, append_rgb=True), dict(type='LoadAnnotations', with_bbox=True, with_mask=True), dict(type='PackDetInputs', meta_keys=('img_id', 'img_path', 'ori_shape', 'img_shape', 'scale_factor', 'flip', 'flip_direction', 'wavelengths')) ] hyperblood_pipeline = [ dict(type='LoadHyperspectralImage', dataset_type='hyperblood', to_float32=True, append_rgb=True), dict(type='LoadAnnotations', with_bbox=True, with_mask=True), dict(type='PackDetInputs', meta_keys=('img_id', 'img_path', 'ori_shape', 'img_shape', 'scale_factor', 'flip', 'flip_direction', 'wavelengths')) ] hsidrive20_pipeline = [ dict(type='LoadHyperspectralImage', dataset_type='hsidrive20', to_float32=True, append_rgb=True), dict(type='LoadAnnotations', with_bbox=True, with_mask=True), dict(type='PackDetInputs', meta_keys=('img_id', 'img_path', 'ori_shape', 'img_shape', 'scale_factor', 'flip', 'flip_direction', 'wavelengths')) ] hotrednir_pipeline = [ dict(type='LoadHyperspectralImage', dataset_type='hotrednir', to_float32=True, append_rgb=True), dict(type='LoadAnnotations', with_bbox=True, with_mask=True), dict(type='PackDetInputs', meta_keys=('img_id', 'img_path', 'ori_shape', 'img_shape', 'scale_factor', 'flip', 'flip_direction', 'wavelengths')) ] arad_1k_31_pipeline = [ dict(type='LoadHyperspectralImage', dataset_type='arad_1k_31', to_float32=True, append_rgb=True), dict(type='LoadAnnotations', with_bbox=True, with_mask=True), dict(type='PackDetInputs', meta_keys=('img_id', 'img_path', 'ori_shape', 'img_shape', 'scale_factor', 'flip', 'flip_direction', 'wavelengths')) ] arad_1k_16_pipeline = [ dict(type='LoadHyperspectralImage', dataset_type='arad_1k_16', to_float32=True, append_rgb=True), dict(type='LoadAnnotations', with_bbox=True, with_mask=True), dict(type='PackDetInputs', meta_keys=('img_id', 'img_path', 'ori_shape', 'img_shape', 'scale_factor', 'flip', 'flip_direction', 'wavelengths')) ] cave_pipeline = [ dict(type='LoadHyperspectralImage', dataset_type='cave', to_float32=True, append_rgb=True), dict(type='LoadAnnotations', with_bbox=True, with_mask=True), dict(type='PackDetInputs', meta_keys=('img_id', 'img_path', 'ori_shape', 'img_shape', 'scale_factor', 'flip', 'flip_direction', 'wavelengths')) ] icvl_pipeline = [ dict(type='LoadHyperspectralImage', dataset_type='icvl', to_float32=True, append_rgb=True), dict(type='LoadAnnotations', with_bbox=True, with_mask=True), dict(type='PackDetInputs', meta_keys=('img_id', 'img_path', 'ori_shape', 'img_shape', 'scale_factor', 'flip', 'flip_direction', 'wavelengths')) ] hs_sod_pipeline = [ dict(type='LoadHyperspectralImage', dataset_type='hs_sod', to_float32=True, append_rgb=True), dict(type='LoadAnnotations', with_bbox=True, with_mask=True), dict(type='PackDetInputs', meta_keys=('img_id', 'img_path', 'ori_shape', 'img_shape', 'scale_factor', 'flip', 'flip_direction', 'wavelengths')) ] hsodbit_v2_pipeline = [ dict(type='LoadHyperspectralImage', dataset_type='hsodbit_v2', to_float32=True, append_rgb=True), dict(type='LoadAnnotations', with_bbox=True, with_mask=True), dict(type='PackDetInputs', meta_keys=('img_id', 'img_path', 'ori_shape', 'img_shape', 'scale_factor', 'flip', 'flip_direction', 'wavelengths')) ] # Test pipelines (without augmentation) harvard_test_pipeline = [ dict(type='LoadHyperspectralImage', dataset_type='harvard', to_float32=True, append_rgb=True), dict(type='LoadAnnotations', with_bbox=True, with_mask=True), dict(type='PackDetInputs', meta_keys=('img_id', 'img_path', 'ori_shape', 'img_shape', 'scale_factor', 'flip', 'flip_direction', 'wavelengths')) ] umld2015_test_pipeline = [ dict(type='LoadHyperspectralImage', dataset_type='umld2015', to_float32=True, append_rgb=True), dict(type='LoadAnnotations', with_bbox=True, with_mask=True), dict(type='PackDetInputs', meta_keys=('img_id', 'img_path', 'ori_shape', 'img_shape', 'scale_factor', 'flip', 'flip_direction', 'wavelengths')) ] umemm_test_pipeline = [ dict(type='LoadHyperspectralImage', dataset_type='umemm', to_float32=True, append_rgb=True), dict(type='LoadAnnotations', with_bbox=True, with_mask=True), dict(type='PackDetInputs', meta_keys=('img_id', 'img_path', 'ori_shape', 'img_shape', 'scale_factor', 'flip', 'flip_direction', 'wavelengths')) ] umns2002_test_pipeline = [ dict(type='LoadHyperspectralImage', dataset_type='umns2002', to_float32=True, append_rgb=True), dict(type='LoadAnnotations', with_bbox=True, with_mask=True), dict(type='PackDetInputs', meta_keys=('img_id', 'img_path', 'ori_shape', 'img_shape', 'scale_factor', 'flip', 'flip_direction', 'wavelengths')) ] umns2004_test_pipeline = [ dict(type='LoadHyperspectralImage', dataset_type='umns2004', to_float32=True, append_rgb=True), dict(type='LoadAnnotations', with_bbox=True, with_mask=True), dict(type='PackDetInputs', meta_keys=('img_id', 'img_path', 'ori_shape', 'img_shape', 'scale_factor', 'flip', 'flip_direction', 'wavelengths')) ] umos_test_pipeline = [ dict(type='LoadHyperspectralImage', dataset_type='umos', to_float32=True, append_rgb=True), dict(type='LoadAnnotations', with_bbox=True, with_mask=True), dict(type='PackDetInputs', meta_keys=('img_id', 'img_path', 'ori_shape', 'img_shape', 'scale_factor', 'flip', 'flip_direction', 'wavelengths')) ] umri2015_test_pipeline = [ dict(type='LoadHyperspectralImage', dataset_type='umri2015', to_float32=True, append_rgb=True), dict(type='LoadAnnotations', with_bbox=True, with_mask=True), dict(type='PackDetInputs', meta_keys=('img_id', 'img_path', 'ori_shape', 'img_shape', 'scale_factor', 'flip', 'flip_direction', 'wavelengths')) ] hyperblood_test_pipeline = [ dict(type='LoadHyperspectralImage', dataset_type='hyperblood', to_float32=True, append_rgb=True), dict(type='LoadAnnotations', with_bbox=True, with_mask=True), dict(type='PackDetInputs', meta_keys=('img_id', 'img_path', 'ori_shape', 'img_shape', 'scale_factor', 'flip', 'flip_direction', 'wavelengths')) ] hsidrive20_test_pipeline = [ dict(type='LoadHyperspectralImage', dataset_type='hsidrive20', to_float32=True, append_rgb=True), dict(type='LoadAnnotations', with_bbox=True, with_mask=True), dict(type='PackDetInputs', meta_keys=('img_id', 'img_path', 'ori_shape', 'img_shape', 'scale_factor', 'flip', 'flip_direction', 'wavelengths')) ] hotrednir_test_pipeline = [ dict(type='LoadHyperspectralImage', dataset_type='hotrednir', to_float32=True, append_rgb=True), dict(type='LoadAnnotations', with_bbox=True, with_mask=True), dict(type='PackDetInputs', meta_keys=('img_id', 'img_path', 'ori_shape', 'img_shape', 'scale_factor', 'flip', 'flip_direction', 'wavelengths')) ] arad_1k_31_test_pipeline = [ dict(type='LoadHyperspectralImage', dataset_type='arad_1k_31', to_float32=True, append_rgb=True), dict(type='LoadAnnotations', with_bbox=True, with_mask=True), dict(type='PackDetInputs', meta_keys=('img_id', 'img_path', 'ori_shape', 'img_shape', 'scale_factor', 'flip', 'flip_direction', 'wavelengths')) ] arad_1k_16_test_pipeline = [ dict(type='LoadHyperspectralImage', dataset_type='arad_1k_16', to_float32=True, append_rgb=True), dict(type='LoadAnnotations', with_bbox=True, with_mask=True), dict(type='PackDetInputs', meta_keys=('img_id', 'img_path', 'ori_shape', 'img_shape', 'scale_factor', 'flip', 'flip_direction', 'wavelengths')) ] cave_test_pipeline = [ dict(type='LoadHyperspectralImage', dataset_type='cave', to_float32=True, append_rgb=True), dict(type='LoadAnnotations', with_bbox=True, with_mask=True), dict(type='PackDetInputs', meta_keys=('img_id', 'img_path', 'ori_shape', 'img_shape', 'scale_factor', 'flip', 'flip_direction', 'wavelengths')) ] icvl_test_pipeline = [ dict(type='LoadHyperspectralImage', dataset_type='icvl', to_float32=True, append_rgb=True), dict(type='LoadAnnotations', with_bbox=True, with_mask=True), dict(type='PackDetInputs', meta_keys=('img_id', 'img_path', 'ori_shape', 'img_shape', 'scale_factor', 'flip', 'flip_direction', 'wavelengths')) ] hs_sod_test_pipeline = [ dict(type='LoadHyperspectralImage', dataset_type='hs_sod', to_float32=True, append_rgb=True), dict(type='LoadAnnotations', with_bbox=True, with_mask=True), dict(type='PackDetInputs', meta_keys=('img_id', 'img_path', 'ori_shape', 'img_shape', 'scale_factor', 'flip', 'flip_direction', 'wavelengths')) ] hsodbit_v2_test_pipeline = [ dict(type='LoadHyperspectralImage', dataset_type='hsodbit_v2', to_float32=True, append_rgb=True), dict(type='LoadAnnotations', with_bbox=True, with_mask=True), dict(type='PackDetInputs', meta_keys=('img_id', 'img_path', 'ori_shape', 'img_shape', 'scale_factor', 'flip', 'flip_direction', 'wavelengths')) ] # New dataset pipelines vnihdhiatlimafb_pipeline = [ dict(type='LoadHyperspectralImage', dataset_type='vnihdhiatlimafb', to_float32=True, append_rgb=True), dict(type='LoadAnnotations', with_bbox=True, with_mask=True), dict(type='PackDetInputs', meta_keys=('img_id', 'img_path', 'ori_shape', 'img_shape', 'scale_factor', 'flip', 'flip_direction', 'wavelengths')) ] vnihdhiatlimafb_test_pipeline = [ dict(type='LoadHyperspectralImage', dataset_type='vnihdhiatlimafb', to_float32=True, append_rgb=True), dict(type='LoadAnnotations', with_bbox=True, with_mask=True), dict(type='PackDetInputs', meta_keys=('img_id', 'img_path', 'ori_shape', 'img_shape', 'scale_factor', 'flip', 'flip_direction', 'wavelengths')) ] deephsnir_pipeline = [ dict(type='LoadHyperspectralImage', dataset_type='deephsnir', to_float32=True, append_rgb=True), dict(type='LoadAnnotations', with_bbox=True, with_mask=True), dict(type='PackDetInputs', meta_keys=('img_id', 'img_path', 'ori_shape', 'img_shape', 'scale_factor', 'flip', 'flip_direction', 'wavelengths')) ] deephsnir_test_pipeline = [ dict(type='LoadHyperspectralImage', dataset_type='deephsnir', to_float32=True, append_rgb=True), dict(type='LoadAnnotations', with_bbox=True, with_mask=True), dict(type='PackDetInputs', meta_keys=('img_id', 'img_path', 'ori_shape', 'img_shape', 'scale_factor', 'flip', 'flip_direction', 'wavelengths')) ] deephsvis_pipeline = [ dict(type='LoadHyperspectralImage', dataset_type='deephsvis', to_float32=True, append_rgb=True), dict(type='LoadAnnotations', with_bbox=True, with_mask=True), dict(type='PackDetInputs', meta_keys=('img_id', 'img_path', 'ori_shape', 'img_shape', 'scale_factor', 'flip', 'flip_direction', 'wavelengths')) ] deephsvis_test_pipeline = [ dict(type='LoadHyperspectralImage', dataset_type='deephsvis', to_float32=True, append_rgb=True), dict(type='LoadAnnotations', with_bbox=True, with_mask=True), dict(type='PackDetInputs', meta_keys=('img_id', 'img_path', 'ori_shape', 'img_shape', 'scale_factor', 'flip', 'flip_direction', 'wavelengths')) ] deephsviscor_pipeline = [ dict(type='LoadHyperspectralImage', dataset_type='deephsviscor', to_float32=True, append_rgb=True), dict(type='LoadAnnotations', with_bbox=True, with_mask=True), dict(type='PackDetInputs', meta_keys=('img_id', 'img_path', 'ori_shape', 'img_shape', 'scale_factor', 'flip', 'flip_direction', 'wavelengths')) ] deephsviscor_test_pipeline = [ dict(type='LoadHyperspectralImage', dataset_type='deephsviscor', to_float32=True, append_rgb=True), dict(type='LoadAnnotations', with_bbox=True, with_mask=True), dict(type='PackDetInputs', meta_keys=('img_id', 'img_path', 'ori_shape', 'img_shape', 'scale_factor', 'flip', 'flip_direction', 'wavelengths')) ] hotvis_pipeline = [ dict(type='LoadHyperspectralImage', dataset_type='hotvis', to_float32=True, append_rgb=True), dict(type='LoadAnnotations', with_bbox=True, with_mask=True), dict(type='PackDetInputs', meta_keys=('img_id', 'img_path', 'ori_shape', 'img_shape', 'scale_factor', 'flip', 'flip_direction', 'wavelengths')) ] hotvis_test_pipeline = [ dict(type='LoadHyperspectralImage', dataset_type='hotvis', to_float32=True, append_rgb=True), dict(type='LoadAnnotations', with_bbox=True, with_mask=True), dict(type='PackDetInputs', meta_keys=('img_id', 'img_path', 'ori_shape', 'img_shape', 'scale_factor', 'flip', 'flip_direction', 'wavelengths')) ] hotnir_pipeline = [ dict(type='LoadHyperspectralImage', dataset_type='hotnir', to_float32=True, append_rgb=True), dict(type='LoadAnnotations', with_bbox=True, with_mask=True), dict(type='PackDetInputs', meta_keys=('img_id', 'img_path', 'ori_shape', 'img_shape', 'scale_factor', 'flip', 'flip_direction', 'wavelengths')) ] hotnir_test_pipeline = [ dict(type='LoadHyperspectralImage', dataset_type='hotnir', to_float32=True, append_rgb=True), dict(type='LoadAnnotations', with_bbox=True, with_mask=True), dict(type='PackDetInputs', meta_keys=('img_id', 'img_path', 'ori_shape', 'img_shape', 'scale_factor', 'flip', 'flip_direction', 'wavelengths')) ] hsiroad_pipeline = [ dict(type='LoadHyperspectralImage', dataset_type='hsiroad', to_float32=True, append_rgb=True), dict(type='LoadAnnotations', with_bbox=True, with_mask=True), dict(type='PackDetInputs', meta_keys=('img_id', 'img_path', 'ori_shape', 'img_shape', 'scale_factor', 'flip', 'flip_direction', 'wavelengths')) ] hsiroad_test_pipeline = [ dict(type='LoadHyperspectralImage', dataset_type='hsiroad', to_float32=True, append_rgb=True), dict(type='LoadAnnotations', with_bbox=True, with_mask=True), dict(type='PackDetInputs', meta_keys=('img_id', 'img_path', 'ori_shape', 'img_shape', 'scale_factor', 'flip', 'flip_direction', 'wavelengths')) ] hyperspectralcityv2_pipeline = [ dict(type='LoadHyperspectralImage', dataset_type='hyperspectralcityv2', to_float32=True, append_rgb=True), dict(type='LoadAnnotations', with_bbox=True, with_mask=True), dict(type='PackDetInputs', meta_keys=('img_id', 'img_path', 'ori_shape', 'img_shape', 'scale_factor', 'flip', 'flip_direction', 'wavelengths')) ] hyperspectralcityv2_test_pipeline = [ dict(type='LoadHyperspectralImage', dataset_type='hyperspectralcityv2', to_float32=True, append_rgb=True), dict(type='LoadAnnotations', with_bbox=True, with_mask=True), dict(type='PackDetInputs', meta_keys=('img_id', 'img_path', 'ori_shape', 'img_shape', 'scale_factor', 'flip', 'flip_direction', 'wavelengths')) ] hykov2nir_pipeline = [ dict(type='LoadHyperspectralImage', dataset_type='hykov2nir', to_float32=True, append_rgb=True), dict(type='LoadAnnotations', with_bbox=True, with_mask=True), dict(type='PackDetInputs', meta_keys=('img_id', 'img_path', 'ori_shape', 'img_shape', 'scale_factor', 'flip', 'flip_direction', 'wavelengths')) ] hykov2nir_test_pipeline = [ dict(type='LoadHyperspectralImage', dataset_type='hykov2nir', to_float32=True, append_rgb=True), dict(type='LoadAnnotations', with_bbox=True, with_mask=True), dict(type='PackDetInputs', meta_keys=('img_id', 'img_path', 'ori_shape', 'img_shape', 'scale_factor', 'flip', 'flip_direction', 'wavelengths')) ] hykov2vis_pipeline = [ dict(type='LoadHyperspectralImage', dataset_type='hykov2vis', to_float32=True, append_rgb=True), dict(type='LoadAnnotations', with_bbox=True, with_mask=True), dict(type='PackDetInputs', meta_keys=('img_id', 'img_path', 'ori_shape', 'img_shape', 'scale_factor', 'flip', 'flip_direction', 'wavelengths')) ] hykov2vis_test_pipeline = [ dict(type='LoadHyperspectralImage', dataset_type='hykov2vis', to_float32=True, append_rgb=True), dict(type='LoadAnnotations', with_bbox=True, with_mask=True), dict(type='PackDetInputs', meta_keys=('img_id', 'img_path', 'ori_shape', 'img_shape', 'scale_factor', 'flip', 'flip_direction', 'wavelengths')) ] hyperdrive_pipeline = [ dict(type='LoadHyperspectralImage', dataset_type='hyperdrive', to_float32=True, append_rgb=True), dict(type='LoadAnnotations', with_bbox=True, with_mask=True), dict(type='PackDetInputs', meta_keys=('img_id', 'img_path', 'ori_shape', 'img_shape', 'scale_factor', 'flip', 'flip_direction', 'wavelengths')) ] hyperdrive_test_pipeline = [ dict(type='LoadHyperspectralImage', dataset_type='hyperdrive', to_float32=True, append_rgb=True), dict(type='LoadAnnotations', with_bbox=True, with_mask=True), dict(type='PackDetInputs', meta_keys=('img_id', 'img_path', 'ori_shape', 'img_shape', 'scale_factor', 'flip', 'flip_direction', 'wavelengths')) ] hyperdrivevnir_pipeline = [ dict(type='LoadHyperspectralImage', dataset_type='hyperdrivevnir', to_float32=True, append_rgb=True), dict(type='LoadAnnotations', with_bbox=True, with_mask=True), dict(type='PackDetInputs', meta_keys=('img_id', 'img_path', 'ori_shape', 'img_shape', 'scale_factor', 'flip', 'flip_direction', 'wavelengths')) ] hyperdrivevnir_test_pipeline = [ dict(type='LoadHyperspectralImage', dataset_type='hyperdrivevnir', to_float32=True, append_rgb=True), dict(type='LoadAnnotations', with_bbox=True, with_mask=True), dict(type='PackDetInputs', meta_keys=('img_id', 'img_path', 'ori_shape', 'img_shape', 'scale_factor', 'flip', 'flip_direction', 'wavelengths')) ] hyperdriveswir_pipeline = [ dict(type='LoadHyperspectralImage', dataset_type='hyperdriveswir', to_float32=True, append_rgb=True), dict(type='LoadAnnotations', with_bbox=True, with_mask=True), dict(type='PackDetInputs', meta_keys=('img_id', 'img_path', 'ori_shape', 'img_shape', 'scale_factor', 'flip', 'flip_direction', 'wavelengths')) ] hyperdriveswir_test_pipeline = [ dict(type='LoadHyperspectralImage', dataset_type='hyperdriveswir', to_float32=True, append_rgb=True), dict(type='LoadAnnotations', with_bbox=True, with_mask=True), dict(type='PackDetInputs', meta_keys=('img_id', 'img_path', 'ori_shape', 'img_shape', 'scale_factor', 'flip', 'flip_direction', 'wavelengths')) ] libhsi_pipeline = [ dict(type='LoadHyperspectralImage', dataset_type='libhsi', to_float32=True, append_rgb=True), dict(type='LoadAnnotations', with_bbox=True, with_mask=True), dict(type='PackDetInputs', meta_keys=('img_id', 'img_path', 'ori_shape', 'img_shape', 'scale_factor', 'flip', 'flip_direction', 'wavelengths')) ] libhsi_test_pipeline = [ dict(type='LoadHyperspectralImage', dataset_type='libhsi', to_float32=True, append_rgb=True), dict(type='LoadAnnotations', with_bbox=True, with_mask=True), dict(type='PackDetInputs', meta_keys=('img_id', 'img_path', 'ori_shape', 'img_shape', 'scale_factor', 'flip', 'flip_direction', 'wavelengths')) ] virginiatree_pipeline = [ dict(type='LoadHyperspectralImage', dataset_type='virginiatree', to_float32=True, append_rgb=True), dict(type='LoadAnnotations', with_bbox=True, with_mask=True), dict(type='PackDetInputs', meta_keys=('img_id', 'img_path', 'ori_shape', 'img_shape', 'scale_factor', 'flip', 'flip_direction', 'wavelengths')) ] virginiatree_test_pipeline = [ dict(type='LoadHyperspectralImage', dataset_type='virginiatree', to_float32=True, append_rgb=True), dict(type='LoadAnnotations', with_bbox=True, with_mask=True), dict(type='PackDetInputs', meta_keys=('img_id', 'img_path', 'ori_shape', 'img_shape', 'scale_factor', 'flip', 'flip_direction', 'wavelengths')) ] fiftyoutdoor_pipeline = [ dict(type='LoadHyperspectralImage', dataset_type='fiftyoutdoor', to_float32=True, append_rgb=True), dict(type='LoadAnnotations', with_bbox=True, with_mask=True), dict(type='PackDetInputs', meta_keys=('img_id', 'img_path', 'ori_shape', 'img_shape', 'scale_factor', 'flip', 'flip_direction', 'wavelengths')) ] fiftyoutdoor_test_pipeline = [ dict(type='LoadHyperspectralImage', dataset_type='fiftyoutdoor', to_float32=True, append_rgb=True), dict(type='LoadAnnotations', with_bbox=True, with_mask=True), dict(type='PackDetInputs', meta_keys=('img_id', 'img_path', 'ori_shape', 'img_shape', 'scale_factor', 'flip', 'flip_direction', 'wavelengths')) ] # APHID (Agricultural plant hyperspectral imaging dataset) pipeline configurations aphid_pipeline = [ dict(type='LoadHyperspectralImage', dataset_type='aphid', to_float32=True, append_rgb=True), dict(type='LoadAnnotations', with_bbox=True, with_mask=True), dict(type='PackDetInputs', meta_keys=('img_id', 'img_path', 'ori_shape', 'img_shape', 'scale_factor', 'flip', 'flip_direction', 'wavelengths')) ] aphid_test_pipeline = [ dict(type='LoadHyperspectralImage', dataset_type='aphid', to_float32=True, append_rgb=True), dict(type='LoadAnnotations', with_bbox=True, with_mask=True), dict(type='PackDetInputs', meta_keys=('img_id', 'img_path', 'ori_shape', 'img_shape', 'scale_factor', 'flip', 'flip_direction', 'wavelengths')) ] # Universal training pipeline for all datasets def create_universal_train_pipeline(dataset_type, crop_size=(512, 512)): """Create a universal training pipeline for all hyperspectral datasets. Args: dataset_type (str): Type of dataset crop_size (tuple): Crop size for RandomCrop Returns: list: Training pipeline configuration """ pipeline = [ dict(type='LoadHyperspectralImage', dataset_type=dataset_type, to_float32=True, append_rgb=True), dict(type='LoadAnnotations', with_bbox=True, with_mask=True), # dict(type='RandomResize', scale=(512, 512), ratio_range=(0.5, 2.0), keep_ratio=True), # dict(type='RandomCrop', crop_size=crop_size), dict(type='RandomFlip', prob=.5), dict(type='PackDetInputs', meta_keys=('img_id', 'img_path', 'ori_shape', 'img_shape', 'scale_factor', 'flip', 'flip_direction', 'wavelengths')), ] return pipeline # Universal test pipeline for all datasets def create_universal_test_pipeline(dataset_type): """Create a universal test pipeline for all hyperspectral datasets. Args: dataset_type (str): Type of dataset Returns: list: Test pipeline configuration """ return [ dict(type='LoadHyperspectralImage', dataset_type=dataset_type, to_float32=True, append_rgb=True), dict(type='LoadAnnotations', with_bbox=True, with_mask=True), dict(type='PackDetInputs', meta_keys=('img_id', 'img_path', 'ori_shape', 'img_shape', 'scale_factor', 'flip', 'flip_direction', 'wavelengths')) ] # Pre-defined universal pipelines for common datasets harvard_universal_train_pipeline = create_universal_train_pipeline('harvard') harvard_universal_test_pipeline = create_universal_test_pipeline('harvard') umld2015_universal_train_pipeline = create_universal_train_pipeline('umld2015') umld2015_universal_test_pipeline = create_universal_test_pipeline('umld2015') hsodbitv2_universal_train_pipeline = create_universal_train_pipeline('hsodbitv2') hsodbitv2_universal_test_pipeline = create_universal_test_pipeline('hsodbitv2') vnihdhiatlimafb_universal_train_pipeline = create_universal_train_pipeline('vnihdhiatlimafb') vnihdhiatlimafb_universal_test_pipeline = create_universal_test_pipeline('vnihdhiatlimafb') virginia_tech_tree_universal_train_pipeline = create_universal_train_pipeline('virginia_tech_tree') virginia_tech_tree_universal_test_pipeline = create_universal_test_pipeline('virginia_tech_tree') # Additional datasets arad_1k_31_universal_train_pipeline = create_universal_train_pipeline('arad_1k_31') arad_1k_31_universal_test_pipeline = create_universal_test_pipeline('arad_1k_31') hs_sod_universal_train_pipeline = create_universal_train_pipeline('hs_sod') hs_sod_universal_test_pipeline = create_universal_test_pipeline('hs_sod') cave_universal_train_pipeline = create_universal_train_pipeline('cave') cave_universal_test_pipeline = create_universal_test_pipeline('cave') icvl_universal_train_pipeline = create_universal_train_pipeline('icvl') icvl_universal_test_pipeline = create_universal_test_pipeline('icvl') # Additional universal pipelines for all datasets umld2015_universal_train_pipeline = create_universal_train_pipeline('umld2015') umld2015_universal_test_pipeline = create_universal_test_pipeline('umld2015') umns2002_universal_train_pipeline = create_universal_train_pipeline('umns2002') umns2002_universal_test_pipeline = create_universal_test_pipeline('umns2002') umns2004_universal_train_pipeline = create_universal_train_pipeline('umns2004') umns2004_universal_test_pipeline = create_universal_test_pipeline('umns2004') umos_universal_train_pipeline = create_universal_train_pipeline('umos') umos_universal_test_pipeline = create_universal_test_pipeline('umos') umri2015_universal_train_pipeline = create_universal_train_pipeline('umri2015') umri2015_universal_test_pipeline = create_universal_test_pipeline('umri2015') umemm_universal_train_pipeline = create_universal_train_pipeline('umemm') umemm_universal_test_pipeline = create_universal_test_pipeline('umemm') hyperblood_universal_train_pipeline = create_universal_train_pipeline('hyperblood') hyperblood_universal_test_pipeline = create_universal_test_pipeline('hyperblood') hsidrive20_universal_train_pipeline = create_universal_train_pipeline('hsidrive20') hsidrive20_universal_test_pipeline = create_universal_test_pipeline('hsidrive20') hotrednir_universal_train_pipeline = create_universal_train_pipeline('hotrednir') hotrednir_universal_test_pipeline = create_universal_test_pipeline('hotrednir') arad_1k_16_universal_train_pipeline = create_universal_train_pipeline('arad_1k_16') arad_1k_16_universal_test_pipeline = create_universal_test_pipeline('arad_1k_16') hotvis_universal_train_pipeline = create_universal_train_pipeline('hotvis') hotvis_universal_test_pipeline = create_universal_test_pipeline('hotvis') hotnir_universal_train_pipeline = create_universal_train_pipeline('hotnir') hotnir_universal_test_pipeline = create_universal_test_pipeline('hotnir') libhsi_universal_train_pipeline = create_universal_train_pipeline('libhsi') libhsi_universal_test_pipeline = create_universal_test_pipeline('libhsi') fiftyoutdoor_universal_train_pipeline = create_universal_train_pipeline('fiftyoutdoor') fiftyoutdoor_universal_test_pipeline = create_universal_test_pipeline('fiftyoutdoor') aphid_universal_train_pipeline = create_universal_train_pipeline('aphid') aphid_universal_test_pipeline = create_universal_test_pipeline('aphid') hyperspectralcityv2_universal_train_pipeline = create_universal_train_pipeline('hyperspectralcityv2') hyperspectralcityv2_universal_test_pipeline = create_universal_test_pipeline('hyperspectralcityv2') hykov2nir_universal_train_pipeline = create_universal_train_pipeline('hykov2nir') hykov2nir_universal_test_pipeline = create_universal_test_pipeline('hykov2nir') hykov2vis_universal_train_pipeline = create_universal_train_pipeline('hykov2vis') hykov2vis_universal_test_pipeline = create_universal_test_pipeline('hykov2vis') deephsnir_universal_train_pipeline = create_universal_train_pipeline('deephsnir') deephsnir_universal_test_pipeline = create_universal_test_pipeline('deephsnir') deephsvis_universal_train_pipeline = create_universal_train_pipeline('deephsvis') deephsvis_universal_test_pipeline = create_universal_test_pipeline('deephsvis') deephsviscor_universal_train_pipeline = create_universal_train_pipeline('deephsviscor') deephsviscor_universal_test_pipeline = create_universal_test_pipeline('deephsviscor') hsiroad_universal_train_pipeline = create_universal_train_pipeline('hsiroad') hsiroad_universal_test_pipeline = create_universal_test_pipeline('hsiroad') hyperdrivevnir_universal_train_pipeline = create_universal_train_pipeline('hyperdrivevnir') hyperdrivevnir_universal_test_pipeline = create_universal_test_pipeline('hyperdrivevnir') hyperdriveswir_universal_train_pipeline = create_universal_train_pipeline('hyperdriveswir') hyperdriveswir_universal_test_pipeline = create_universal_test_pipeline('hyperdriveswir') hyperdrive_universal_train_pipeline = create_universal_train_pipeline('hyperdrive') hyperdrive_universal_test_pipeline = create_universal_test_pipeline('hyperdrive')