Skip to content

Open-Sora: Democratizing Efficient Video Production for All

Python

format tools

Zangwei Zheng57a1e7f6c43e
diff --git a/tools/scoring/README.md b/tools/scoring/README.md
index 6466d75..b462783 100644
--- a/tools/scoring/README.md
+++ b/tools/scoring/README.md
@@ -38,27 +38,33 @@ torchrun --nproc_per_node 8 -m tools.scoring.aesthetic.inference meta.csv --bs
This will generate multiple part files, you can use `python -m tools.datasets.csvutil DATA1.csv DATA2.csv` to merge these part files.
## Optical Flow Score
+
Optical flow scores are used to assess the motion of a video. Higher optical flow scores indicate larger movement.
TODO: acknowledge UniMatch.
First get the pretrained model.
+
```bash
wget https://s3.eu-central-1.amazonaws.com/avg-projects/unimatch/pretrained/gmflow-scale2-regrefine6-mixdata-train320x576-4e7b215d.pth -P pretrained_models/unimatch
```
Then run:
-```
+
+```bash
torchrun --standalone --nproc_per_node 8 tools/scoring/optical_flow/inference_parallel.py /path/to/meta.csv
```
+
The output should be `/path/to/meta_flow.csv` with column `flow`.
## Matching Score
+
Matching scores are calculated to evaluate the alignment between an image/video and its caption.
For videos, we compute the matching score of the middle frame and the caption.
**Make sure** meta files contain the column `text`, which is the caption of the sample. Then run:
-```
+```bash
torchrun --standalone --nproc_per_node 8 tools/scoring/matching/inference_parallel.py /path/to/meta.csv
```
+
The output should be `/path/to/meta_match.csv` with column `match`. Higher matching scores indicate better image-text/video-text alignment.
diff --git a/tools/splitting/README.md b/tools/splitting/README.md
index 0e3e0ab..160daa3 100644
--- a/tools/splitting/README.md
+++ b/tools/splitting/README.md
@@ -1,7 +1,11 @@
-## Scene Detection and Video Splitting
-
-### Scene Detection
-TODO
-
-### Video Splitting
-TODO
+# Scene Detection and Video Split
+
+Raw videos from the Internet may be too long for training.
+Thus, we detect scenes in raw videos and split them into short clips based on the scenes.
+First prepare the video processing packages.
+
+```bash
+pip install scenedetect moviepy opencv-python
+```
+
+Then run `scene_detect.py`. We provide efficient processing using `multiprocessing`. Don't forget to specify your own dataset path.
diff --git a/tools/splitting/scenedetect/README.md b/tools/splitting/scenedetect/README.md
deleted file mode 100644
index 5e7ac29..0000000
--- a/tools/splitting/scenedetect/README.md
+++ /dev/null
@@ -1,9 +0,0 @@
-# Scene Detection and Video Split
-
-Raw videos from the Internet may be too long for training.
-Thus, we detect scenes in raw videos and split them into short clips based on the scenes.
-First prepare the video processing packages.
-```bash
-pip install scenedetect moviepy opencv-python
-```
-Then run `scene_detect.py`. We provide efficient processing using `multiprocessing`. Don't forget to specify your own dataset path.
diff --git a/tools/splitting/scenedetect/__init__.py b/tools/splitting/scenedetect/__init__.py
new file mode 100644
index 0000000..e69de29