Preparing a custom geo dataset for training #1469
-
Hi there! I'm working on a Kaggle notebook with a custom dataset based on NAIP images and Chesapeake labels. I want to perform a segmentation task. As I'm using an intersection dataset (images from NAIP and labels from Chesapeake):
I've created a custom geo datamodule subclassing GeoDatamodule to address the error:
This is my CustomGeoDatamodule:
And this is my datamodule:
But when I try to train with this:
I get this error:
What am I missing here? Thanks in advance! |
Beta Was this translation helpful? Give feedback.
Replies: 5 comments 7 replies
This comment has been hidden.
This comment has been hidden.
-
You also need to override |
Beta Was this translation helpful? Give feedback.
-
Actually there were 2 problems in my code. The first one was using:
instead of:
I don't know why I can't only set validate as a stage in the setup override. The second error was trying to use the code the way it is to perform a fit with 2 GPUs. It works when changing to uso one GPU. So, summarizing. To work with a custom geodataset we need to: 1 - Subclass RasterDataset to something like this:
2 - Instantiate the datasets:
3 - If needed, subclass GeoDatamodule to create a custom geo datamodule:
4 - Instantiate the custom datamodule:
5 - Pass the datamodule to your trainer. Thanks! |
Beta Was this translation helpful? Give feedback.
-
Did you get it running on 2 GPU? I get the same error TypeError: first argument must be callable or None |
Beta Was this translation helpful? Give feedback.
-
torchgeo_GPU_parallel_issue_new.zip Here is data and a notebook with a minimal example. There I use the "ddp_notebook" strategy and get the same error as with "ddp" strategy. edit: new file with the right notebook |
Beta Was this translation helpful? Give feedback.
Actually there were 2 problems in my code.
The first one was using:
instead of:
I don't know why I can't only set validate as a stage in the setup override.
The second error was trying to use the code the way it is to perform a fit with 2 GPUs. It works when changing to uso one GPU.
So, summarizing. To work with a custom geodataset we need to:
1 - Subclass RasterDataset to something like this:
2 - In…