Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Reduce code duplication in trainers #205

Closed
6 tasks done
adamjstewart opened this issue Oct 24, 2021 · 1 comment · Fixed by #286
Closed
6 tasks done

Reduce code duplication in trainers #205

adamjstewart opened this issue Oct 24, 2021 · 1 comment · Fixed by #286
Assignees
Labels
trainers PyTorch Lightning trainers
Milestone

Comments

@adamjstewart
Copy link
Collaborator

adamjstewart commented Oct 24, 2021

Right now, 90% of our trainer code appears to be duplicated. I think we can reuse the same ClassificationTask, SemanticSegmentationTask, and RegressionTask for all datasets. This will make it much easier to add new models for all datasets and make it easier to maintain (don't have to remember to copy bug fixes to multiple places). This will also greatly reduce the testing code.

Progress so far:

  • ClassificationTask
    • MultiLabelClassificationTask
  • RegressionTask
  • SemanticSegmentationTask (mostly done, still need to move plotting to datasets)
  • Move DataModules from torchgeo.trainers to torchgeo.datasets
  • Split torchgeo.trainers.tasks into separate files
@adamjstewart
Copy link
Collaborator Author

Another idea for refactoring:

  • Move all DataModules to torchgeo.datasets
  • Split torchgeo.trainers.tasks into a separate file for each task type

I think it makes more sense to put DataModules with Datasets since there is a one-to-one mapping between Datasets and DataModules. Then we can split tasks into classification.py, regression.py, etc.

Potential downsides: PyTorch-lightning will be required for TorchGeo instead of being optional for trainer users.

@adamjstewart adamjstewart added this to the 0.2.0 milestone Nov 20, 2021
@adamjstewart adamjstewart self-assigned this Dec 14, 2021
@adamjstewart adamjstewart added utilities Utilities for working with geospatial data and removed utilities Utilities for working with geospatial data labels Jan 2, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
trainers PyTorch Lightning trainers
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants