[Upload] Upload files
Browse files- README.md +17 -0
- girls_group.py +111 -0
README.md
ADDED
@@ -0,0 +1,17 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
---
|
2 |
+
dataset_info:
|
3 |
+
features:
|
4 |
+
- name: image
|
5 |
+
dtype: image
|
6 |
+
- name: annotation
|
7 |
+
dtype: string
|
8 |
+
splits:
|
9 |
+
- name: train
|
10 |
+
num_bytes: 8369374
|
11 |
+
num_examples: 10
|
12 |
+
- name: validation
|
13 |
+
num_bytes: 8369374
|
14 |
+
num_examples: 10
|
15 |
+
download_size: 8353015
|
16 |
+
dataset_size: 16738748
|
17 |
+
---
|
girls_group.py
ADDED
@@ -0,0 +1,111 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
# Copyright 2020 The HuggingFace Datasets Authors and the current dataset script contributor.
|
2 |
+
#
|
3 |
+
# Licensed under the Apache License, Version 2.0 (the "License");
|
4 |
+
# you may not use this file except in compliance with the License.
|
5 |
+
# You may obtain a copy of the License at
|
6 |
+
#
|
7 |
+
# http://www.apache.org/licenses/LICENSE-2.0
|
8 |
+
#
|
9 |
+
# Unless required by applicable law or agreed to in writing, software
|
10 |
+
# distributed under the License is distributed on an "AS IS" BASIS,
|
11 |
+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
12 |
+
# See the License for the specific language governing permissions and
|
13 |
+
# limitations under the License.
|
14 |
+
|
15 |
+
import csv
|
16 |
+
import json
|
17 |
+
import os
|
18 |
+
|
19 |
+
import datasets
|
20 |
+
|
21 |
+
|
22 |
+
# Find for instance the citation on arxiv or on the dataset repo/website
|
23 |
+
_CITATION = """\
|
24 |
+
@InProceedings{huggingface:dataset,
|
25 |
+
title = {K-pop girls groups dataset},
|
26 |
+
author={smwoo, Inc.
|
27 |
+
},
|
28 |
+
year={2023}
|
29 |
+
}
|
30 |
+
"""
|
31 |
+
|
32 |
+
_BASE_URL = "https://drive.google.com/u/0/uc?id=16_GUeJcC88LrB8zJni0-XdjdL14WXOVW&export=download"
|
33 |
+
|
34 |
+
_METADATA_URLS = {
|
35 |
+
"train": "https://drive.google.com/u/0/uc?id=1mPwH_p1-QQtY0xsFjLIzQLkAXDNyB8sO&export=download",
|
36 |
+
"test": "https://drive.google.com/u/0/uc?id=1mPwH_p1-QQtY0xsFjLIzQLkAXDNyB8sO&export=download"
|
37 |
+
}
|
38 |
+
|
39 |
+
# You can copy an official description
|
40 |
+
_DESCRIPTION = """\
|
41 |
+
This new dataset is designed to learn how to make custom dataset.
|
42 |
+
"""
|
43 |
+
|
44 |
+
_HOMEPAGE = "https://cislab.cau.ac.kr/"
|
45 |
+
|
46 |
+
_LICENSE = ""
|
47 |
+
|
48 |
+
_IMAGES_DIR = "data/"
|
49 |
+
|
50 |
+
class GirlsGroupsConfig(datasets.BuilderConfig):
|
51 |
+
"""BuilderConfig for GirlsGroups dataset."""
|
52 |
+
|
53 |
+
def __init__(self, features, data_url, citation, url, label_classes=("False", "True"), **kwargs):
|
54 |
+
super(GirlsGroupsConfig, self).__init__(version=datasets.Version("1.1.0"), **kwargs)
|
55 |
+
self.features = features
|
56 |
+
self.label_classes = label_classes
|
57 |
+
self.data_url = data_url
|
58 |
+
self.citation = citation
|
59 |
+
self.url = url
|
60 |
+
|
61 |
+
|
62 |
+
class GirlsGroups(datasets.GeneratorBasedBuilder):
|
63 |
+
"""GirlsGroups Images dataset."""
|
64 |
+
|
65 |
+
def _info(self):
|
66 |
+
return datasets.DatasetInfo(
|
67 |
+
description=_DESCRIPTION,
|
68 |
+
features=datasets.Features(
|
69 |
+
{
|
70 |
+
"image": datasets.Image(),
|
71 |
+
"annotation": datasets.Value(dtype='string'),
|
72 |
+
}
|
73 |
+
),
|
74 |
+
homepage=_HOMEPAGE,
|
75 |
+
citation=_CITATION,
|
76 |
+
license=_LICENSE,
|
77 |
+
)
|
78 |
+
|
79 |
+
def _split_generators(self, dl_manager):
|
80 |
+
# dl_manager is a datasets.download.DownloadManager that can be used to download and extract URLS
|
81 |
+
archive_path = dl_manager.download(_BASE_URL)
|
82 |
+
split_metadata_paths = dl_manager.download(_METADATA_URLS)
|
83 |
+
return [
|
84 |
+
datasets.SplitGenerator(
|
85 |
+
name=datasets.Split.TRAIN,
|
86 |
+
gen_kwargs={
|
87 |
+
"images": dl_manager.iter_archive(archive_path),
|
88 |
+
"metadata_path": split_metadata_paths["train"],
|
89 |
+
},
|
90 |
+
),
|
91 |
+
datasets.SplitGenerator(
|
92 |
+
name=datasets.Split.VALIDATION,
|
93 |
+
gen_kwargs={
|
94 |
+
"images": dl_manager.iter_archive(archive_path),
|
95 |
+
"metadata_path": split_metadata_paths["test"],
|
96 |
+
},
|
97 |
+
),
|
98 |
+
]
|
99 |
+
|
100 |
+
def _generate_examples(self, images, metadata_path):
|
101 |
+
"""Generate images and labels for splits."""
|
102 |
+
save_list = {}
|
103 |
+
with open(metadata_path, newline='') as csvfile:
|
104 |
+
spamreader = csv.reader(csvfile, delimiter=',', quotechar='|')
|
105 |
+
for row in spamreader:
|
106 |
+
save_list[row[0]] = row[1]
|
107 |
+
for file_path, file_obj in images:
|
108 |
+
yield file_path, {
|
109 |
+
"image": {"path": file_path, "bytes": file_obj.read()},
|
110 |
+
"annotation" : save_list[file_path]
|
111 |
+
}
|