Replies: 1 comment 1 reply
-
Hi, @FogDrip What happens when you add a flag like: |
Beta Was this translation helpful? Give feedback.
1 reply
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Hi everyone, I'm having one heck of a time trying to get predict to work as a proof of concept to show my supervisor. I have experience with predictions using TorchGeo, but the workflow is quite different when using TerraTorch's CLI so I must just be doing something wrong. If anyone has an working examples that I could mull over I would greatly appreciate that!
After both a successful fit and test I'm trying now to use predict on test images to see how well it segments. I started with the default burn_scars.yaml in Terratorch's test/conf directory
I've gotten this to run in a Notebook for about 90 seconds but I can't seem to get past the following error:
!terratorch predict
-c tests/resources/configs/firescars.yaml
--ckpt_path tests/fire_scar_segmentation/version_1/checkpoints/epoch=1.ckpt
--predict_output_dir "../hls_burn_scars/hls_burn_scars/predict_test/"
--return_predictions true
File "..\Lib\site-packages\terratorch\cli_tools.py", line 167, in write_on_batch_end
for prediction, file_name in zip(torch.unbind(pred_batch, dim=0), filename_batch, strict=False):
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
TypeError: 'NoneType' object is not iterable
I've tried several variations of explicitly adding callbacks as well as finding the right built in one as it seems that either the name or images are not being passes to the write_on_batch_end function:
#firescars.yaml where I added trainer variations of this
trainer:
callbacks:
- class_path: terratorch.cli_tools.CustomWriterf
init_args:
write_interval: batch
As well as removing all references to writer callbacks in the hopes a default function would handle this.
The only documentation I can find on how to use predict on the getting started page:
terratorch predict -c <path_to_config_file> --ckpt_path<path_to_checkpoint> --predict_output_dir <path_to_output_dir> --data.init_args.predict_data_root <path_to_input_dir> --data.init_args.predict_dataset_bands <all bands in the predicted dataset, e.g. [BLUE,GREEN,RED,NIR_NARROW,SWIR_1,SWIR_2,0]>
I'm using the standard test case from https://github.com/isaaccorley/prithvi-pytorch for the HLS Burn Scar Dataset as well as their yaml file for the fit and test
wget https://huggingface.co/datasets/ibm-nasa-geospatial/hls_burn_scars/resolve/main/hls_burn_scars.tar.gz?download=true -O hls_burn_scars.tar.gz
tar -xvf hls_burn_scars.tar.gz
Thank you!
Beta Was this translation helpful? Give feedback.
All reactions