dataset uploaded by roboflow2huggingface package
Browse files- README.dataset.txt +6 -0
- README.md +51 -0
- README.roboflow.txt +24 -0
- data/train.zip +3 -0
- data/valid.zip +3 -0
- gun-object-detection.py +114 -0
README.dataset.txt
ADDED
@@ -0,0 +1,6 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
# test > 2022-10-19 7:53pm
|
2 |
+
https://universe.roboflow.com/ashish-cuamw/test-y7rj3
|
3 |
+
|
4 |
+
Provided by a Roboflow user
|
5 |
+
License: CC BY 4.0
|
6 |
+
|
README.md
ADDED
@@ -0,0 +1,51 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
---
|
2 |
+
task_categories:
|
3 |
+
- object-detection
|
4 |
+
tags:
|
5 |
+
- roboflow
|
6 |
+
---
|
7 |
+
|
8 |
+
### Roboflow Dataset Page
|
9 |
+
https://universe.roboflow.com/ashish-cuamw/test-y7rj3
|
10 |
+
|
11 |
+
### Citation
|
12 |
+
```
|
13 |
+
@misc{ test-y7rj3_dataset,
|
14 |
+
title = { test Dataset },
|
15 |
+
type = { Open Source Dataset },
|
16 |
+
author = { ashish },
|
17 |
+
howpublished = { \\url{ https://universe.roboflow.com/ashish-cuamw/test-y7rj3 } },
|
18 |
+
url = { https://universe.roboflow.com/ashish-cuamw/test-y7rj3 },
|
19 |
+
journal = { Roboflow Universe },
|
20 |
+
publisher = { Roboflow },
|
21 |
+
year = { 2022 },
|
22 |
+
month = { oct },
|
23 |
+
note = { visited on 2022-12-28 },
|
24 |
+
}
|
25 |
+
```
|
26 |
+
|
27 |
+
### License
|
28 |
+
CC BY 4.0
|
29 |
+
|
30 |
+
### Dataset Summary
|
31 |
+
This dataset was exported via roboflow.com on December 26, 2022 at 10:13 PM GMT
|
32 |
+
|
33 |
+
Roboflow is an end-to-end computer vision platform that helps you
|
34 |
+
* collaborate with your team on computer vision projects
|
35 |
+
* collect & organize images
|
36 |
+
* understand unstructured image data
|
37 |
+
* annotate, and create datasets
|
38 |
+
* export, train, and deploy computer vision models
|
39 |
+
* use active learning to improve your dataset over time
|
40 |
+
|
41 |
+
It includes 4666 images.
|
42 |
+
T are annotated in COCO format.
|
43 |
+
|
44 |
+
The following pre-processing was applied to each image:
|
45 |
+
* Auto-orientation of pixel data (with EXIF-orientation stripping)
|
46 |
+
* Resize to 416x416 (Stretch)
|
47 |
+
|
48 |
+
No image augmentation techniques were applied.
|
49 |
+
|
50 |
+
|
51 |
+
|
README.roboflow.txt
ADDED
@@ -0,0 +1,24 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
|
2 |
+
test - v1 2022-10-19 7:53pm
|
3 |
+
==============================
|
4 |
+
|
5 |
+
This dataset was exported via roboflow.com on December 26, 2022 at 10:13 PM GMT
|
6 |
+
|
7 |
+
Roboflow is an end-to-end computer vision platform that helps you
|
8 |
+
* collaborate with your team on computer vision projects
|
9 |
+
* collect & organize images
|
10 |
+
* understand unstructured image data
|
11 |
+
* annotate, and create datasets
|
12 |
+
* export, train, and deploy computer vision models
|
13 |
+
* use active learning to improve your dataset over time
|
14 |
+
|
15 |
+
It includes 4666 images.
|
16 |
+
T are annotated in COCO format.
|
17 |
+
|
18 |
+
The following pre-processing was applied to each image:
|
19 |
+
* Auto-orientation of pixel data (with EXIF-orientation stripping)
|
20 |
+
* Resize to 416x416 (Stretch)
|
21 |
+
|
22 |
+
No image augmentation techniques were applied.
|
23 |
+
|
24 |
+
|
data/train.zip
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:b411ecb8ca9f4d54f3a1fb1899db14832ccef2f3c44c910ffaa1f2649d87fe79
|
3 |
+
size 73680397
|
data/valid.zip
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:d676264a3e040a71eb58ea71a4cd16391537c9eef84531df3d198311a1d86723
|
3 |
+
size 18650193
|
gun-object-detection.py
ADDED
@@ -0,0 +1,114 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
import collections
|
2 |
+
import json
|
3 |
+
import os
|
4 |
+
|
5 |
+
import datasets
|
6 |
+
|
7 |
+
|
8 |
+
_HOMEPAGE = "https://universe.roboflow.com/ashish-cuamw/test-y7rj3"
|
9 |
+
_LICENSE = "CC BY 4.0"
|
10 |
+
_CITATION = """\
|
11 |
+
@misc{ test-y7rj3_dataset,
|
12 |
+
title = { test Dataset },
|
13 |
+
type = { Open Source Dataset },
|
14 |
+
author = { ashish },
|
15 |
+
howpublished = { \\url{ https://universe.roboflow.com/ashish-cuamw/test-y7rj3 } },
|
16 |
+
url = { https://universe.roboflow.com/ashish-cuamw/test-y7rj3 },
|
17 |
+
journal = { Roboflow Universe },
|
18 |
+
publisher = { Roboflow },
|
19 |
+
year = { 2022 },
|
20 |
+
month = { oct },
|
21 |
+
note = { visited on 2022-12-28 },
|
22 |
+
}
|
23 |
+
"""
|
24 |
+
_URLS = {
|
25 |
+
"train": "https://huggingface.co/datasets/fcakyon/gun-object-detection/resolve/main/data/train.zip",
|
26 |
+
"validation": "https://huggingface.co/datasets/fcakyon/gun-object-detection/resolve/main/data/valid.zip",
|
27 |
+
}
|
28 |
+
|
29 |
+
_CATEGORIES = ['rifle', 'pistol', 'grenade', 'knife']
|
30 |
+
_ANNOTATION_FILENAME = "_annotations.coco.json"
|
31 |
+
|
32 |
+
|
33 |
+
class GUNOBJECTDETECTION(datasets.GeneratorBasedBuilder):
|
34 |
+
VERSION = datasets.Version("1.0.0")
|
35 |
+
|
36 |
+
def _info(self):
|
37 |
+
features = datasets.Features(
|
38 |
+
{
|
39 |
+
"image_id": datasets.Value("int64"),
|
40 |
+
"image": datasets.Image(),
|
41 |
+
"width": datasets.Value("int32"),
|
42 |
+
"height": datasets.Value("int32"),
|
43 |
+
"objects": datasets.Sequence(
|
44 |
+
{
|
45 |
+
"id": datasets.Value("int64"),
|
46 |
+
"area": datasets.Value("int64"),
|
47 |
+
"bbox": datasets.Sequence(datasets.Value("float32"), length=4),
|
48 |
+
"category": datasets.ClassLabel(names=_CATEGORIES),
|
49 |
+
}
|
50 |
+
),
|
51 |
+
}
|
52 |
+
)
|
53 |
+
return datasets.DatasetInfo(
|
54 |
+
features=features,
|
55 |
+
homepage=_HOMEPAGE,
|
56 |
+
citation=_CITATION,
|
57 |
+
license=_LICENSE,
|
58 |
+
)
|
59 |
+
|
60 |
+
def _split_generators(self, dl_manager):
|
61 |
+
data_files = dl_manager.download_and_extract(_URLS)
|
62 |
+
return [
|
63 |
+
datasets.SplitGenerator(
|
64 |
+
name=datasets.Split.TRAIN,
|
65 |
+
gen_kwargs={
|
66 |
+
"folder_dir": data_files["train"],
|
67 |
+
},
|
68 |
+
),
|
69 |
+
datasets.SplitGenerator(
|
70 |
+
name=datasets.Split.TEST,
|
71 |
+
gen_kwargs={
|
72 |
+
"folder_dir": data_files["validation"],
|
73 |
+
},
|
74 |
+
),
|
75 |
+
]
|
76 |
+
|
77 |
+
def _generate_examples(self, folder_dir):
|
78 |
+
def process_annot(annot, category_id_to_category):
|
79 |
+
return {
|
80 |
+
"id": annot["id"],
|
81 |
+
"area": annot["area"],
|
82 |
+
"bbox": annot["bbox"],
|
83 |
+
"category": category_id_to_category[annot["category_id"]],
|
84 |
+
}
|
85 |
+
|
86 |
+
image_id_to_image = {}
|
87 |
+
idx = 0
|
88 |
+
|
89 |
+
annotation_filepath = os.path.join(folder_dir, _ANNOTATION_FILENAME)
|
90 |
+
with open(annotation_filepath, "r") as f:
|
91 |
+
annotations = json.load(f)
|
92 |
+
category_id_to_category = {category["id"]: category["name"] for category in annotations["categories"]}
|
93 |
+
image_id_to_annotations = collections.defaultdict(list)
|
94 |
+
for annot in annotations["annotations"]:
|
95 |
+
image_id_to_annotations[annot["image_id"]].append(annot)
|
96 |
+
image_id_to_image = {annot["file_name"]: annot for annot in annotations["images"]}
|
97 |
+
|
98 |
+
for filename in os.listdir(folder_dir):
|
99 |
+
filepath = os.path.join(folder_dir, filename)
|
100 |
+
if filename in image_id_to_image:
|
101 |
+
image = image_id_to_image[filename]
|
102 |
+
objects = [
|
103 |
+
process_annot(annot, category_id_to_category) for annot in image_id_to_annotations[image["id"]]
|
104 |
+
]
|
105 |
+
with open(filepath, "rb") as f:
|
106 |
+
image_bytes = f.read()
|
107 |
+
yield idx, {
|
108 |
+
"image_id": image["id"],
|
109 |
+
"image": {"path": filepath, "bytes": image_bytes},
|
110 |
+
"width": image["width"],
|
111 |
+
"height": image["height"],
|
112 |
+
"objects": objects,
|
113 |
+
}
|
114 |
+
idx += 1
|