-
Notifications
You must be signed in to change notification settings - Fork 698
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 how-to-guides and examples dir #2475
base: release/v2.0.0
Are you sure you want to change the base?
📚Add how-to-guides and examples dir #2475
Conversation
Signed-off-by: Samet Akcay <[email protected]>
Signed-off-by: Samet Akcay <[email protected]>
Signed-off-by: Samet Akcay <[email protected]>
Signed-off-by: Samet Akcay <[email protected]>
Signed-off-by: Samet Akcay <[email protected]>
Signed-off-by: Samet Akcay <[email protected]>
Signed-off-by: Samet Akcay <[email protected]>
Signed-off-by: Samet Akcay <[email protected]>
Signed-off-by: Samet Akcay <[email protected]>
Signed-off-by: Samet Akcay <[email protected]>
Signed-off-by: Samet Akcay <[email protected]>
Signed-off-by: Samet Akcay <[email protected]>
Signed-off-by: Samet Akcay <[email protected]>
Signed-off-by: Samet Akcay <[email protected]>
Signed-off-by: Samet Akcay <[email protected]>
Signed-off-by: Samet Akcay <[email protected]>
Signed-off-by: Samet Akcay <[email protected]>
Signed-off-by: Samet Akcay <[email protected]>
Signed-off-by: Samet Akcay <[email protected]>
Signed-off-by: Samet Akcay <[email protected]>
Signed-off-by: Samet Akcay <[email protected]>
Signed-off-by: Samet Akcay <[email protected]>
Signed-off-by: Samet Akcay <[email protected]>
Signed-off-by: Samet Akcay <[email protected]>
Signed-off-by: Samet Akcay <[email protected]>
Signed-off-by: Samet Akcay <[email protected]>
Signed-off-by: Samet Akcay <[email protected]>
Signed-off-by: Samet Akcay <[email protected]>
Signed-off-by: Samet Akcay <[email protected]>
Signed-off-by: Samet Akcay <[email protected]>
Signed-off-by: Samet Akcay <[email protected]>
Signed-off-by: Samet Akcay <[email protected]>
Signed-off-by: Samet Akcay <[email protected]>
Signed-off-by: Samet Akcay <[email protected]>
Signed-off-by: Samet Akcay <[email protected]>
Signed-off-by: Samet Akcay <[email protected]>
Signed-off-by: Samet Akcay <[email protected]>
Signed-off-by: Samet Akcay <[email protected]>
Signed-off-by: Samet Akcay <[email protected]>
Signed-off-by: Samet Akcay <[email protected]>
Signed-off-by: Samet Akcay <[email protected]>
Signed-off-by: Samet Akcay <[email protected]>
Signed-off-by: Samet Akcay <[email protected]>
Signed-off-by: Samet Akcay <[email protected]>
Signed-off-by: Samet Akcay <[email protected]>
Signed-off-by: Samet Akcay <[email protected]>
# Create a single image item | ||
item = ImageItem( | ||
image=torch.rand(3, 224, 224), # RGB image | ||
gt_label=torch.tensor(0), # Normal (0) or anomalous (1) |
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.
gt_label=torch.tensor(0), # Normal (0) or anomalous (1) | |
gt_label=0 # Normal (0 or False) or anomalous (1 or True) |
|
||
# Access the data | ||
print(item.image.shape) # torch.Size([3, 224, 224]) | ||
print(item.gt_label.item()) # 0 |
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.
print(item.gt_label.item()) # 0 | |
print(item.gt_label) # tensor(False) |
) | ||
for i in range(32) | ||
] | ||
batch = ImageBatch.from_items(items) |
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 method does not exist
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.
There seem to be several other examples in this guide that don't work. Would probably be good to check if these examples are up to date.
train_batch_size: int = 32, | ||
eval_batch_size: int = 32, | ||
num_workers: int = 8, | ||
transform = 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.
transforms
should be removed here and below
|
||
- Download/prepare the data | ||
- Set up train/val/test datasets | ||
- Apply transforms |
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.
- Apply transforms | |
- Apply data augmentations |
|
||
The dataset consists of three main components: | ||
|
||
1. **Samples DataFrame**: The heart of each dataset is a DataFrame containing: |
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.
Not sure if we should mention the dataframe here, given that it may be replaced soon.
dataset = AvenueDataset( | ||
root="./datasets/avenue", | ||
split="test", | ||
transform=transform |
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.
transform=transform |
train_transform=Compose([ | ||
Resize((256, 256)), | ||
RandomHorizontalFlip(), | ||
ToTensor() | ||
]), | ||
val_transform=Compose([ | ||
Resize((256, 256)), | ||
ToTensor() | ||
]), | ||
test_transform=Compose([ | ||
Resize((256, 256)), | ||
ToTensor() | ||
]) |
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 is outdated now that we moved the stage-specific augmentations to the datamodule
model = Patchcore() | ||
|
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.
model = Patchcore() | |
model = Patchcore() | |
print(model.pre_processor.transform) | |
# Compose( | |
# Resize(size=[256, 256], interpolation=InterpolationMode.BILINEAR, antialias=True) | |
# CenterCrop(size=(224, 224)) | |
# Normalize(mean=[0.485, 0.456, 0.406], std=[0.229, 0.224, 0.225], inplace=False) | |
# ) |
model = Patchcore( | ||
pre_processor=PreProcessor( | ||
transform=Compose([ | ||
Resize((256, 256)), | ||
ToTensor() | ||
]) | ||
) | ||
) | ||
|
||
print(model.pre_processor.train_transform) | ||
# Compose( | ||
# Resize(size=[256, 256], interpolation=InterpolationMode.BILINEAR, antialias=False) | ||
# ToTensor() | ||
# ) |
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.
train_transform
-->transform
to reflect most recent design.- removed
ToTensor
to avoid confusing users.
model = Patchcore( | |
pre_processor=PreProcessor( | |
transform=Compose([ | |
Resize((256, 256)), | |
ToTensor() | |
]) | |
) | |
) | |
print(model.pre_processor.train_transform) | |
# Compose( | |
# Resize(size=[256, 256], interpolation=InterpolationMode.BILINEAR, antialias=False) | |
# ToTensor() | |
# ) | |
model = Patchcore( | |
pre_processor=PreProcessor( | |
transform=Resize((256, 256)), | |
) | |
) | |
print(model.pre_processor.transform) | |
# Resize(size=[256, 256], interpolation=InterpolationMode.BILINEAR, antialias=False) |
Signed-off-by: Samet Akcay <[email protected]>
Signed-off-by: Samet Akcay <[email protected]>
Signed-off-by: Samet Akcay <[email protected]>
Signed-off-by: Samet Akcay <[email protected]>
Update metrics and evaluator guide
📝 Description
✨ Changes
Select what type of change your PR is:
✅ Checklist
Before you submit your pull request, please make sure you have completed the following steps:
For more information about code review checklists, see the Code Review Checklist.