Closed qin-yu closed 5 months ago
In plantseg/predictions/functional/predictions.py
's unet_predictions()
:
patch_halo = get_patch_halo(model_name)
predictor = ArrayPredictor(model=model, in_channels=model_config['in_channels'],
out_channels=model_config['out_channels'], device=device, patch=patch,
patch_halo=patch_halo, single_batch_mode=single_batch_mode, headless=False,
verbose_logging=False, disable_tqdm=disable_tqdm)
In plantseg/predictions/predict.py
's UnetPredictions
:
patch_halo = get_patch_halo(model_name)
is_embedding = not model_config.get('is_segmentation', True)
self.predictor = ArrayPredictor(model=model, in_channels=model_config['in_channels'],
out_channels=model_config['out_channels'], device=device, patch=self.patch,
patch_halo=patch_halo, single_batch_mode=False, headless=True,
is_embedding=is_embedding)
But:
def get_patch_halo(model_name):
predict_template = get_predict_template()
patch_halo = predict_template['predictor']['patch_halo']
config_train = get_train_config(model_name)
if config_train["model"]["name"] == "UNet2D":
patch_halo[0] = 0
return patch_halo
So I guess the user config is not used. Should be an easy fix.
Hey @wolny I guess a halo of [2, 4, 4] is fine for all purposes? Is it why we currently have fixed halo for PlantSeg? Or do we actually want to let users to set it?
Somehow according to this paper, halo matters: Exact Tile-Based Segmentation Inference for Images Larger than GPU Memory. But empirically changing halo wouldn't help.
hey @qin-yu, yes at some point I've decided to simplify the process and use a fixed 'patch_halo' during inference instead of letting the user to specify it. If there are still references to 'patch_halo' in the config, I'd just remove them since it's not used
With the latest implementation of the halo, its shape has become a significant factor and can no longer be simplified. Previously, the irrelevance of the halo's size was a key indicator of underlying issues.
I've implemented some changes in https://github.com/wolny/pytorch-3dunet/pull/113 for pytorch-3dunet. After receiving a review from @wolny, I plan to submit a pull request for further updates in plantseg.
I am fixing this right now.
My version:
v1.6.6
My workflow: CLI
My config:
Workflow output: