Update README.md
Browse files
README.md
CHANGED
@@ -36,7 +36,7 @@ DAVIS-Edit
|
|
36 |
βββ edited_video_caption_dict_image.json <----- Annotated text descriptions for image-based editing on DAVIS-Edit
|
37 |
βββ edited_video_caption_dict_text.json <----- Annotated text descriptions for text-based editing on DAVIS-Edit
|
38 |
```
|
39 |
-
Specifically, `edited_video_caption_dict_image.json` and `edited_video_caption_dict_text.json` are constructed as Python
|
40 |
```json
|
41 |
{
|
42 |
"bear": {
|
@@ -46,22 +46,48 @@ Specifically, `edited_video_caption_dict_image.json` and `edited_video_caption_d
|
|
46 |
},
|
47 |
...
|
48 |
```
|
|
|
49 |
|
50 |
# How to use DAVIS-Edit?
|
51 |
We highly recommend you to index different elements in `DAVIS-Edit` through the *annotation files*. Particularly, you may refer to the script below:
|
52 |
```python
|
|
|
53 |
import json
|
54 |
from tqdm import tqdm
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
55 |
|
56 |
# Load the annotation file
|
57 |
-
with open(
|
58 |
annotations = json.load(f)
|
59 |
|
60 |
# Iterate all data samples in DAVIS-Edit
|
61 |
for video_name in tqdm(annotations.keys()):
|
|
|
|
|
62 |
original_prompt = annotations[video_name]['original']
|
63 |
similar_prompt = annotations[video_name]['similar']
|
64 |
changing_prompt = annotations[video_name]['changing']
|
65 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
66 |
# (add further operations that you expect in the lines below)
|
67 |
```
|
|
|
36 |
βββ edited_video_caption_dict_image.json <----- Annotated text descriptions for image-based editing on DAVIS-Edit
|
37 |
βββ edited_video_caption_dict_text.json <----- Annotated text descriptions for text-based editing on DAVIS-Edit
|
38 |
```
|
39 |
+
Specifically, `edited_video_caption_dict_image.json` and `edited_video_caption_dict_text.json` are constructed as Python dictionary, with its keys as the names of video folders in `JPEGImages`. For example in `edited_video_caption_dict_text.json`:
|
40 |
```json
|
41 |
{
|
42 |
"bear": {
|
|
|
46 |
},
|
47 |
...
|
48 |
```
|
49 |
+
The annotations of reference images contain two sub-folders, i.e., `similar` and `changing`, corresponding to the annotations for `DAVIS-Edit-S` and `DAVIS-Edit-C`, respectively, where the structure are constructed in the same folder name as that in `JPEGImages`.
|
50 |
|
51 |
# How to use DAVIS-Edit?
|
52 |
We highly recommend you to index different elements in `DAVIS-Edit` through the *annotation files*. Particularly, you may refer to the script below:
|
53 |
```python
|
54 |
+
import os
|
55 |
import json
|
56 |
from tqdm import tqdm
|
57 |
+
from PIL import Image
|
58 |
+
|
59 |
+
# TODO: Modify the configurations here to your local paths
|
60 |
+
frame_root = 'JPEGImages'
|
61 |
+
mask_root = 'Annotations'
|
62 |
+
reference_image_root = 'ReferenceImages/similar' # Or 'ReferenceImages/changing'
|
63 |
+
annotation_file_path = 'edited_video_caption_dict_text.json'
|
64 |
|
65 |
# Load the annotation file
|
66 |
+
with open(annotation_file_path, 'r') as f:
|
67 |
annotations = json.load(f)
|
68 |
|
69 |
# Iterate all data samples in DAVIS-Edit
|
70 |
for video_name in tqdm(annotations.keys()):
|
71 |
+
|
72 |
+
# Load text prompts
|
73 |
original_prompt = annotations[video_name]['original']
|
74 |
similar_prompt = annotations[video_name]['similar']
|
75 |
changing_prompt = annotations[video_name]['changing']
|
76 |
|
77 |
+
# Load reference images
|
78 |
+
reference_image = Image.open(os.path.join(reference_image_root, video_name + '.png'))
|
79 |
+
|
80 |
+
# Load video frames
|
81 |
+
video_frames = []
|
82 |
+
for path in sorted(os.listdir(os.path.join(frame_root, video_name))):
|
83 |
+
if path != 'Thumbs.db' and path != '.DS_store':
|
84 |
+
video_frames.append(Image.open(os.path.join(frame_root, path)))
|
85 |
+
|
86 |
+
# Load masks
|
87 |
+
masks = []
|
88 |
+
for path in sorted(os.listdir(os.path.join(mask_root, video_name))):
|
89 |
+
if path != 'Thumbs.db' and path != '.DS_store':
|
90 |
+
video_frames.append(Image.open(os.path.join(frame_root, path)))
|
91 |
+
|
92 |
# (add further operations that you expect in the lines below)
|
93 |
```
|