Create README.md
Browse files
README.md
ADDED
@@ -0,0 +1,45 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
---
|
2 |
+
license: mit
|
3 |
+
pipeline_tag: image-feature-extraction
|
4 |
+
---
|
5 |
+
## RICE-ViT-L Model Card
|
6 |
+
|
7 |
+
|
8 |
+

|
9 |
+
|
10 |
+
## Installation
|
11 |
+
|
12 |
+
```shell
|
13 |
+
pip install torch transformers
|
14 |
+
git clone https://github.com/deepglint/unicom
|
15 |
+
cd unicom/mlcd
|
16 |
+
```
|
17 |
+
|
18 |
+
## Usage
|
19 |
+
|
20 |
+
```python
|
21 |
+
from vit_rope2d_hf import MLCDVisionModel
|
22 |
+
from transformers import CLIPImageProcessor
|
23 |
+
from PIL import Image
|
24 |
+
import requests
|
25 |
+
import torch
|
26 |
+
|
27 |
+
# Load model and processor
|
28 |
+
model = MLCDVisionModel.from_pretrained("DeepGlint-AI/rice-vit-large-patch14-560")
|
29 |
+
processor = CLIPImageProcessor.from_pretrained("DeepGlint-AI/rice-vit-large-patch14-560")
|
30 |
+
|
31 |
+
# Process single image
|
32 |
+
url = "http://images.cocodataset.org/val2017/000000039769.jpg"
|
33 |
+
image = Image.open(requests.get(url, stream=True).raw)
|
34 |
+
inputs = processor(images=image, return_tensors="pt")
|
35 |
+
|
36 |
+
# Get visual features
|
37 |
+
with torch.no_grad():
|
38 |
+
outputs = model(**inputs)
|
39 |
+
features = outputs.last_hidden_state
|
40 |
+
|
41 |
+
print(f"Extracted features shape: {features.shape}")
|
42 |
+
```
|
43 |
+
|
44 |
+
|
45 |
+
```
|