Update README.md
Browse files
README.md
CHANGED
|
@@ -93,14 +93,17 @@ Follow the official PyTorch installation guide for your platform:
|
|
| 93 |
|
| 94 |
VAAS will automatically detect PyTorch at runtime and raise a clear error if it is missing.
|
| 95 |
|
| 96 |
-
|
| 97 |
## Usage
|
| 98 |
|
| 99 |
-
|
|
|
|
|
|
|
| 100 |
|
| 101 |
```python
|
| 102 |
from vaas.inference.pipeline import VAASPipeline
|
| 103 |
from PIL import Image
|
|
|
|
|
|
|
| 104 |
|
| 105 |
pipeline = VAASPipeline.from_pretrained(
|
| 106 |
"OBA-Research/vaas-v1-df2023",
|
|
@@ -108,11 +111,18 @@ pipeline = VAASPipeline.from_pretrained(
|
|
| 108 |
alpha=0.5
|
| 109 |
)
|
| 110 |
|
| 111 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 112 |
result = pipeline(image)
|
| 113 |
|
| 114 |
print(result)
|
| 115 |
anomaly_map = result["anomaly_map"]
|
|
|
|
| 116 |
```
|
| 117 |
|
| 118 |
#### Output Format
|
|
@@ -126,7 +136,7 @@ anomaly_map = result["anomaly_map"]
|
|
| 126 |
}
|
| 127 |
```
|
| 128 |
|
| 129 |
-
### Inference with visual explanation
|
| 130 |
|
| 131 |
VAAS can also generate a qualitative visualization combining:
|
| 132 |
|
|
@@ -135,8 +145,9 @@ VAAS can also generate a qualitative visualization combining:
|
|
| 135 |
* Final hybrid anomaly score (S_H)
|
| 136 |
|
| 137 |
```python
|
|
|
|
| 138 |
pipeline.visualize(
|
| 139 |
-
image=
|
| 140 |
save_path="vaas_visualization.png",
|
| 141 |
mode="all", # options: "all", "px", "binary", "fx"
|
| 142 |
threshold=0.5,
|
|
@@ -236,6 +247,14 @@ If you use VAAS in your research, please cite both the software and the associat
|
|
| 236 |
|
| 237 |
---
|
| 238 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 239 |
## License
|
| 240 |
|
| 241 |
MIT License
|
|
@@ -245,4 +264,5 @@ MIT License
|
|
| 245 |
## Maintainers
|
| 246 |
|
| 247 |
**OBA-Research**
|
| 248 |
-
[https://
|
|
|
|
|
|
| 93 |
|
| 94 |
VAAS will automatically detect PyTorch at runtime and raise a clear error if it is missing.
|
| 95 |
|
|
|
|
| 96 |
## Usage
|
| 97 |
|
| 98 |
+
---
|
| 99 |
+
|
| 100 |
+
### 1. Basic inference on local and online images
|
| 101 |
|
| 102 |
```python
|
| 103 |
from vaas.inference.pipeline import VAASPipeline
|
| 104 |
from PIL import Image
|
| 105 |
+
import requests
|
| 106 |
+
from io import BytesIO
|
| 107 |
|
| 108 |
pipeline = VAASPipeline.from_pretrained(
|
| 109 |
"OBA-Research/vaas-v1-df2023",
|
|
|
|
| 111 |
alpha=0.5
|
| 112 |
)
|
| 113 |
|
| 114 |
+
# # Option A: Using a local image
|
| 115 |
+
# image = Image.open("example.jpg").convert("RGB")
|
| 116 |
+
# result = pipeline(image)
|
| 117 |
+
|
| 118 |
+
# Option B: Using an online image
|
| 119 |
+
url = "https://raw.githubusercontent.com/OBA-Research/VAAS/main/examples/images/COCO_DF_C110B00000_00539519.jpg"
|
| 120 |
+
image = Image.open(BytesIO(requests.get(url).content)).convert("RGB")
|
| 121 |
result = pipeline(image)
|
| 122 |
|
| 123 |
print(result)
|
| 124 |
anomaly_map = result["anomaly_map"]
|
| 125 |
+
|
| 126 |
```
|
| 127 |
|
| 128 |
#### Output Format
|
|
|
|
| 136 |
}
|
| 137 |
```
|
| 138 |
|
| 139 |
+
### 2. Inference with visual explanation
|
| 140 |
|
| 141 |
VAAS can also generate a qualitative visualization combining:
|
| 142 |
|
|
|
|
| 145 |
* Final hybrid anomaly score (S_H)
|
| 146 |
|
| 147 |
```python
|
| 148 |
+
|
| 149 |
pipeline.visualize(
|
| 150 |
+
image=image,
|
| 151 |
save_path="vaas_visualization.png",
|
| 152 |
mode="all", # options: "all", "px", "binary", "fx"
|
| 153 |
threshold=0.5,
|
|
|
|
| 247 |
|
| 248 |
---
|
| 249 |
|
| 250 |
+
## Contributing
|
| 251 |
+
|
| 252 |
+
We welcome contributions that improve the usability, robustness, and extensibility of VAAS.
|
| 253 |
+
|
| 254 |
+
Please see the full guidelines on [**Github**](https://github.com/OBA-Research/VAAS) in **[CONTRIBUTING.md](https://github.com/OBA-Research/VAAS/blob/main/CONTRIBUTING.md)**.
|
| 255 |
+
|
| 256 |
+
---
|
| 257 |
+
|
| 258 |
## License
|
| 259 |
|
| 260 |
MIT License
|
|
|
|
| 264 |
## Maintainers
|
| 265 |
|
| 266 |
**OBA-Research**
|
| 267 |
+
- [https://github.com/OBA-Research](https://github.com/OBA-Research)
|
| 268 |
+
- [https://huggingface.co/OBA-Research](https://huggingface.co/OBA-Research)
|