DaYuDaYu commited on
Commit
0213a4c
·
verified ·
1 Parent(s): 5649d8f

Add files using upload-large-folder tool

Browse files
.gitattributes CHANGED
@@ -57,3 +57,4 @@ saved_model/**/* filter=lfs diff=lfs merge=lfs -text
57
  # Video files - compressed
58
  *.mp4 filter=lfs diff=lfs merge=lfs -text
59
  *.webm filter=lfs diff=lfs merge=lfs -text
 
 
57
  # Video files - compressed
58
  *.mp4 filter=lfs diff=lfs merge=lfs -text
59
  *.webm filter=lfs diff=lfs merge=lfs -text
60
+ openimages_v7/open_images_validation_localized_narratives.jsonl filter=lfs diff=lfs merge=lfs -text
openimages_v7/open_images_validation_localized_narratives.jsonl ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:c9713328829c18cef80ed196674036605fe779c3e410b5b955662e35cd061e58
3
+ size 1139215790
openimages_v7/openimages_v7_valid/00000.tar ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:522eb643c319a28cdfc6af9c614b1cfcb293c93db6ff85da9538bebce609d2c5
3
+ size 1027368960
openimages_v7/openimages_v7_valid/00001.tar ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:0e7cba9dc21296c10a453d3ce187f7e2c784961322b3c07abc0b4f663366193d
3
+ size 1046251520
openimages_v7/openimages_v7_valid/00002.tar ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:5c3e2b32689bd770854154923e385fb905575bd339f65b164834b0996bea1a64
3
+ size 1022341120
openimages_v7/openimages_v7_valid/00003.tar ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:d8ac8b1a9ac5b39ace6f113bd1b85c324ca66ca5da448a0369c45796eb946026
3
+ size 1012889600
openimages_v7/openimages_v7_valid/00004.tar ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:6a3d2c73c6f905b6414be9bd052726960e636f33dd6f242a6045f9cbf8aad818
3
+ size 1042042880
openimages_v7/openimages_v7_valid/00005.tar ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:55a6ea71b469f330eb1bab13953b004a0341ee582466c0aa3413d87a71fe05cc
3
+ size 1028239360
openimages_v7/openimages_v7_valid/00006.tar ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:06323037575d5f28e30bee2b3efe84a08fe090dfa4331772dd1895d72ac4d875
3
+ size 1021583360
openimages_v7/openimages_v7_valid/00007.tar ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:2f0ab400e504805e920803b1bcb36bc3b16675fd412abaa85f867ca83e9138c7
3
+ size 1037291520
openimages_v7/openimages_v7_valid/00008.tar ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:98bbf4f4fa5ecdd868b11b3bc2db0cb7faf27b8f632a525a6193a2f6ee793683
3
+ size 1036400640
openimages_v7/openimages_v7_valid/00009.tar ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:f0313b3f70838a55f356b86fb0423e9858daaecffa038c987d90cc32a490aec9
3
+ size 1036042240
openimages_v7/openimages_v7_valid/00010.tar ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:8ce101de6a440b8329eac88730789ba97769b866bff5fe5e2bf062ceeffa8012
3
+ size 1017139200
openimages_v7/openimages_v7_valid/00011.tar ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:5019d183984f90b29af240abb32b447c9ea73211c5cf1612cca5d123e970ebf0
3
+ size 1007104000
openimages_v7/openimages_v7_valid/00012.tar ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:3f36f4633894ee42387027548b4011b2e8f21cd0f7157baaafea9f8b9440adb3
3
+ size 1023713280
openimages_v7/openimages_v7_valid/00013.tar ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:0dc3aba7640db6e4525dbaa68a7b954aecf3c480ed6f6bc5afd490789b1e3059
3
+ size 916643840
openimages_v7/processing_openimages.py ADDED
@@ -0,0 +1,48 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ #!/usr/bin/env python
2
+ # coding: utf-8
3
+ #
4
+ # Usage:
5
+ # python3 openimages_to_wds.py
6
+
7
+ import os
8
+ import os.path as osp
9
+ import json
10
+ import shutil
11
+ from tqdm import tqdm
12
+
13
+ root = "/media/data/CC3M/data/openimages_v7"
14
+ save_dir = osp.join(root, "openimages_v7_valid")
15
+
16
+ if not os.path.exists(save_dir):
17
+ os.makedirs(save_dir)
18
+
19
+ 'https://storage.googleapis.com/localized-narratives/annotations/open_images_validation_localized_narratives.jsonl'
20
+
21
+ json_file_path = osp.join(root, "open_images_validation_localized_narratives.jsonl")
22
+ sub_fold_cnt = 1
23
+ with open(json_file_path, "r") as f:
24
+ for i, line in tqdm(enumerate(f)):
25
+ line = json.loads(line)
26
+ image_id = line["image_id"]
27
+
28
+ cap = line["caption"]
29
+ src = osp.join(root, "valid", f"{image_id}.jpg")
30
+
31
+ if (i + 1) % 2999 == 0:
32
+ sub_fold_cnt += 1
33
+ sub_fold = osp.join(save_dir, str(sub_fold_cnt - 1).zfill(5))
34
+ if not os.path.exists(sub_fold):
35
+ os.makedirs(sub_fold)
36
+
37
+ img_path = osp.join(root, sub_fold, f"{image_id}.jpg")
38
+ txt_path = osp.join(root, sub_fold, f"{image_id}.txt")
39
+ jsn_path = osp.join(root, sub_fold, f"{image_id}.json")
40
+
41
+ shutil.copy(src, img_path)
42
+
43
+ with open(txt_path, "w") as f:
44
+ f.write(cap)
45
+
46
+ with open(jsn_path, "w") as f:
47
+ json.dump(line, f)
48
+
openimages_v7/remove_dir.py ADDED
@@ -0,0 +1,14 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import os
2
+ import shutil
3
+
4
+ def remove_dirs_except_tar(root_dir):
5
+ for item in os.listdir(root_dir):
6
+ item_path = os.path.join(root_dir, item)
7
+ if os.path.isdir(item_path):
8
+ shutil.rmtree(item_path)
9
+ elif item.endswith('.tar'):
10
+ continue
11
+
12
+ if __name__ == "__main__":
13
+ root_directory = '/media/data/CC3M/data/openimages_v7/openimages_v7_valid'
14
+ remove_dirs_except_tar(root_directory)