-
Notifications
You must be signed in to change notification settings - Fork 616
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
Jpcbertoldo/mvtec ad loco #538
Jpcbertoldo/mvtec ad loco #538
Conversation
yet something i dont understand in
how this works? does the transform re-apply the last call when mask is not None? |
Check out this pull request on See visual diffs & provide feedback on Jupyter Notebooks. Powered by ReviewNB |
@samet-akcay is this some sort of integratin in the project? |
We use |
…envinotoolkit#549) patchcore: Solved nans issues for large discrepancies in anomaly map
fix help description for argument task
you have to reutrn the results of load_state_dict if you wrappered the original one
…#529) Pass pre-trained from config to LightningModule
…omalib into jpcbertoldo/mvtec-ad-loco
category: str, | ||
task: str = TASK_SEGMENTATION, | ||
imread_strategy: str = IMREAD_STRATEGY_PRELOAD, | ||
image_size: Optional[Union[int, Tuple[int, int]]] = 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.
The images in this dataset are not squared.
The ratio of widh/height can end up too different than the original image when the image size is given as an int.
Maybe we should add a warning here?
"mask_paths": str(self.samples.iloc[index]["mask_paths"]), | ||
# TODO CHECK IF THE DOUBLE CALL TO PREPROCESS WILL WORK WITH ALBUMENTATIONS | ||
"masks": self.pre_process(image=image, mask=mask_dict["masks"])["mask"], | ||
"mask": self.pre_process(image=image, mask=mask_dict["mask"])["mask"], |
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.
self.pre_process
is being called for the 3rd time here, will that create any problems?
I'm thinking that maybe the random transforms will apply the same transform every two times (for the image and for the mask).
i messed some git commands, i'm closing this one and openning another one |
Disclaimer
I am creating this just to keep track of the branch, please ignore the PR for the moment.
Description
Create a new dataset: MVTec LOCO Anomaly Detection.
"LOCO" stands for "LOgical COnstraints"
I based myself on
anomalib/data/mvtec.py
.imread_strategy
The dataset supports an option
imread_strategy
which allows the user how to choose when the images are loaded:onthefly
: behaviour I found inmvtec.py
, the images are loaded upon demand during the training;preload
: all the images are cached in the memory (RAM, not GPU) when the dataset is being initialized.anotype
andsuper_anotype
Besides providing the binary
label
, I also create the dataset with two other categorical values:super_anotype
: is it a logical or structural anomaly? (or a normal?)anotype
: "what is the problem with the image?", mvtec ad also has different types of anomalies for each category but this is particularly more interesting here because there are many types of logical violations possible.I specifically included this because I am interested in evaluating separately by those types but I will later create an issue for that feature.
mask
vs.masks
MVTec LOCO's logical anomalies may include several anoamlies in a single image and to properly evaluate them one needs to consider them separately so they are segmented in different mask files in the ground truth.
Since the rest of library expects a tensor
mask
(SINGULAR), I merge them all into a single binary maks (with loss information because they cannot be separated anymore).In order to later peform proper evaluation there is a second tensor
masks
(PLURAL) which encodes each anomalous region with a different value (0 is a normal pixel, and 1, 2, ..., N are anomalous pixels).things in
MVTecAD
but not inMVTecLOCO
1)
self.transform_config_val = self.transform_config_train
Is there a good reason for assuming this?
For me it could make sense that
self.transform_config_val
could have light data augmentations (say, tiny brightness changes) but that should not be repeated in the validation set.2)
split_normal_images_in_train_set(samples, split_ratio, seed)
MVTec LOCO already defines fixed validation sets so i did not include the option of doing it dinamically like in MVTec AD.
Checklists
Changes
Checklist