PeiqingYang commited on
Commit
d3395d7
·
verified ·
1 Parent(s): cd748da

Improve inference usage

Browse files
Files changed (1) hide show
  1. README.md +9 -8
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
- Requires `pip install huggingface_hub`.
16
 
17
  ```shell
18
  pip install -q git+https://github.com/pq-yang/MatAnyone
19
  ```
20
 
21
- Users will only need to use these two lines to load and instantiate the model.
22
  ```python
23
- from matanyone.model.matanyone import MatAnyone
24
- matanyone = MatAnyone.from_pretrained("PeiqingYang/MatAnyone").cuda().eval()
25
- ```
26
 
27
- We also provide a **stand-alone** [inference script](https://huggingface.co/PeiqingYang/MatAnyone/blob/main/inference_matanyone_api.py) that could be used as **API**.
28
- ```shell
29
- python inference_matanyone_api.py -i <input video> -m <first-frame seg mask>
 
 
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
  ```