question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

eurosat multiband classification problem

See original GitHub issue

i have a problem running torchgeo on eurosat MS tif images i wrote a simple code :

eurosat = EuroSAT(euro_root, split="train", download=False)
# sampler = RandomGeoSampler(eurosat, size=64, length=10000)
# dataloader = DataLoader(eurosat, batch_size=128, sampler=sampler, collate_fn=stack_samples)
dataloader = DataLoader(eurosat, batch_size=128, collate_fn=stack_samples)
num_classes = 10
channels = 13
num_workers = 4
batch_size = 4
backbone = "resnet50"
weights = "imagenet"
lr = 0.01
lr_schedule_patience = 5
epochs = 50
datamodule = EuroSATDataModule(
     root_dir=euro_root,
     batch_size=batch_size,
     num_workers=num_workers,
)
task = ClassificationTask(
    classification_model=backbone,
    weights=weights,
    num_classes=num_classes,
    in_channels=channels,
    loss="ce",
    learning_rate=lr,
    learning_rate_schedule_patience=lr_schedule_patience
)
checkpoint_callback = pl.callbacks.ModelCheckpoint(
    monitor="val_loss",
    save_top_k=1,
    save_last=True,
)
early_stopping_callback = pl.callbacks.EarlyStopping(
    monitor="val_loss",
    min_delta=0.00,
    patience=10,
)

# Train
trainer = pl.Trainer(
    callbacks=[checkpoint_callback, early_stopping_callback],
    max_epochs=epochs
)
trainer.fit(model=task, datamodule=datamodule)

but i get this error on fit line :

.........
_pickle.PicklingError: Can't pickle <class 'nn.BatchNorm2d.BatchNorm2d'>: import of module 'nn.BatchNorm2d' failed
..........
OSError: [Errno 22] Invalid argument: 'C:\\Users\\mohsc\\PycharmProjects\\pythonProject\\<input>'

am i missing a preparing step or something ? help would be appreciated, by the way tutorials are still lacking essential sample codes and documentations like this issue on MS images. thanks

Issue Analytics

  • State:open
  • Created a year ago
  • Comments:19 (5 by maintainers)

github_iconTop GitHub Comments

2reactions
mohscorpioncommented, Nov 3, 2022

This is likely a multiprocessing issue. The reason @calebrob6 can’t reproduce this is because multiprocessing uses a different start method on macOS/Windows vs. Linux: https://docs.python.org/3/library/multiprocessing.html#contexts-and-start-methods

If I’m correct, I should be able to reproduce this on macOS. Let me give it a shot.

i will try on linux and report back

2reactions
adamjstewartcommented, Nov 3, 2022

This is likely a multiprocessing issue. The reason @calebrob6 can’t reproduce this is because multiprocessing uses a different start method on macOS/Windows vs. Linux: https://docs.python.org/3/library/multiprocessing.html#contexts-and-start-methods

If I’m correct, I should be able to reproduce this on macOS. Let me give it a shot.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Deep Transfer Learning for Land Use and Land Cover ... - MDPI
In this study, the challenge of LULC classification was addressed using deep transfer learning techniques. For this task, two prominent transfer learning ...
Read more >
Issues · microsoft/torchgeo - GitHub
Issues list ; Using VHR10 dataset with AugmentationSequential datasets Geospatial or benchmark datasets. #894 opened ; eurosat multiband classification problem ...
Read more >
Land Cover Classification with EuroSAT Dataset - Kaggle
In this notebook we will tackle the problem of land-use and land-cover classification where we try to identify the class of given remote...
Read more >
Efficient Convolutional Neural Networks for Multi-Spectral ...
In this case the image was correctly classified both when using RGB bands and 10 spectral bands.
Read more >
Classification Performance of Land Use from Multispectral ...
Forest and Support Vector Machine Using EuroSAT Data ... classification problem can be separated into classes that.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found