Improve inference usage
Browse files
README.md
CHANGED
|
@@ -12,19 +12,20 @@ This repository contains the model described in [MatAnyone: Stable Video Matting
|
|
| 12 |
Code: https://github.com/pq-yang/MatAnyone
|
| 13 |
|
| 14 |
## Usage
|
| 15 |
-
|
| 16 |
|
| 17 |
```shell
|
| 18 |
pip install -q git+https://github.com/pq-yang/MatAnyone
|
| 19 |
```
|
| 20 |
|
| 21 |
-
|
| 22 |
```python
|
| 23 |
-
from matanyone
|
| 24 |
-
|
| 25 |
-
```
|
| 26 |
|
| 27 |
-
|
| 28 |
-
|
| 29 |
-
|
|
|
|
|
|
|
| 30 |
```
|
|
|
|
| 12 |
Code: https://github.com/pq-yang/MatAnyone
|
| 13 |
|
| 14 |
## Usage
|
| 15 |
+
Models can be directly loaded from [Hugging Face](https://huggingface.co/PeiqingYang/MatAnyone) to make inference.
|
| 16 |
|
| 17 |
```shell
|
| 18 |
pip install -q git+https://github.com/pq-yang/MatAnyone
|
| 19 |
```
|
| 20 |
|
| 21 |
+
To extract the foreground and the alpha video you can **directly run the following lines**. Please refer to [inference_hf.py](https://github.com/pq-yang/MatAnyone/blob/main/inference_hf.py) for more arguments.
|
| 22 |
```python
|
| 23 |
+
from matanyone import InferenceCore
|
| 24 |
+
processor = InferenceCore("PeiqingYang/MatAnyone")
|
|
|
|
| 25 |
|
| 26 |
+
foreground_path, alpha_path = processor.process_video(
|
| 27 |
+
input_path = <video_path>,
|
| 28 |
+
mask_path = <mask_path>,
|
| 29 |
+
output_path = <output_path>
|
| 30 |
+
)
|
| 31 |
```
|