Skip to content

Conversation

@perctrix
Copy link
Collaborator

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:

  • Added a foreground_samples attribute to the InspectionAnnotation class to store sampled foreground pixel locations for each annotation, enabling foreground-guided ROI selection.
  • Implemented new methods random_roi and foreground_guided_random_roi in InspectionAnnotations to support random and foreground-aware ROI cropping, and updated crop_roi to optionally use these strategies based on new parameters.

Inspection and dataset construction enhancements:

  • Updated the inspect function to sample and store foreground pixel indices for each annotation, with configurable minimum/maximum samples and percent coverage, improving downstream patch selection.
  • Modified the ROIDataset class to accept parameters for random patch sampling and foreground oversampling, and updated the load method to use these options for more flexible ROI extraction. [1] [2]

fixed #82

@ATATC ATATC changed the title Feature/random patch sampling Add random and foreground oversampling in ROIDataset Oct 23, 2025
@ATATC ATATC self-requested a review October 23, 2025 17:38
@ATATC ATATC added enhancement New feature or request todo New task or assignment labels Oct 23, 2025
@ATATC ATATC added this to the 1.1.0 milestone Oct 23, 2025
@ATATC
Copy link
Contributor

ATATC commented Nov 5, 2025

Maybe make it modular, don't integrate into the existing code.

@perctrix
Copy link
Collaborator Author

perctrix commented Nov 5, 2025

You mean leave this part in the mipcandy-bundles?

@ATATC
Copy link
Contributor

ATATC commented Nov 11, 2025

#82 (comment) Make it a child class inheriting from ROIDataset.

perctrix and others added 5 commits November 11, 2025 11:42
- Merged latest changes from main (19 commits)
- Fixed save() to use to_dict() for proper JSON serialization
- Added Tensor to list conversion in serialization/deserialization
- Preserved random patch sampling features
- Merged latest changes from main
- Fixed Tensor serialization in save/load methods
- Created RandomROIDataset as child class of ROIDataset
- Moved all random sampling logic into the subclass
- Kept ROIDataset and InspectionAnnotations minimal and clean
@ATATC
Copy link
Contributor

ATATC commented Dec 1, 2025

Can we replace foreground_shapes with intrinsic types?

@perctrix
Copy link
Collaborator Author

perctrix commented Dec 2, 2025

@ATATC What about now

@perctrix perctrix requested a review from ATATC December 7, 2025 01:51
Copy link
Contributor

@ATATC ATATC left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Status Update

Thank you for your contribution to Project Neura and its related projects. We sincerely appreciate your interest in our work and your passion to enhance the community. Your feedback is deeply valuable to us.

This update means one or more of our team members have carefully reviewed the issue you addressed and the corresponding pull request you proposed. The status of your pull request is now changed to:

  • The suggestion/problem you raised has been investigated and determined to be non-existent or negligible
  • The suggestion/problem you raised has been noticed and verified
  • The corresponding solution/fix you proposed has been carefully evaluated, yet we have to reject it regretfully
  • The corresponding solution/fix you proposed has been carefully evaluated, yet pending changes before acceptance
  • The corresponding solution/fix you proposed has been carefully evaluated and will be merged shortly

Reasons behind This Decision

Just one place needs to change.

What to Expect Next

Will merge after the line separator is removed.

@perctrix perctrix requested a review from ATATC December 7, 2025 03:30
Copy link
Contributor

@ATATC ATATC left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Status Update

Thank you for your contribution to Project Neura and its related projects. We sincerely appreciate your interest in our work and your passion to enhance the community. Your feedback is deeply valuable to us.

This update means one or more of our team members have carefully reviewed the issue you addressed and the corresponding pull request you proposed. The status of your pull request is now changed to:

  • The suggestion/problem you raised has been investigated and determined to be non-existent or negligible
  • The suggestion/problem you raised has been noticed and verified
  • The corresponding solution/fix you proposed has been carefully evaluated, yet we have to reject it regretfully
  • The corresponding solution/fix you proposed has been carefully evaluated, yet pending changes before acceptance
  • The corresponding solution/fix you proposed has been carefully evaluated and will be merged shortly

Reasons behind This Decision

What to Expect Next

@ATATC ATATC merged commit ae25f30 into ProjectNeura:main Dec 7, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request todo New task or assignment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add random and foreground oversampling in ROIDataset

2 participants