Commit
·
a7143ed
1
Parent(s):
831aea3
Update README.md
Browse files
README.md
CHANGED
|
@@ -41,10 +41,13 @@ datasets:
|
|
| 41 |
<!-- This section is for the model use without fine-tuning or plugging into a larger ecosystem/app. -->
|
| 42 |
|
| 43 |
```python
|
|
|
|
|
|
|
| 44 |
import numpy as np
|
| 45 |
from datasets import load_dataset
|
| 46 |
from matplotlib import cm
|
| 47 |
from PIL import Image
|
|
|
|
| 48 |
from transformers import AutoImageProcessor, AutoModel
|
| 49 |
|
| 50 |
model = AutoModel.from_pretrained("RGBD-SOD/bbsnet", trust_remote_code=True)
|
|
@@ -82,7 +85,7 @@ preprocessed_sample = {
|
|
| 82 |
'depth': tensor([[[[0.9529, 0....3490]]]])
|
| 83 |
}
|
| 84 |
"""
|
| 85 |
-
preprocessed_sample = image_processor.preprocess(sample)
|
| 86 |
|
| 87 |
"""
|
| 88 |
2. Prediction step
|
|
@@ -91,7 +94,9 @@ output = {
|
|
| 91 |
'logits': tensor([[[[-5.1966, ...ackward0>)
|
| 92 |
}
|
| 93 |
"""
|
| 94 |
-
output = model(
|
|
|
|
|
|
|
| 95 |
|
| 96 |
"""
|
| 97 |
3. Postprocessing step
|
|
|
|
| 41 |
<!-- This section is for the model use without fine-tuning or plugging into a larger ecosystem/app. -->
|
| 42 |
|
| 43 |
```python
|
| 44 |
+
from typing import Dict
|
| 45 |
+
|
| 46 |
import numpy as np
|
| 47 |
from datasets import load_dataset
|
| 48 |
from matplotlib import cm
|
| 49 |
from PIL import Image
|
| 50 |
+
from torch import Tensor
|
| 51 |
from transformers import AutoImageProcessor, AutoModel
|
| 52 |
|
| 53 |
model = AutoModel.from_pretrained("RGBD-SOD/bbsnet", trust_remote_code=True)
|
|
|
|
| 85 |
'depth': tensor([[[[0.9529, 0....3490]]]])
|
| 86 |
}
|
| 87 |
"""
|
| 88 |
+
preprocessed_sample: Dict[str, Tensor] = image_processor.preprocess(sample)
|
| 89 |
|
| 90 |
"""
|
| 91 |
2. Prediction step
|
|
|
|
| 94 |
'logits': tensor([[[[-5.1966, ...ackward0>)
|
| 95 |
}
|
| 96 |
"""
|
| 97 |
+
output: Dict[str, Tensor] = model(
|
| 98 |
+
preprocessed_sample["rgb"], preprocessed_sample["depth"]
|
| 99 |
+
)
|
| 100 |
|
| 101 |
"""
|
| 102 |
3. Postprocessing step
|