Skip to content

add PathForge-native feature extractors and processor support - #26

Open
JurreWeijer wants to merge 6 commits into
mainfrom
feature/custom-feature-extractors
Open

add PathForge-native feature extractors and processor support#26
JurreWeijer wants to merge 6 commits into
mainfrom
feature/custom-feature-extractors

Conversation

@JurreWeijer

Copy link
Copy Markdown
Collaborator

Summary

This PR adds PathForge-native feature extractors and defines how slide processors can support them now and in the future.

PathForge-native extractors

  • Added FeatureExtractorBase, the shared interface for PathForge feature extractors:
    • load and own a model;
    • prepare image patches for that model;
    • turn batches of patches into feature vectors;
    • support evaluation mode and moving to a device.
  • Added helpers to register, find, and build PathForge-native extractors.
  • Added Mascaret and Phaet as PathForge-native extractors, including their preprocessing, output checks, and guidance for accessing their gated Hugging Face weights.

Processor integration and LazySlide support

  • Extended SlideProcessorBase so processors can:
    • list the feature extractors they can run themselves;
    • state whether they can also run PathForge-native extractors.
  • Added FeatureExtractionRequest to keep extractor selection separate from runtime settings such as batch size, workers, AMP, and device.
  • Added the first adapter in LazySlide:
    • LazySlide and timm models are still passed directly to LazySlide as processor-native models;
    • PathForge-native extractors are built when feature extraction starts and wrapped so LazySlide can run them;
    • image patches are converted to the shared RGB uint8 format before PathForge preprocessing is applied.
  • If the same name exists both as a LazySlide/timm model and as a PathForge-native extractor, the processor-native model is used. This is logged clearly.

Registry and processor layout cleanup

  • FEATURE_EXTRACTORS now contains only PathForge-native extractor classes that PathForge can build itself.
  • LazySlide and timm model names are no longer added to this registry. They are provided by the processor and can only be run by that processor.
  • Available extractors and configuration validation are now determined from the selected slide-processing processor, without loading models during validation.
  • Reorganized slide processing so each processor has its own folder, for example slide_processing/lazyslide/.
  • Added shared processor code above these folders, including the new build_slide_processor() builder.
  • Updated slide-retrieval code to use the shared builder instead of repeating processor-loading logic.

Verification

  • Added tests for registry behaviour, available extractor selection, name collisions, LazySlide support, patch conversion, and Mascaret/Phaet.
  • Added a LazySlide smoke test that runs a registered PathForge-native extractor and checks the output features, timing, and memory use.
  • Updated documentation for feature-extractor availability and Hugging Face authentication through hf auth login or HF_TOKEN.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant