parquet-converter commited on
Commit
2aa832e
1 Parent(s): b628395

Update parquet files

Browse files
.gitattributes DELETED
@@ -1,53 +0,0 @@
1
- *.7z filter=lfs diff=lfs merge=lfs -text
2
- *.arrow filter=lfs diff=lfs merge=lfs -text
3
- *.bin filter=lfs diff=lfs merge=lfs -text
4
- *.bz2 filter=lfs diff=lfs merge=lfs -text
5
- *.ftz filter=lfs diff=lfs merge=lfs -text
6
- *.gz filter=lfs diff=lfs merge=lfs -text
7
- *.h5 filter=lfs diff=lfs merge=lfs -text
8
- *.joblib filter=lfs diff=lfs merge=lfs -text
9
- *.lfs.* filter=lfs diff=lfs merge=lfs -text
10
- *.lz4 filter=lfs diff=lfs merge=lfs -text
11
- *.mlmodel filter=lfs diff=lfs merge=lfs -text
12
- *.model filter=lfs diff=lfs merge=lfs -text
13
- *.msgpack filter=lfs diff=lfs merge=lfs -text
14
- *.npy filter=lfs diff=lfs merge=lfs -text
15
- *.npz filter=lfs diff=lfs merge=lfs -text
16
- *.onnx filter=lfs diff=lfs merge=lfs -text
17
- *.ot filter=lfs diff=lfs merge=lfs -text
18
- *.parquet filter=lfs diff=lfs merge=lfs -text
19
- *.pb filter=lfs diff=lfs merge=lfs -text
20
- *.pickle filter=lfs diff=lfs merge=lfs -text
21
- *.pkl filter=lfs diff=lfs merge=lfs -text
22
- *.pt filter=lfs diff=lfs merge=lfs -text
23
- *.pth filter=lfs diff=lfs merge=lfs -text
24
- *.rar filter=lfs diff=lfs merge=lfs -text
25
- *.safetensors filter=lfs diff=lfs merge=lfs -text
26
- saved_model/**/* filter=lfs diff=lfs merge=lfs -text
27
- *.tar.* filter=lfs diff=lfs merge=lfs -text
28
- *.tflite filter=lfs diff=lfs merge=lfs -text
29
- *.tgz filter=lfs diff=lfs merge=lfs -text
30
- *.wasm filter=lfs diff=lfs merge=lfs -text
31
- *.xz filter=lfs diff=lfs merge=lfs -text
32
- *.zip filter=lfs diff=lfs merge=lfs -text
33
- *.zst filter=lfs diff=lfs merge=lfs -text
34
- *tfevents* filter=lfs diff=lfs merge=lfs -text
35
- # Audio files - uncompressed
36
- *.pcm filter=lfs diff=lfs merge=lfs -text
37
- *.sam filter=lfs diff=lfs merge=lfs -text
38
- *.raw filter=lfs diff=lfs merge=lfs -text
39
- # Audio files - compressed
40
- *.aac filter=lfs diff=lfs merge=lfs -text
41
- *.flac filter=lfs diff=lfs merge=lfs -text
42
- *.mp3 filter=lfs diff=lfs merge=lfs -text
43
- *.ogg filter=lfs diff=lfs merge=lfs -text
44
- *.wav filter=lfs diff=lfs merge=lfs -text
45
- # Image files - uncompressed
46
- *.bmp filter=lfs diff=lfs merge=lfs -text
47
- *.gif filter=lfs diff=lfs merge=lfs -text
48
- *.png filter=lfs diff=lfs merge=lfs -text
49
- *.tiff filter=lfs diff=lfs merge=lfs -text
50
- # Image files - compressed
51
- *.jpg filter=lfs diff=lfs merge=lfs -text
52
- *.jpeg filter=lfs diff=lfs merge=lfs -text
53
- *.webp filter=lfs diff=lfs merge=lfs -text
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
README.md DELETED
@@ -1,77 +0,0 @@
1
- ---
2
- language:
3
- - en
4
- dataset_info:
5
- - config_name: card-detection
6
- features:
7
- - name: image_id
8
- dtype: int64
9
- - name: image
10
- dtype: image
11
- - name: width
12
- dtype: int32
13
- - name: height
14
- dtype: int32
15
- - name: objects
16
- list:
17
- - name: category_id
18
- dtype:
19
- class_label:
20
- names:
21
- 0: boxed
22
- 1: grid
23
- 2: spread
24
- 3: stack
25
- - name: image_id
26
- dtype: string
27
- - name: id
28
- dtype: int64
29
- - name: area
30
- dtype: int64
31
- - name: bbox
32
- sequence: float32
33
- length: 4
34
- - name: iscrowd
35
- dtype: bool
36
- splits:
37
- - name: train
38
- download_size: 96890427
39
- dataset_size: 0
40
- - config_name: display-detection
41
- features:
42
- - name: image_id
43
- dtype: int64
44
- - name: image
45
- dtype: image
46
- - name: width
47
- dtype: int32
48
- - name: height
49
- dtype: int32
50
- - name: objects
51
- list:
52
- - name: category_id
53
- dtype:
54
- class_label:
55
- names:
56
- 0: boxed
57
- 1: grid
58
- 2: spread
59
- 3: stack
60
- - name: image_id
61
- dtype: string
62
- - name: id
63
- dtype: int64
64
- - name: area
65
- dtype: int64
66
- - name: bbox
67
- sequence: float32
68
- length: 4
69
- - name: iscrowd
70
- dtype: bool
71
- splits:
72
- - name: train
73
- num_bytes: 42942
74
- num_examples: 154
75
- download_size: 96967919
76
- dataset_size: 42942
77
- ---
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
card_display_v1.py DELETED
@@ -1,166 +0,0 @@
1
- # Copyright 2022 Daniel van Strien.
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
- """Card Display Detection"""
15
-
16
- import collections
17
- import json
18
- import os
19
- from typing import Any, Dict, List
20
- import pandas as pd
21
- import datasets
22
-
23
- _CITATION = """Connor Hoehn"""
24
-
25
- _DESCRIPTION = "This dataset comprises of card display images from the public domain"
26
-
27
- _HOMEPAGE = "https://www.connorhoehn.com"
28
-
29
- _LICENSE = "Public Domain Mark 1.0"
30
-
31
- _DATASET_URL = "https://www.connorhoehn.com/object_detection_dataset_v2.zip"
32
-
33
- _CATEGORIES = ["boxed","grid","spread","stack"]
34
-
35
- class CardDisplayDetectorConfig(datasets.BuilderConfig):
36
- """BuilderConfig for card display dataset."""
37
-
38
- def __init__(self, name, **kwargs):
39
-
40
- super(CardDisplayDetectorConfig, self).__init__(
41
- version=datasets.Version("1.0.0"),
42
- name=name,
43
- description="Card Display Detector",
44
- **kwargs,
45
- )
46
-
47
-
48
- class CardDisplayDetector(datasets.GeneratorBasedBuilder):
49
- """Card Display dataset."""
50
-
51
- BUILDER_CONFIGS = [
52
- CardDisplayDetectorConfig("display-detection"),
53
- ]
54
-
55
- def _info(self):
56
-
57
- features = datasets.Features(
58
- {
59
- "image_id": datasets.Value("int64"),
60
- "image": datasets.Image(),
61
- "width": datasets.Value("int32"),
62
- "height": datasets.Value("int32"),
63
- }
64
- )
65
- object_dict = {
66
- "category_id": datasets.ClassLabel(names=_CATEGORIES),
67
- "image_id": datasets.Value("string"),
68
- "id": datasets.Value("int64"),
69
- "area": datasets.Value("int64"),
70
- "bbox": datasets.Sequence(datasets.Value("float32"), length=4),
71
- "iscrowd": datasets.Value("bool"),
72
- }
73
- features["objects"] = [object_dict]
74
-
75
- return datasets.DatasetInfo(
76
- description=_DESCRIPTION,
77
- features=features,
78
- homepage=_HOMEPAGE,
79
- license=_LICENSE,
80
- citation=_CITATION,
81
- )
82
-
83
-
84
-
85
- def _split_generators(self, dl_manager):
86
-
87
- dataset_zip = dl_manager.download_and_extract(_DATASET_URL)
88
-
89
- return [
90
- datasets.SplitGenerator(
91
- name=datasets.Split.TRAIN,
92
- # COCO -> x.json, images/
93
- gen_kwargs={
94
- "annotations_file": os.path.join(dataset_zip, "result.json"),
95
- # Annotator indicated there was a folder named 1 that doesn't exist
96
- "image_dir": os.path.join(dataset_zip),
97
- },
98
- )
99
- ]
100
-
101
- # Return dictionary of unique image_ids that have multiple nested annotations
102
- def _get_image_id_to_annotations_mapping(self, annotations: List[Dict]) -> Dict[int, List[Dict[Any, Any]]]:
103
- """
104
- A helper function to build a mapping from image ids to annotations.
105
- """
106
- image_id_to_annotations = collections.defaultdict(list)
107
-
108
- for annotation in annotations:
109
-
110
- image_id_to_annotations[annotation["image_id"]].append(annotation)
111
-
112
- return image_id_to_annotations
113
-
114
-
115
- def _generate_examples(self, annotations_file, image_dir):
116
-
117
- def _image_info_to_example(image_info, image_dir):
118
-
119
- # from the annotation file
120
- image = image_info["file_name"]
121
-
122
- return {
123
- "image_id": image_info["id"],
124
- "image": os.path.join(image_dir, image),
125
- "width": image_info["width"],
126
- "height": image_info["height"],
127
- }
128
-
129
- with open(annotations_file, encoding="utf8") as annotation_json:
130
-
131
- annotation_data = json.load(annotation_json)
132
-
133
- images = annotation_data["images"]
134
-
135
- annotations = annotation_data["annotations"]
136
-
137
- # dictionary of image_ids with all related annotations (bbox)
138
- image_id_to_annotations = self._get_image_id_to_annotations_mapping(
139
- annotations
140
- )
141
-
142
- if self.config.name == "display-detection":
143
-
144
- # yield image_id, features
145
- for image_id, image_info in enumerate(images):
146
- #image_info -> (w,h,id,filename)
147
-
148
- image_details = _image_info_to_example(image_info, image_dir)
149
-
150
- # Get images unit id
151
- annotations = image_id_to_annotations[image_info["id"]]
152
-
153
- objects = []
154
-
155
- # Add the annotation information to the image details
156
- for annotation in annotations:
157
-
158
- del annotation['segmentation']
159
- del annotation['ignore']
160
-
161
- objects.append(annotation)
162
-
163
- # nested dictionary
164
- image_details["objects"] = objects
165
-
166
- yield (image_id, image_details)
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
display-detection/card_display_v1-train.parquet ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:e6be7b3735652aef98cde70e0cc607686dc91babb9feb64f26d7b57891d148e6
3
+ size 96497353
trainer_example.ipynb DELETED
@@ -1,34 +0,0 @@
1
- {
2
- "cells": [
3
- {
4
- "cell_type": "code",
5
- "execution_count": null,
6
- "id": "5a6c5d60-6e65-4a51-a0cf-81f96d540d05",
7
- "metadata": {},
8
- "outputs": [],
9
- "source": []
10
- }
11
- ],
12
- "metadata": {
13
- "instance_type": "ml.t3.medium",
14
- "kernelspec": {
15
- "display_name": "Python 3 (PyTorch 1.6 Python 3.6 CPU Optimized)",
16
- "language": "python",
17
- "name": "python3__SAGEMAKER_INTERNAL__arn:aws:sagemaker:us-east-1:081325390199:image/pytorch-1.6-cpu-py36-ubuntu16.04-v1"
18
- },
19
- "language_info": {
20
- "codemirror_mode": {
21
- "name": "ipython",
22
- "version": 3
23
- },
24
- "file_extension": ".py",
25
- "mimetype": "text/x-python",
26
- "name": "python",
27
- "nbconvert_exporter": "python",
28
- "pygments_lexer": "ipython3",
29
- "version": "3.6.13"
30
- }
31
- },
32
- "nbformat": 4,
33
- "nbformat_minor": 5
34
- }