Add random and foreground oversampling in ROIDataset
#83
+91
−11
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This pull request introduces enhancements to the region-of-interest (ROI) sampling logic for inspection datasets, focusing on foreground-aware patch selection and more flexible sampling strategies. The changes add foreground sample tracking to annotations, allow random and foreground-guided ROI cropping, and provide configurable oversampling of foreground regions in the
ROIDataset.ROI sampling and annotation improvements:
foreground_samplesattribute to theInspectionAnnotationclass to store sampled foreground pixel locations for each annotation, enabling foreground-guided ROI selection.random_roiandforeground_guided_random_roiinInspectionAnnotationsto support random and foreground-aware ROI cropping, and updatedcrop_roito optionally use these strategies based on new parameters.Inspection and dataset construction enhancements:
inspectfunction to sample and store foreground pixel indices for each annotation, with configurable minimum/maximum samples and percent coverage, improving downstream patch selection.ROIDatasetclass to accept parameters for random patch sampling and foreground oversampling, and updated theloadmethod to use these options for more flexible ROI extraction. [1] [2]fixed #82