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

Add VHR10DataModule #798

Closed
wants to merge 19 commits into from
Closed

Add VHR10DataModule #798

wants to merge 19 commits into from

Conversation

ashnair1
Copy link
Collaborator

@ashnair1 ashnair1 commented Sep 28, 2022

  • Added plot function for VHR10
  • Added test

Since this is a CocoDataset it might be better to subclass from torchvision's CocoDataset instead of NonGeoDataset. Thoughts?

Plot sample (split="positive"):

VHR10_small

Had to bump minimum version of pyococotools to 2.0.1 to support draw_bbox arg.

@github-actions github-actions bot added datasets Geospatial or benchmark datasets testing Continuous integration testing labels Sep 28, 2022
@adamjstewart
Copy link
Collaborator

This looks great. A few suggestions to make it even better:

  1. Can we also plot the bounding box of each object? VHR10 was originally an OD dataset but someone later added IS masks as well.
  2. Plotting masks and boxes for each object should be optional, we'll likely have OD and IS trainers long before we have an OD+IS trainer
  3. Can we also plot the label of each object? Want to make sure we aren't detecting the wrong object
  4. Can we plot each instance of the same class in the same color? This helps visualize the former point better
  5. Can we also plot the confidence interval of each object?
  6. Can the alpha value of the mask be passed as input to the plot method?

A sample plot from VHR10 with what I'm looking for (prediction, not ground truth):

torchgeo-nwpu

Probably better to have the label/confidence above the box instead of inside, but close enough.

This was created using the following notebook, mostly using code from torchvision:
geog527train.zip

Fun fact: VHR10 was actually the first dataset I added to TorchGeo.

@adamjstewart adamjstewart added this to the 0.4.0 milestone Sep 28, 2022
@ashnair1
Copy link
Collaborator Author

  1. Can we also plot the bounding box of each object? VHR10 was originally an OD dataset but someone later added IS masks as well.
  2. Plotting masks and boxes for each object should be optional, we'll likely have OD and IS trainers long before we have an OD+IS trainer
  3. Can we also plot the label of each object? Want to make sure we aren't detecting the wrong object
  4. Can we plot each instance of the same class in the same color? This helps visualize the former point better
  5. Can we also plot the confidence interval of each object?
  6. Can the alpha value of the mask be passed as input to the plot method?

Regarding point 1, by passing draw_boxes=True in the plot function, boxes will be drawn along with the mask.

@ashnair1
Copy link
Collaborator Author

ashnair1 commented Sep 30, 2022

That being said, I get where you're coming from. Plots from pycocotools are not as visually impressive, customizable or as informative as the second plot.

I've written out a new plot function that does this. Still ironing out some details but here is a sample. (Recommend opening the image in another window for better clarity).

final_img

Left (Masks and Boxes)
Center (Only Masks with mask alpha = 0.2)
Right (Only boxes)

@adamjstewart adamjstewart mentioned this pull request Sep 30, 2022
19 tasks
@ashnair1
Copy link
Collaborator Author

ashnair1 commented Oct 6, 2022

Training a object detector on VHR10 now and plots look encouraging. Might need bump up the figure size.

image

@calebrob6
Copy link
Member

calebrob6 commented Oct 6, 2022

@ashnair1 maybe try throwing in a plt.tightlayout() plt.tight_layout() before returning plt.gcf()

@github-actions github-actions bot added datamodules PyTorch Lightning datamodules scripts Training and evaluation scripts labels Oct 12, 2022
@ashnair1 ashnair1 marked this pull request as draft October 12, 2022 20:17
@ashnair1
Copy link
Collaborator Author

This PR will be split into smaller PRs once I make sure everything works as expected.

@adamjstewart
Copy link
Collaborator

Note that the datamodule will need to be refactored once #992 is merged. But that should hopefully make it significantly simpler.

@adamjstewart adamjstewart changed the title Add plot fn for VHR10 Add VHR10DataModule Jan 23, 2023
@adamjstewart adamjstewart removed this from the 0.4.0 milestone Jan 24, 2023
@adamjstewart
Copy link
Collaborator

Closed by #847 and #1082

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
datamodules PyTorch Lightning datamodules datasets Geospatial or benchmark datasets scripts Training and evaluation scripts testing Continuous integration testing
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants