mirror of
https://github.com/SikongJueluo/Mini-Nav.git
synced 2026-07-12 20:15:31 +08:00
feat(test): add collect test images notebook and replace BitImageProcessorFast
This commit is contained in:
@@ -11,7 +11,7 @@ from torch import nn
|
||||
from transformers import (
|
||||
AutoImageProcessor,
|
||||
AutoModel,
|
||||
BitImageProcessorFast,
|
||||
BitImageProcessor,
|
||||
Dinov2Model,
|
||||
)
|
||||
from utils.feature_extractor import extract_batch_features
|
||||
@@ -38,7 +38,7 @@ class FeatureRetrieval:
|
||||
_instance: Optional["FeatureRetrieval"] = None
|
||||
|
||||
_initialized: bool = False
|
||||
processor: BitImageProcessorFast
|
||||
processor: BitImageProcessor
|
||||
model: nn.Module
|
||||
|
||||
def __new__(cls, *args, **kwargs) -> "FeatureRetrieval":
|
||||
@@ -48,7 +48,7 @@ class FeatureRetrieval:
|
||||
|
||||
def __init__(
|
||||
self,
|
||||
processor: Optional[BitImageProcessorFast] = None,
|
||||
processor: Optional[BitImageProcessor] = None,
|
||||
model: Optional[nn.Module] = None,
|
||||
) -> None:
|
||||
"""Initialize the singleton with processor and model.
|
||||
@@ -124,7 +124,7 @@ if __name__ == "__main__":
|
||||
]
|
||||
|
||||
processor = cast(
|
||||
BitImageProcessorFast,
|
||||
BitImageProcessor,
|
||||
AutoImageProcessor.from_pretrained("facebook/dinov2-large", device_map="cuda"),
|
||||
)
|
||||
model = cast(
|
||||
|
||||
Reference in New Issue
Block a user