Published April 28, 2026
| Version v1.1.0
Software
Open
dsgoficial/pytorch_segmentation_models_trainer: Release v1.1.0
Authors/Creators
- 1. UFMG
- 2. @anthropics
- 3. @ultralytics @viddexa
Description
Bug fixes
- Fixed
tests/test_build_mask.py::Test_BuildMask::test_build_output_dirs_raises_exception: changed the output path to be a sub-directory of the input path in the test, ensuring the path validation logic inbuild_destination_dirsis correctly triggered and the expected exception is raised. - Fixed
tests/test_configs/predict.yamlHydra composition: added the@_global_package override to thetrain_config_used_in_predict_testdefault inclusion. This ensures the configuration fields are merged into the root scope, allowingtrain_dataset.input_csv_pathto be successfully overridden during prediction tests. - Fixed
NameError: name 'DictConfig' is not definedindataset_loader/dataset.py(load_augmentation_object):DictConfigwas used but not imported fromomegaconf, causing all augmentation loading to silently fall back to raw OmegaConf objects and crash withalbumentations >= 2.xwhenA.Composetried to access.available_keyson them. - Fixed
Model._unpack_batch(model_loader/model.py) to respect theimage_keyandmask_keyconfig fields (was hardcoded to"image"/"mask"). Also propagated the fix to_shared_stepso training/validation steps honour custom keys end-to-end. - Fixed
ValueError: prefetch_factor option could only be specified in multiprocessinginModel.train_dataloader,val_dataloader, andtest_dataloader: whennum_workers=0,prefetch_factoris now set toNoneas required by PyTorch's DataLoader API. - Fixed
MCDropoutInferenceProcessor(tools/inference/mc_dropout_inference_processor.py) to save uncertainty rasters with suffix_mc_uncertaintyinstead of the generic_uncertaintyfrom the parent class, matching the test expectation and making it distinguishable from TTA uncertainty maps. - Fixed
merge_lora_weights(fine_tuning/lora_utils.py) to useis_peft_model()for the PEFT check rather than a localisinstanceguard; this makes the function testable without a real PEFT installation and consistent withis_peft_model. - Fixed
TimmEncoderWithSMPDecoder(custom_models/timm_models.py) for SMP 0.5.0 compatibility: replaced removeduse_batchnormkwarg withuse_norminUnetDecoder.__init__, and changed the decoderforwardcall to pass features as a single list instead of splatted positional arguments (bothUnetDecoderandFPNDecodernow useforward(features: list)in SMP 0.5.x). - Updated
test_caches.py::TestClassPresenceCacheAutoSave::test_auto_save_json_structureto account for the_configmetadata key now present in the class-presence cache JSON, filtering it out before counting data entries. - Fixed
Model._shared_step(model_loader/model.py) to apply_prepare_preds_for_metricsbefore computing train/val metrics: binary models output[B, 1, H, W]but torchmetrics expects[B, H, W], causing a shape mismatchRuntimeErrorduring training. The same fix was applied to the per-class IoU path. - Fixed
test_frame_field_model.py::_make_ff_batch:class_freqwas built astorch.ones(B)(1-D) butcompute_seg_loss_weightsinbase_loss.pysums overdim=1, requiring[B, C]. Also added the missinggt_crossfield_angle: torch.zeros(B, 1, H, W)key, required bycompute_gt_fieldwhencompute_crossfield: true. - Fixed
mod_polymapper.pyvalidation metric logging: addednumel() > 0guard to skip empty tensors (produced when no polygons are detected infast_dev_run), and added.float()before.mean()to handle Long-dtype metric values, preventingValueError: tensor must have a single elementandRuntimeError: mean() dtype. - Fixed
test_polygonizer.py::test_polygonizer_acm_processor: replacedgeopandas.testing.geom_almost_equals(fixed 5×10⁻⁷ m tolerance, too strict for GeoJSON coordinate rounding) with a 1 cm tolerance wrapper; regenerated theacm_polygonizer.geojsonbaseline because the ACM algorithm produces different vertex coordinates with newer shapely/geopandas. - Fixed
custom_callbacks/image_callbacks.py:CombinedLoader.loaderswas renamed toCombinedLoader.iterablesin PyTorch Lightning ≥ 2.x; added agetattrfallback so the callback works on both old and new PL versions. Also fixed the follow-upDataLoader.loader.datasetchain: PL ≥ 2.x exposes plainDataLoaderobjects initerables, so.datasetis now accessed directly with a fallback to the old.loader.datasetpath.
Installation & Environment
- Migrated to
uvas the primary project and dependency manager. - Added
uv syncas the recommended installation method inREADME.mdand documentation. - Updated project requirements to Python 3.12+ and PyTorch 2.0+ (Lightning 2.4+).
- Updated website documentation (
website/docs/getting-started/installation.md) with comprehensiveuvinstallation guide and updated troubleshooting for CUDA 11.8.
Reproducibility (Training Seed)
- Added
seed: Optional[int]anddeterministic_cudnn: boolfields to theTrainConfigdataclass (config_definitions/train_config.py). Both default toNone/Falseso all existing configs are fully backward-compatible. - Added
set_training_seed(seed, deterministic_cudnn=False)utility function (utils/seed_utils.py). A single call seeds all randomness sources before model or dataset creation: Pythonrandom, NumPynp.random,torch.manual_seed,torch.cuda.manual_seed_all, andPYTHONHASHSEED. Optionally setstorch.backends.cudnn.deterministic = Trueandtorch.backends.cudnn.benchmark = False. Returns atorch.Generatorseeded with the same value for use in DataLoaders. - Modified
train()(train.py) to callset_training_seedas the very first operation whencfg.seedis present, ensuring model weight initialisation (SMP, timm, HuggingFace, custom architectures) is also reproducible. - Modified
_worker_init_fn(dataset_loader/dataset.py) to additionally seed Python'srandommodule alongside NumPy. Since PyTorch setstorch.initial_seed() = global_seed + worker_idper worker automatically, both seeds are deterministic and unique per worker once a global seed is set. - Modified
Model.train_dataloader,Model.val_dataloader, andModel.test_dataloader(model_loader/model.py) to pass atorch.Generator().manual_seed(cfg.seed)to eachDataLoaderwhencfg.seedis set, making the shuffle sampler sequence reproducible. AddedModel._make_dataloader_generator()helper method. - Added reference YAML config
conf/examples/reproducible_training.yamlwith inline comments explaining every field and listing all controlled randomness sources. - Added reproducibility block (commented) to
conf/examples/smp_mit_b2.yamlso users can enable it in one line. - Added user documentation
website/docs/user-guide/reproducibility.mdcovering theseedfield,deterministic_cudnntrade-offs, Python API usage, and known limitations.
MC Dropout (test-time uncertainty)
- Added
mc_dropout_utils.py(utils/mc_dropout_utils.py): three pure utility functions with no inference-framework dependency.enable_mc_dropout(model)sets allDropout/Dropout2d/Dropout3dlayers to train mode while leaving the rest of the model in eval mode (BatchNorm keeps running statistics, only dropout randomness is re-enabled).warn_if_no_dropout(model)emits aUserWarningif the model has no dropout layers — in that case all T samples are identical and uncertainty is zero.compute_uncertainty(samples, mode)accepts a[T, B, C, H, W]tensor of softmax probabilities and returns[B, 1, H, W]uncertainty:"entropy"computes predictive entropy of the mean distribution (total uncertainty);"mutual_information"computes BALD — the difference between the entropy of the mean and the mean of the individual entropies (epistemic uncertainty only). - Added
MCDropoutInferenceProcessor(tools/inference/mc_dropout_inference_processor.py): extendsMultiClassInferenceProcessorwith MC Dropout inference. Overridespredict_and_mergeto runn_samplesstochastic forward passes per tile (after callingenable_mc_dropout), average the softmax probabilities for the class prediction, and — only whenexport_uncertainty_map=True— compute and merge the per-pixel uncertainty map. Uncertainty tensors are only allocated when requested, keeping the no-uncertainty path free of extra memory cost. Overridesprocessto skip the striped inference path (which uses a single TileMerger and cannot merge uncertainty); a warning is logged for large images. Exports{stem}_mc_uncertainty.tif(float32 single-band GeoTIFF, range[0, log C]) alongside the segmentation output whenexport_uncertainty_map=True. - Modified
MultiClassInferenceProcessor(tools/inference/inference_processors.py): added three new parametersexport_uncertainty_map(defaultFalse),uncertainty_mode(default"entropy"), andoutput_uncertainty_dir(defaultNone). Whentta_modeis set andexport_uncertainty_map=True, per-sample softmax probabilities are kept during the TTA loop and used to compute uncertainty viacompute_uncertainty(); the result is merged via a separateTileMergerand exported as{stem}_uncertainty.tif. The no-uncertainty path (default) is fully unchanged. Added_save_uncertainty_rasterhelper for writing the float32 GeoTIFF with source CRS and transform preserved. - Added
MCDropoutInferenceProcessorConfig(config_definitions/mc_dropout_config.py): Hydra dataclass registered in the ConfigStore undergroup="inference_processor",name="mc_dropout". Fields:n_samples,uncertainty_mode,export_uncertainty_map,num_classes,model_input_shape,step_shape,output_uncertainty_dir. - Added reference YAML config
mc_dropout_inference.yamlunderconf/examples/with inline comments explaining thedecoder_dropoutrequirement and theexport_uncertainty_mapflag.
Evidential Deep Learning (EDL)
- Added
EvidentialWrapper(custom_models/edl_wrapper.py): architecture-agnostic wrapper that replaces Softmax with a Dirichlet parameterisation (evidence = Softplus(logits),alpha = evidence + 1). Works with any model that returns[B, K, H, W]tensors including SMP, HuggingFace, timm, and custom models. Forward pass returns a dict withlogits,evidence,alpha,probs, anduncertaintykeys. Handles tuple, dict, and plain-tensor model outputs automatically. - Added
EvidentialMSELossandEvidentialKLLoss(custom_losses/edl_loss.py): two-component EDL loss designed for use with the existingCompoundLoss/MultiLossepoch-weight scheduling mechanism.EvidentialMSELosscomputes the MSE integrated analytically over the Dirichlet distribution (bias² + variance terms).EvidentialKLLosscomputesKL[Dir(α̃) || Dir(1,...,1)]after removing evidence for the correct class, penalising residual wrong-class evidence. KL annealing is expressed as a dynamic weight list in the YAML — no custom scheduler needed. - Added
edl_utils.py(custom_losses/edl_utils.py): analytic helpers for Dirichlet statistics:one_hot_encode(hard + soft label support, ignore_index handling),dirichlet_strength,epistemic_uncertainty(u = K/S),dirichlet_kl_divergence,kl_divergence_to_uniform,edl_kl_regulariser. - Modified
Model._shared_stepto detectEvidentialWrapperoutput (dict with"alpha"key):probsis extracted for metrics and logging; mean uncertaintyedl/{prefix}_uncertaintyis logged automatically at each step. The change is backward-compatible — non-EDL models are unaffected. - Added
EvidentialWarmupCallback(custom_callbacks/edl_callbacks.py): three-phase encoder freeze schedule for fine-tuning. Phase 1 (epoch < warmup_epochs): encoder frozen. Phase 2 (warmup_epochs ≤ epoch < partial_unfreeze_epoch): last two encoder stages unfrozen. Phase 3 (epoch ≥ partial_unfreeze_epoch): full encoder unfrozen. Settingfreeze_encoder=False(training from scratch) disables all freezing while preserving the logging hooks. - Added
EvidentialUncertaintyVisualizationCallback(custom_callbacks/edl_callbacks.py): logs a 4-column diagnostic grid[input | predicted class | uncertainty map | ground truth]every N validation epochs. Compatible with TensorBoard, WandB, and plain file-system fallback. - Added
EvidentialInferenceProcessor(tools/inference/edl_inference_processor.py): extendsSingleImageInfereceProcessorwith separateTileMergerinstances for probabilities and uncertainty. Exports a single-band float32 GeoTIFF of the uncertainty map (u = K/S) viasave_uncertainty_raster, preserving source CRS and transform exactly. Optional alpha band export viaexport_alpha=True. - Added
edl_config.py(config_definitions/edl_config.py): Hydra dataclass configs forEvidentialWrapper,EvidentialMSELoss,EvidentialKLLoss,EvidentialWarmupCallback,EvidentialUncertaintyVisualizationCallback, andEvidentialInferenceProcessor, all registered in the ConfigStore. - Added reference YAML configs
edl_from_scratch.yamlandedl_finetune.yamlunderconf/examples/with inline comments explaining every field.
RandomCropSegmentationDataset
- Added
RandomCropSegmentationDataset: reads large GeoTIFF images on-the-fly using rasterio windowed reads instead of pre-generating tiles on disk. Eliminates the disk-space overhead of a tile library and allows crop size, augmentation, and sampling strategy to be changed without reprocessing data. - Per-worker LRU cache (
_RasterioLRUCache) keeps a configurable number of openDatasetReaderhandles (lru_cache_size, default64) to avoid repeated rasterio open/close overhead. class_balanced_sampling: weights image selection by inverse class frequency so images containing rare classes are sampled more often. Computed once at dataset initialisation from mask histograms in the CSV.- Class-aware
CutMix(cutmix_prob,cutmix_alpha): pastes a rectangular region from a second crop chosen to maximise class diversity. ClassMix(classmix_prob): copies a randomly selected class region from a second image and pastes it onto the primary crop; particularly effective for rare classes.soft_labelsmode: returns float masks in[0, 1]for label-noise and probabilistic annotation workflows. The_shared_steptraining loop detects soft labels automatically and uses the appropriate loss path.grid_mode/grid_step: switches from random crop positions to a deterministic sliding-window grid for reproducible validation coverage and pseudo-labelling.configure_optimizersaccounts for grid mode when computingsteps_per_epochforOneCycleLR.- Added
RandomCropSegmentationDatasetConfigdataclass.
Mixture of Experts Models
- Added
UPerNetMoE(custom_models/upernet_moe.py): UPerNet variant that replaces fusion and/or FPN convolutions withMoEConv2dReLUblocks. Supportstoken_choice(each token picks top-k experts) andexpert_choice(each expert picks top-k tokens) routing, configurable noise injection, capacity factor, and an optional shared dense expert. Load-balancing auxiliary loss is automatically detected and added to the training loss in_shared_step. - Added
UPerNetMEDoE(custom_models/upernet_medoe.py): extendsUPerNetMoEwith structured expert dropout during training (randomly drops a fraction of experts per forward pass) to improve regularisation and reduce reliance on any single expert._shared_stepautomatically logsextra/train_medoe_expert_utilizationandextra/train_medoe_expert_entropywhen a MEDoE model is detected.
Dual-Head Training
- Added
UPerNetDualHead(custom_models/upernet_dual_head.py): UPerNet with two independent decoders sharing a single encoder. Head A is supervised with hard labels (integer class indices); Head B is supervised with soft labels (float probabilities). A consistency loss couples the two heads during training.inference_headcontrols which head is active at inference time:"A","B", or"average"(default).
TTA improvements
- Added
tta_modecompact interface: passingtta_mode: "d4"ortta_mode: "flip"to any inference processor or totest_stepautomatically selects the corresponding augmentation preset (d4= all 8 D4 symmetries;flip= 4 flip/rotation combinations), without listing augmentations explicitly. SingleImageInfereceProcessornow acceptstta_modeas an alias foruse_tta=True+ the corresponding augmentations list. Backward-compatible with the existinguse_tta+tta_augmentationsinterface.MultiClassInferenceProcessornow acceptstta_mode(replaces the previoususe_ttaparameter on that class)._get_tta_augmentations()inModelcheckscfg.tta_modefirst; falls back tocfg.use_tta+cfg.tta_augmentationsfor backward compatibility.
MultiClassInferenceProcessor improvements
- Added striped inference (
make_inference_striped): very large images are automatically split into horizontal stripes when pixel count exceedsstriped_threshold_pixels(default 50 MP), processed in parallel viaThreadPoolExecutor, and reassembled in-memory. Stripe height is configurable viastripe_height(default 4096 px). - Added confidence map output:
confidence_mode("max_prob"or"entropy") computes per-pixel confidence scores alongside the class prediction. Saved tooutput_probs_dirwhen provided. - Added
tile_weightparameter (passed through toAbstractInferenceProcessor) to control how overlapping tile predictions are merged. process()override: automatically routes each image to the striped or standard inference path based on image size.
Callbacks
- Added
EMACallback: maintains an exponential moving average of model weights (configurabledecay). During validation the shadow EMA weights are swapped in so validation metrics reflect the averaged model; the original weights are restored immediately after. Checkpoints saved during a validation epoch contain the EMA weights. - Added
MixStyleCallback: applies MixStyle feature-level domain augmentation via forward hooks on selected encoder stages.stagescontrols which encoder stage indices receive the hook;pandalphacontrol application probability and Beta distribution parameter respectively.
LR Warmup
- Added
warmup_epochssupport inhyperparameters: a linear LR warmup is prepended to any scheduler (exceptOneCycleLR, which has its own warmup viapct_start). The framework automatically subtractswarmup_epochsfromT_max(or equivalent period parameters) so the total scheduled duration remains correct.
Inference pipeline
predict_from_batch.pyupdated: wheninference_processoris present in the config, batch prediction is routed throughinstantiate_inference_processor, enabling sliding-window, striped, and TTA inference modes. The legacytrainer.predict()path is preserved for backward compatibility.InferenceProcessorConfigandPredictSingleImageConfigupdated with new fields:tta_mode,tile_weight,confidence_mode,striped_threshold_pixels,stripe_height,output_probs_dir.
Domain Adaptation — DANN with Gradient Reversal
- Added
GradientReversalFunctionandGradientReversalLayer(domain_adaptation/methods/gradient_reversal.py): atorch.autograd.Functionimplementing the identity forward pass with gradient negation in backward, wrapped in a parameter-freenn.Modulewith aset_lambda()method. - Added
DomainClassifier(domain_adaptation/methods/dann.py): resolution-agnostic MLP domain classifier usingAdaptiveAvgPool2d(1)so it works with any encoder spatial size. - Added
DANNMethod(domain_adaptation/methods/dann.py): full DANN implementation viaBaseDomainAdaptationMethod. Features:requires_features=True, configurablefeature_layer, dedicateddiscriminator_lrparameter group, and GRL lambda initialized to 0 to avoid adversarial pressure at epoch 0. - Added
step_modeparameter toDANNMethod("epoch"or"batch"): controls the granularity at which the lambda schedule is applied."batch"mode updates λ every training step via the newon_train_batch_starthook, producing smoother growth closer to the original Ganin et al. implementation;"epoch"(default) updates once per epoch. - Added
_current_lambdaattribute toDANNMethod: caches the most recently computed lambda soDomainAdaptationModel._get_lambda_da()always returns the correct value regardless of update granularity. - Added
on_train_batch_startlifecycle hook toBaseDomainAdaptationMethod(no-op default) and forwarded it inDomainAdaptationModel.on_train_batch_start. - Updated
DomainAdaptationModel._get_lambda_da()to prefermethod._current_lambdawhen present, falling back to the epoch-level schedule query. - Refactored
BaseLambdaScheduler.get_lambdasignature from(epoch, total_epochs)to(step, total_steps)— the same formula, now granularity-agnostic. All scheduler subclasses (ConstantScheduler,LinearScheduler,DANNScheduler) updated accordingly. - Added full working example config (
conf/examples/dann_domain_adaptation.yaml) for U-Net ResNet-34 with DANN. - Added test suite for GRL (
tests/test_gradient_reversal.py, 17 tests) and DANN (tests/test_dann_method.py, 49 tests including 12 newTestDANNMethodStepModetests). - Added dedicated DANN user guide (
website/docs/advanced/dann-method.md) covering mechanism,in_channelslookup table, full config reference,step_modeguidance, monitoring, and limitations. - Updated
website/docs/advanced/domain-adaptation.mdwith a "Built-in Methods" section linking to the DANN guide. - Updated
website/docs/advanced/domain-adaptation-implementing-methods.mdExample 2 to use the built-inGradientReversalLayerand add a callout pointing to the dedicated DANN guide.
Domain Adaptation — Initial structure
- Added initial domain adaptation module (
domain_adaptation/) with an extensible base class (BaseDomainAdaptationMethod), feature hook extraction (feature_hooks.py), adaptation schedulers (schedulers.py), and a monitoring callback (callbacks/monitor_callback.py). - Added
DomainAdaptationModel(inheritsModel) that orchestrates source/target dataloaders, adaptation loss weighting, and per-epoch scheduler stepping. - Added
DomainAdaptationConfigdataclass inconfig_definitions/domain_adaptation_config.py. - Added comprehensive test suite for domain adaptation (
test_base_method.py,test_domain_adaptation_config.py,test_domain_adaptation_model.py,test_feature_hooks.py,test_schedulers.py). - Added documentation: user guide (
advanced/domain-adaptation.md), config reference (advanced/domain-adaptation-config-reference.md), and implementing custom methods guide (advanced/domain-adaptation-implementing-methods.md).
Test Time Augmentation (TTA)
- Added
tools/tta/tta.pyimplementing TTA with all 8 symmetries of the D4 dihedral group (4 rotations × 2 flips). Each augmentation has an exact inverse so predictions are de-augmented and averaged with no spatial artifacts. - Added
apply_tta()helper for applying TTA to any segmentation model callable. - Exposed
use_ttaandtta_augmentationsfields on all inference processor classes andInferenceProcessorConfig/PredictSingleImageConfig.SingleImageFromFrameFieldProcessorautomatically skips thecrossfieldoutput during TTA de-augmentation. test_step()inModelnow applies TTA whencfg.use_tta=True.- Added TTA user guide (
website/docs/advanced/tta.md) and inference documentation section.
Transformer & Foundation Model Support
- Added
HuggingFaceSegmentationWrapper(custom_models/huggingface_models.py): loads anyAutoModelForSemanticSegmentationfrom the Hub or local path, bypasses the HF processor, and upsamples logits back to input resolution. - Added
TimmEncoderWithSMPDecoder(custom_models/timm_models.py): combines atimmfeatures_onlybackbone with SMP UNet/FPN/PAN decoders. - Added
TerraTorchSegmentationWrapper(custom_models/terratorch_models.py): bridges TerraTorch foundation model encoders (Prithvi, Clay, SatMAE) with a linear or FPN segmentation head; supports single- and multi-temporal inputs. - Added
ModelOutputAdapter(custom_models/transformer_adapters.py): normalises any model output (HF dataclass, dict, tuple, or plain tensor) to a(B, C, H, W)tensor with optional bilinear upsampling. - Added LoRA / PEFT fine-tuning support (
fine_tuning/lora_utils.py):apply_fine_tuning_strategy()supportsfull,freeze_backbone,linear_probe, andlorastrategies;LoraAdapterConfigandFineTuningConfigdataclasses added;merge_lora_weights()for deployment. predict.pynow auto-merges LoRA adapter weights before inference; akeep_lora_adaptersflag skips the merge for fine-tuning resumption.- Hardened training loop in
Model:_unpack_batch()replaces fragilebatch.values()unpacking with configurableimage_key/mask_key;set_encoder_trainable()no longer assumes a.encoderattribute;_prepare_preds_for_metrics()guards metric calls against malformed outputs. - Added 6 example YAML configs:
smp_mit_b2.yaml,smp_tu_convnext.yaml,segformer_hf.yaml,segformer_lora.yaml,vit_linear_probe.yaml,prithvi_terratorch.yaml. - Added
[transformers]pip extras group and a dedicated CI job for the transformer test suite.
RasterPatchDataset
- Added
RasterPatchDataset(dataset_loader/raster_patch_dataset.py): scans image/mask directory pairs recursively and exposes everypatch_size × patch_sizewindow (with configurable stride) as an independent dataset item. Global index to(image, row, col)mapping runs in O(log N) viabisectover cumulative patch counts; rasterio windowed reads ensure full images never enter RAM. - Supports augmentations,
selected_bands,image_dtype,mask_extension,n_classes(binary binarisation whenn_classes=2), andreset_augmentation_function. - Emits
UserWarningfor orphaned mask files (mask without a corresponding image) to surface dataset misconfiguration. - Added
RasterPatchDatasetConfigdataclass and example YAML (conf/examples/raster_patch_segmentation.yaml).
Dataset improvements
- Added
test_datasetsupport withtest_step(),test_dataloader(), andtest_metrics(prefixedtest/) inModelandFrameFieldSegmentationPLModel.trainer.test()is now called automatically aftertrainer.fit()whentest_datasetis present in the config. This completes the three-way dataset split:train_dataset→ training loop;val_dataset→ per-epoch monitoring during fit;test_dataset→ final held-out evaluation after fit. - Added
test_datasetfield toTrainConfigdataclass andtest_datasetblock to all example YAML configs. - Added
SegmentationDatasetFromFolder: a new dataset class that discovers image/mask pairs recursively from two root folders, without requiring a CSV file. Matching is done by relative subfolder path and file stem. Supports all parameters ofSegmentationDataset. RaisesValueErrorwhen no valid pairs are found. SegmentationDataset.__init__now accepts an optionaldfparameter (pre-builtpd.DataFrame) in addition toinput_csv_path, enabling programmatic dataset creation without a CSV file on disk. Fully backwards-compatible.- Added configurable
image_dtypefield toSegmentationDataset,RandomCropSegmentationDataset, and their configs, acceptinguint8(default),uint16,float32, ornative. Auto-normalization scales correctly per dtype (/255,/65535, or no division). Fully backwards-compatible.
Inference improvements
- Added
normalize_max_valueparameter to all inference processor classes (AbstractInferenceProcessorand all subclasses), exposing Albumentations'max_pixel_valuefor the normalization step. DefaultNonepreserves the previous behaviour (255.0). Usenormalize_max_value: 65535.0for uint16 imagery or1.0for pre-normalized float32.
Bug fixes
- Fixed bug in
Model.__init__:gpu_val_transformandgpu_train_transformwere accessed viacfg.val_dataset/cfg.train_datasetwithout checking if those keys exist, causingAttributeErrorwhen the corresponding dataset config was omitted. - Fixed
val_dataloader()to returnNonegracefully whenval_dsisNone(i.e.val_datasetabsent from config), allowing training-only runs without a validation loop. - Removed the orphan
set_test_dataset()method fromFrameFieldSegmentationPLModel(superseded by the newtest_dsattribute set inModel.__init__).
Files
dsgoficial/pytorch_segmentation_models_trainer-v1.1.0.zip
Files
(77.7 MB)
| Name | Size | Download all |
|---|---|---|
|
md5:40e1ccdf6e5615b295d23e2ed38ef301
|
77.7 MB | Preview Download |
Additional details
Related works
- Is supplement to
- Software: https://github.com/dsgoficial/pytorch_segmentation_models_trainer/tree/v1.1.0 (URL)