kemz commited on
Commit
0aba584
·
verified ·
1 Parent(s): b7f62be

Upload 3 files

Browse files
Files changed (3) hide show
  1. metadata.jsonl +40 -0
  2. train.py +100 -0
  3. 色表.txt +1 -0
metadata.jsonl ADDED
@@ -0,0 +1,40 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {"conditioning_image": "conditioning_images/00a1940434d687a785be0acf2b0fbff3.png", "image": "images/00a1940434d687a785be0acf2b0fbff3.jpg", "text": "A woman wears a linen top and cotton bottom"}
2
+ {"conditioning_image": "conditioning_images/00a325fd4dc22079095ab46330abf7be.png", "image": "images/00a325fd4dc22079095ab46330abf7be.jpg", "text": "A woman wearing a cotton top and denim bottom"}
3
+ {"conditioning_image": "conditioning_images/00d6e5891b7507fccbd49f2c2756b114.png", "image": "images/00d6e5891b7507fccbd49f2c2756b114.jpg", "text": "A woman wearing a mesh dress"}
4
+ {"conditioning_image": "conditioning_images/00faa1032cc0809974a8d2dd7b018497.png", "image": "images/00faa1032cc0809974a8d2dd7b018497.jpg", "text": "A woman wearing a nylon dress"}
5
+ {"conditioning_image": "conditioning_images/01a64310ea9205193295869fcae93f90.png", "image": "images/01a64310ea9205193295869fcae93f90.jpg", "text": "A woman wearing a silk dress"}
6
+ {"conditioning_image": "conditioning_images/01d0251b5bc5a41f93c86042c56258d3.png", "image": "images/01d0251b5bc5a41f93c86042c56258d3.jpg", "text": "A woman wearing a polyester top and denim bottom"}
7
+ {"conditioning_image": "conditioning_images/02ddd4192bc9a5823be4312824814279.png", "image": "images/02ddd4192bc9a5823be4312824814279.jpg", "text": "A woman wearing a triacetate top and polyester bottom"}
8
+ {"conditioning_image": "conditioning_images/056bea38b1947154d0613aab63505033.png", "image": "images/056bea38b1947154d0613aab63505033.jpg", "text": "A woman wearing a polyester top and polyester bottom"}
9
+ {"conditioning_image": "conditioning_images/0afb6b28d4583e470c7d0c52268272a7.png", "image": "images/0afb6b28d4583e470c7d0c52268272a7.jpg", "text": "A man wearing a polyester top and denim bottom"}
10
+ {"conditioning_image": "conditioning_images/0cd8f2955ec01a4e2678648f153b1326.png", "image": "images/0cd8f2955ec01a4e2678648f153b1326.jpg", "text": "A woman wearing a cotton top and denim bottom"}
11
+ {"conditioning_image": "conditioning_images/0d32e0c44b492a04a01db6eaf11c7fc7.png", "image": "images/0d32e0c44b492a04a01db6eaf11c7fc7.jpg", "text": "A woman wearing a polyester top and polyester bottom"}
12
+ {"conditioning_image": "conditioning_images/0f4d15d0aed8a66085298f73a759f27b.png", "image": "images/0f4d15d0aed8a66085298f73a759f27b.jpg", "text": "A woman wearing a linen top and denim bottom"}
13
+ {"conditioning_image": "conditioning_images/155ea684f404a9b299b20ae06a64b813.png", "image": "images/155ea684f404a9b299b20ae06a64b813.jpg", "text": "A woman wears a mesh dress"}
14
+ {"conditioning_image": "conditioning_images/18c0e9262037120fc1820f5a2fed264b.png", "image": "images/18c0e9262037120fc1820f5a2fed264b.jpg", "text": "A woman wears a polyester dress"}
15
+ {"conditioning_image": "conditioning_images/1d48dbe153101fe75b0e5c33cdd6934a.png", "image": "images/1d48dbe153101fe75b0e5c33cdd6934a.jpg", "text": "A woman wears a triacetate dress"}
16
+ {"conditioning_image": "conditioning_images/1f4c2d7ddfaa4d7c5a88df6d04ec0512.png", "image": "images/1f4c2d7ddfaa4d7c5a88df6d04ec0512.jpg", "text": "A woman wears a triacetate dress"}
17
+ {"conditioning_image": "conditioning_images/263b6dd877a80699f43aef905d7ea37e.png", "image": "images/263b6dd877a80699f43aef905d7ea37e.jpg", "text": "A woman wearing a polyester top and denim bottom"}
18
+ {"conditioning_image": "conditioning_images/28d0923aec82214d368745bd681ff6d5.png", "image": "images/28d0923aec82214d368745bd681ff6d5.jpg", "text": "A woman wearing a polyester top and denim bottom"}
19
+ {"conditioning_image": "conditioning_images/2ceacea255bd16e687e26a83c5452255.png", "image": "images/2ceacea255bd16e687e26a83c5452255.jpg", "text": "A woman wearing a cotton top and cotton bottom"}
20
+ {"conditioning_image": "conditioning_images/35ea31136d790c8bd79de310fd235d6a.png", "image": "images/35ea31136d790c8bd79de310fd235d6a.jpg", "text": "A woman wearing a linen top and leather bottom"}
21
+ {"conditioning_image": "conditioning_images/36d52e6a24212f35e00755030e047cce.png", "image": "images/36d52e6a24212f35e00755030e047cce.jpg", "text": "A woman wears a silk dress"}
22
+ {"conditioning_image": "conditioning_images/37daf864f5b372bd9f665a77dd8d02e1.png", "image": "images/37daf864f5b372bd9f665a77dd8d02e1.jpg", "text": "A woman wearing a cotton top and polyester bottom"}
23
+ {"conditioning_image": "conditioning_images/38fdac9188383dc9ceb7977ac6d82259.png", "image": "images/38fdac9188383dc9ceb7977ac6d82259.jpg", "text": "A man wearing a polyester top and polyester bottom"}
24
+ {"conditioning_image": "conditioning_images/3a8a2d38d8e3d16b2ca9dff94be6e9ed.png", "image": "images/3a8a2d38d8e3d16b2ca9dff94be6e9ed.jpg", "text": "A woman wearing a cotton top and leather bottom"}
25
+ {"conditioning_image": "conditioning_images/3ae36909e5aa4ad018b2601797debf94.png", "image": "images/3ae36909e5aa4ad018b2601797debf94.jpg", "text": "A woman wears a mesh dress"}
26
+ {"conditioning_image": "conditioning_images/3b9cc0d697af512490a7bf58883f9a20.png", "image": "images/3b9cc0d697af512490a7bf58883f9a20.jpg", "text": "A woman wears a cotton dress"}
27
+ {"conditioning_image": "conditioning_images/3d210e0f2b3843e00248c42ff7e8db2e.png", "image": "images/3d210e0f2b3843e00248c42ff7e8db2e.jpg", "text": "A woman wearing a lyocell top and polyester bottom"}
28
+ {"conditioning_image": "conditioning_images/3f18271f3f7d101e2f9a27b0b12b034b.png", "image": "images/3f18271f3f7d101e2f9a27b0b12b034b.jpg", "text": "A man wearing a cotton top and denim bottom"}
29
+ {"conditioning_image": "conditioning_images/3f771de0d16afef53e415530105ec3d1.png", "image": "images/3f771de0d16afef53e415530105ec3d1.jpg", "text": "A woman wearing a polyester top and polyester bottom"}
30
+ {"conditioning_image": "conditioning_images/43b780991509f28d70afa9cbbc5ea7a3.png", "image": "images/43b780991509f28d70afa9cbbc5ea7a3.jpg", "text": "A woman wears a mesh dress"}
31
+ {"conditioning_image": "conditioning_images/45b584f600bb54980c947629322ea66f.png", "image": "images/45b584f600bb54980c947629322ea66f.jpg", "text": "A woman wears a lace dress"}
32
+ {"conditioning_image": "conditioning_images/47a6e8d14d0e8c92f3759036b8541cf9.png", "image": "images/47a6e8d14d0e8c92f3759036b8541cf9.jpg", "text": "A woman wears a mesh dress"}
33
+ {"conditioning_image": "conditioning_images/51ac2655f437e006705567521d159ddd.png", "image": "images/51ac2655f437e006705567521d159ddd.jpg", "text": "A woman wears a polyester dress"}
34
+ {"conditioning_image": "conditioning_images/51c2e1d3765b48227cc474513f6efc59.png", "image": "images/51c2e1d3765b48227cc474513f6efc59.jpg", "text": "A woman wears a mesh dress"}
35
+ {"conditioning_image": "conditioning_images/52d1bc8d28804844ee349e3605cd0eb6.png", "image": "images/52d1bc8d28804844ee349e3605cd0eb6.jpg", "text": "A woman wears a cotton dress"}
36
+ {"conditioning_image": "conditioning_images/66fe67538a5675cf82fc8d21a0fa4842.png", "image": "images/66fe67538a5675cf82fc8d21a0fa4842.jpg", "text": "A woman wearing a polyester top and triacetate bottom"}
37
+ {"conditioning_image": "conditioning_images/73d2b7e13c0b34f9d0572b57ea56be63.png", "image": "images/73d2b7e13c0b34f9d0572b57ea56be63.jpg", "text": "A woman wearing a polyester top and denim bottom"}
38
+ {"conditioning_image": "conditioning_images/74a6d023e5adfb465f186250a916dc84.png", "image": "images/74a6d023e5adfb465f186250a916dc84.jpg", "text": "A woman wearing a silk dress"}
39
+ {"conditioning_image": "conditioning_images/77ab6c285ed02a0c8badb9d52755163f.png", "image": "images/77ab6c285ed02a0c8badb9d52755163f.jpg", "text": "A woman wearing a suede dress"}
40
+ {"conditioning_image": "conditioning_images/88a0031f5015673edf2604daaf45f1f8.png", "image": "images/88a0031f5015673edf2604daaf45f1f8.jpg", "text": "A woman wearing a polyester dress"}
train.py ADDED
@@ -0,0 +1,100 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import pandas as pd
2
+ from huggingface_hub import hf_hub_url
3
+ import datasets
4
+ import os
5
+
6
+ _VERSION = datasets.Version("0.0.2")
7
+
8
+ _DESCRIPTION = "TODO"
9
+ _HOMEPAGE = "TODO"
10
+ _LICENSE = "TODO"
11
+ _CITATION = "TODO"
12
+
13
+ _FEATURES = datasets.Features(
14
+ {
15
+ "image": datasets.Image(),
16
+ "conditioning_image": datasets.Image(),
17
+ "text": datasets.Value("string"),
18
+ },
19
+ )
20
+
21
+ # METADATA_URL = hf_hub_url(
22
+ # "fusing/fill50k",
23
+ # filename="train.jsonl",
24
+ # repo_type="dataset",
25
+ # )
26
+ #
27
+ # IMAGES_URL = hf_hub_url(
28
+ # "fusing/fill50k",
29
+ # filename="images.zip",
30
+ # repo_type="dataset",
31
+ # )
32
+ #
33
+ # CONDITIONING_IMAGES_URL = hf_hub_url(
34
+ # "fusing/fill50k",
35
+ # filename="conditioning_images.zip",
36
+ # repo_type="dataset",
37
+ # )
38
+
39
+ _DEFAULT_CONFIG = datasets.BuilderConfig(name="default", version=_VERSION)
40
+
41
+
42
+ class CLOTH(datasets.GeneratorBasedBuilder):
43
+ BUILDER_CONFIGS = [_DEFAULT_CONFIG]
44
+ DEFAULT_CONFIG_NAME = "default"
45
+
46
+ def _info(self):
47
+ return datasets.DatasetInfo(
48
+ description=_DESCRIPTION,
49
+ features=_FEATURES,
50
+ supervised_keys=None,
51
+ homepage=_HOMEPAGE,
52
+ license=_LICENSE,
53
+ citation=_CITATION,
54
+ )
55
+
56
+ def _split_generators(self, dl_manager):
57
+ def _split_generators(self, dl_manager):
58
+ metadata_path = "metadata.jsonl"
59
+ images_dir = "images"
60
+ conditioning_images_dir = "conditioning_images"
61
+
62
+ return [
63
+ datasets.SplitGenerator(
64
+ name=datasets.Split.TRAIN,
65
+ # These kwargs will be passed to _generate_examples
66
+ gen_kwargs={
67
+ "metadata_path": metadata_path,
68
+ "images_dir": images_dir,
69
+ "conditioning_images_dir": conditioning_images_dir,
70
+ },
71
+ ),
72
+ ]
73
+
74
+ def _generate_examples(self, metadata_path, images_dir, conditioning_images_dir):
75
+ metadata = pd.read_json(metadata_path, lines=True)
76
+
77
+ for _, row in metadata.iterrows():
78
+ text = row["text"]
79
+
80
+ image_path = row["image"]
81
+ image_path = os.path.join(images_dir, image_path)
82
+ image = open(image_path, "rb").read()
83
+
84
+ conditioning_image_path = row["conditioning_image"]
85
+ conditioning_image_path = os.path.join(
86
+ conditioning_images_dir, row["conditioning_image"]
87
+ )
88
+ conditioning_image = open(conditioning_image_path, "rb").read()
89
+
90
+ yield row["image"], {
91
+ "text": text,
92
+ "image": {
93
+ "path": image_path,
94
+ "bytes": image,
95
+ },
96
+ "conditioning_image": {
97
+ "path": conditioning_image_path,
98
+ "bytes": conditioning_image,
99
+ },
100
+ }
色表.txt ADDED
@@ -0,0 +1 @@
 
 
1
+ {'flax_tops': (244, 180, 14), 'contton_bottoms': (220, 2, 34), 'cotton_tops': (144, 82, 83), 'cowboy_bottoms': (61, 217, 165), 'mesh_dresses': (37, 125, 177), 'nylon_dresses': (150, 101, 112), 'silk_dresses': (195, 134, 196), 'Polyester_brazing_tops': (239, 87, 157), 'triacetate_tops': (66, 66, 195), 'polyester_brazing_bottoms': (136, 152, 253), 'polyester_brazing_tops': (121, 20, 169), 'triacetate_dresses': (3, 199, 135), 'leather_bottoms': (234, 21, 166), 'sill_dresses': (33, 234, 15), 'contton_dresses': (95, 63, 50), 'Lyocell_fibers_tops': (63, 30, 91), 'lace_dresses': (116, 172, 181), 'polyester_brazing_dresses': (78, 237, 5), 'triacetate_bottoms': (123, 237, 129), 'tiger_velvet_dresses': (36, 213, 137)}