-
Notifications
You must be signed in to change notification settings - Fork 385
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
Trainers: add Instance Segmentation Task #2513
base: main
Are you sure you want to change the base?
Conversation
@ariannasole23 please read the following Contributor License Agreement(CLA). If you agree with the CLA, please reply with the following information.
Contributor License AgreementContribution License AgreementThis Contribution License Agreement (“Agreement”) is agreed to by the party signing below (“You”),
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good, just need to make the code and tests match our existing trainers and run ruff: https://torchgeo.readthedocs.io/en/latest/user/contributing.html#linters
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Every file needs copyright info at the top, see https://torchgeo.readthedocs.io/en/latest/user/contributing.html#licensing
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This file should look almost identical to the other tests/trainers/*.py
files, you can copy-n-paste the template from there
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Let's rename this instance_segmentation.py
, same for the test file
from torch import Tensor | ||
from torchmetrics.detection.mean_ap import MeanAveragePrecision | ||
from torchvision.models.detection import maskrcnn_resnet50_fpn | ||
from ultralytics import YOLO |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We would need to add a dependency on this which we don't currently have. I'm hesitant to do that given that they just had their PyPI account hacked and pushed out bitcoin miners for several releases. But they are quite well known, so it may be difficult not to support them. Let me ask around and see if others have opinions.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hopefully they will be more careful now. It was targetted due to high number of users. I've used ultralytics extensively but (1) check the license and (2) only RGB (could be extended)
- Model configuration | ||
- Loss computation | ||
- Metric computation (e.g., Mean Average Precision) | ||
- Training, validation, testing, and prediction steps |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you add:
.. versionadded:: 0.7
model: str = 'mask_rcnn', # Model type, e.g., 'mask_rcnn' or 'yolo' | ||
backbone: str = 'resnet50', # Backbone type for Mask R-CNN (ignored for YOLO) | ||
weights: str | bool | None = None, # Pretrained weights or custom checkpoint path | ||
num_classes: int = 2, # Number of classes, including background | ||
lr: float = 1e-3, # Learning rate for the optimizer | ||
patience: int = 10, # Patience for the learning rate scheduler | ||
freeze_backbone: bool = False, # Whether to freeze backbone layers (useful for transfer learning) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
These descriptions should go inside of the docstring, see the other trainers for examples
self.configure_metrics() # Call method to set up metrics | ||
|
||
def configure_models(self) -> None: | ||
""" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You should copy the docstrings from our other trainers so the documentation is uniform
No description provided.