keremberke commited on
Commit
a19eace
1 Parent(s): bb6e2a1

dataset uploaded by roboflow2huggingface package

Browse files
README.md CHANGED
@@ -3,12 +3,62 @@ task_categories:
3
  - object-detection
4
  tags:
5
  - roboflow
 
 
 
 
 
 
 
 
 
 
 
 
 
 
6
  ---
7
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
8
  ### Roboflow Dataset Page
9
- [https://universe.roboflow.com/roboflow-universe-projects/construction-site-safety](https://universe.roboflow.com/roboflow-universe-projects/construction-site-safety?ref=roboflow2huggingface)
10
 
11
  ### Citation
 
12
  ```
13
  @misc{ construction-site-safety_dataset,
14
  title = { Construction Site Safety Dataset },
@@ -18,9 +68,9 @@ tags:
18
  url = { https://universe.roboflow.com/roboflow-universe-projects/construction-site-safety },
19
  journal = { Roboflow Universe },
20
  publisher = { Roboflow },
21
- year = { 2022 },
22
- month = { dec },
23
- note = { visited on 2022-12-29 },
24
  }
25
  ```
26
 
 
3
  - object-detection
4
  tags:
5
  - roboflow
6
+ - roboflow2huggingface
7
+ - Construction
8
+ - Logistics
9
+ - Utilities
10
+ - Damage Risk
11
+ - Ppe
12
+ - Construction
13
+ - Utilities
14
+ - Manufacturing
15
+ - Logistics
16
+ - Ppe
17
+ - Assembly Line
18
+ - Warehouse
19
+ - Factory
20
  ---
21
 
22
+ <div align="center">
23
+ <img width="640" alt="keremberke/construction-safety-object-detection" src="https://huggingface.co/datasets/keremberke/construction-safety-object-detection/resolve/main/thumbnail.jpg">
24
+ </div>
25
+
26
+ ### Dataset Labels
27
+
28
+ ```
29
+ ['barricade', 'dumpster', 'excavators', 'gloves', 'hardhat', 'mask', 'no-hardhat', 'no-mask', 'no-safety vest', 'person', 'safety net', 'safety shoes', 'safety vest', 'dump truck', 'mini-van', 'truck', 'wheel loader']
30
+ ```
31
+
32
+
33
+ ### Number of Images
34
+
35
+ ```json
36
+ {'train': 307, 'valid': 57, 'test': 34}
37
+ ```
38
+
39
+
40
+ ### How to Use
41
+
42
+ - Install [datasets](https://pypi.org/project/datasets/):
43
+
44
+ ```bash
45
+ pip install datasets
46
+ ```
47
+
48
+ - Load the dataset:
49
+
50
+ ```python
51
+ from datasets import load_dataset
52
+
53
+ ds = load_dataset("keremberke/construction-safety-object-detection", name="full")
54
+ example = ds['train'][0]
55
+ ```
56
+
57
  ### Roboflow Dataset Page
58
+ [https://universe.roboflow.com/roboflow-universe-projects/construction-site-safety/dataset/1](https://universe.roboflow.com/roboflow-universe-projects/construction-site-safety/dataset/1?ref=roboflow2huggingface)
59
 
60
  ### Citation
61
+
62
  ```
63
  @misc{ construction-site-safety_dataset,
64
  title = { Construction Site Safety Dataset },
 
68
  url = { https://universe.roboflow.com/roboflow-universe-projects/construction-site-safety },
69
  journal = { Roboflow Universe },
70
  publisher = { Roboflow },
71
+ year = { 2023 },
72
+ month = { jan },
73
+ note = { visited on 2023-01-26 },
74
  }
75
  ```
76
 
construction-safety-object-detection.py CHANGED
@@ -5,7 +5,7 @@ import os
5
  import datasets
6
 
7
 
8
- _HOMEPAGE = "https://universe.roboflow.com/roboflow-universe-projects/construction-site-safety"
9
  _LICENSE = "CC BY 4.0"
10
  _CITATION = """\
11
  @misc{ construction-site-safety_dataset,
@@ -16,23 +16,54 @@ _CITATION = """\
16
  url = { https://universe.roboflow.com/roboflow-universe-projects/construction-site-safety },
17
  journal = { Roboflow Universe },
18
  publisher = { Roboflow },
19
- year = { 2022 },
20
- month = { dec },
21
- note = { visited on 2022-12-29 },
22
  }
23
  """
24
- _URLS = {
25
- "train": "https://huggingface.co/datasets/keremberke/construction-safety-object-detection/resolve/main/data/train.zip",
26
- "validation": "https://huggingface.co/datasets/keremberke/construction-safety-object-detection/resolve/main/data/valid.zip",
27
- "test": "https://huggingface.co/datasets/keremberke/construction-safety-object-detection/resolve/main/data/test.zip",
28
- }
29
-
30
- _CATEGORIES = ['Barricade', 'Dumpster', 'EXCAVATORS', 'Gloves', 'Hardhat', 'Mask', 'NO-Hardhat', 'NO-Mask', 'NO-Safety Vest', 'Person', 'Safety Net', 'Safety Shoes', 'Safety Vest', 'dump truck', 'mini-van', 'truck', 'wheel loader']
31
  _ANNOTATION_FILENAME = "_annotations.coco.json"
32
 
33
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
34
  class CONSTRUCTIONSAFETYOBJECTDETECTION(datasets.GeneratorBasedBuilder):
 
 
35
  VERSION = datasets.Version("1.0.0")
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
36
 
37
  def _info(self):
38
  features = datasets.Features(
@@ -59,7 +90,7 @@ class CONSTRUCTIONSAFETYOBJECTDETECTION(datasets.GeneratorBasedBuilder):
59
  )
60
 
61
  def _split_generators(self, dl_manager):
62
- data_files = dl_manager.download_and_extract(_URLS)
63
  return [
64
  datasets.SplitGenerator(
65
  name=datasets.Split.TRAIN,
@@ -92,7 +123,7 @@ class CONSTRUCTIONSAFETYOBJECTDETECTION(datasets.GeneratorBasedBuilder):
92
 
93
  image_id_to_image = {}
94
  idx = 0
95
-
96
  annotation_filepath = os.path.join(folder_dir, _ANNOTATION_FILENAME)
97
  with open(annotation_filepath, "r") as f:
98
  annotations = json.load(f)
@@ -100,12 +131,12 @@ class CONSTRUCTIONSAFETYOBJECTDETECTION(datasets.GeneratorBasedBuilder):
100
  image_id_to_annotations = collections.defaultdict(list)
101
  for annot in annotations["annotations"]:
102
  image_id_to_annotations[annot["image_id"]].append(annot)
103
- image_id_to_image = {annot["file_name"]: annot for annot in annotations["images"]}
104
 
105
  for filename in os.listdir(folder_dir):
106
  filepath = os.path.join(folder_dir, filename)
107
- if filename in image_id_to_image:
108
- image = image_id_to_image[filename]
109
  objects = [
110
  process_annot(annot, category_id_to_category) for annot in image_id_to_annotations[image["id"]]
111
  ]
 
5
  import datasets
6
 
7
 
8
+ _HOMEPAGE = "https://universe.roboflow.com/roboflow-universe-projects/construction-site-safety/dataset/1"
9
  _LICENSE = "CC BY 4.0"
10
  _CITATION = """\
11
  @misc{ construction-site-safety_dataset,
 
16
  url = { https://universe.roboflow.com/roboflow-universe-projects/construction-site-safety },
17
  journal = { Roboflow Universe },
18
  publisher = { Roboflow },
19
+ year = { 2023 },
20
+ month = { jan },
21
+ note = { visited on 2023-01-26 },
22
  }
23
  """
24
+ _CATEGORIES = ['barricade', 'dumpster', 'excavators', 'gloves', 'hardhat', 'mask', 'no-hardhat', 'no-mask', 'no-safety vest', 'person', 'safety net', 'safety shoes', 'safety vest', 'dump truck', 'mini-van', 'truck', 'wheel loader']
 
 
 
 
 
 
25
  _ANNOTATION_FILENAME = "_annotations.coco.json"
26
 
27
 
28
+ class CONSTRUCTIONSAFETYOBJECTDETECTIONConfig(datasets.BuilderConfig):
29
+ """Builder Config for construction-safety-object-detection"""
30
+
31
+ def __init__(self, data_urls, **kwargs):
32
+ """
33
+ BuilderConfig for construction-safety-object-detection.
34
+
35
+ Args:
36
+ data_urls: `dict`, name to url to download the zip file from.
37
+ **kwargs: keyword arguments forwarded to super.
38
+ """
39
+ super(CONSTRUCTIONSAFETYOBJECTDETECTIONConfig, self).__init__(version=datasets.Version("1.0.0"), **kwargs)
40
+ self.data_urls = data_urls
41
+
42
+
43
  class CONSTRUCTIONSAFETYOBJECTDETECTION(datasets.GeneratorBasedBuilder):
44
+ """construction-safety-object-detection object detection dataset"""
45
+
46
  VERSION = datasets.Version("1.0.0")
47
+ BUILDER_CONFIGS = [
48
+ CONSTRUCTIONSAFETYOBJECTDETECTIONConfig(
49
+ name="full",
50
+ description="Full version of construction-safety-object-detection dataset.",
51
+ data_urls={
52
+ "train": "https://huggingface.co/datasets/keremberke/construction-safety-object-detection/resolve/main/data/train.zip",
53
+ "validation": "https://huggingface.co/datasets/keremberke/construction-safety-object-detection/resolve/main/data/valid.zip",
54
+ "test": "https://huggingface.co/datasets/keremberke/construction-safety-object-detection/resolve/main/data/test.zip",
55
+ },
56
+ ),
57
+ CONSTRUCTIONSAFETYOBJECTDETECTIONConfig(
58
+ name="mini",
59
+ description="Mini version of construction-safety-object-detection dataset.",
60
+ data_urls={
61
+ "train": "https://huggingface.co/datasets/keremberke/construction-safety-object-detection/resolve/main/data/valid-mini.zip",
62
+ "validation": "https://huggingface.co/datasets/keremberke/construction-safety-object-detection/resolve/main/data/valid-mini.zip",
63
+ "test": "https://huggingface.co/datasets/keremberke/construction-safety-object-detection/resolve/main/data/valid-mini.zip",
64
+ },
65
+ )
66
+ ]
67
 
68
  def _info(self):
69
  features = datasets.Features(
 
90
  )
91
 
92
  def _split_generators(self, dl_manager):
93
+ data_files = dl_manager.download_and_extract(self.config.data_urls)
94
  return [
95
  datasets.SplitGenerator(
96
  name=datasets.Split.TRAIN,
 
123
 
124
  image_id_to_image = {}
125
  idx = 0
126
+
127
  annotation_filepath = os.path.join(folder_dir, _ANNOTATION_FILENAME)
128
  with open(annotation_filepath, "r") as f:
129
  annotations = json.load(f)
 
131
  image_id_to_annotations = collections.defaultdict(list)
132
  for annot in annotations["annotations"]:
133
  image_id_to_annotations[annot["image_id"]].append(annot)
134
+ filename_to_image = {image["file_name"]: image for image in annotations["images"]}
135
 
136
  for filename in os.listdir(folder_dir):
137
  filepath = os.path.join(folder_dir, filename)
138
+ if filename in filename_to_image:
139
+ image = filename_to_image[filename]
140
  objects = [
141
  process_annot(annot, category_id_to_category) for annot in image_id_to_annotations[image["id"]]
142
  ]
data/test.zip CHANGED
@@ -1,3 +1,3 @@
1
  version https://git-lfs.github.com/spec/v1
2
- oid sha256:2d580d8d6df74dd5f2cb1bfb781adc809a49c5b39cea9a6955b4ab77a1e8694c
3
- size 1796485
 
1
  version https://git-lfs.github.com/spec/v1
2
+ oid sha256:a093df4fb69d7e6618671a20a6317960edf2f5c49b2658928b87e6e6c27f4bbf
3
+ size 1796467
data/train.zip CHANGED
@@ -1,3 +1,3 @@
1
  version https://git-lfs.github.com/spec/v1
2
- oid sha256:e06ac9d010880131edc2d460bf2669f6609d02626b0348d07a0c31f8f3e8f0f0
3
- size 22259666
 
1
  version https://git-lfs.github.com/spec/v1
2
+ oid sha256:84216c88ae301de89856d002d4aea79737bd21ca2788c343299aafc620c26e79
3
+ size 22259647
data/valid-mini.zip ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:9af740b8be10400f8d23da2f593335570979b81a746a1d3a96e8a9fcc757aebd
3
+ size 166069
data/valid.zip CHANGED
@@ -1,3 +1,3 @@
1
  version https://git-lfs.github.com/spec/v1
2
- oid sha256:545f0da25bb34805b2b198aedadc702793fb102d791157e9d1cead170be26594
3
- size 3338812
 
1
  version https://git-lfs.github.com/spec/v1
2
+ oid sha256:7332feb6f5abd953e579d71f5b450b1cde4976d0aa8eb5982cc2ca0db45a7935
3
+ size 3338795
split_name_to_num_samples.json ADDED
@@ -0,0 +1 @@
 
 
1
+ {"train": 307, "valid": 57, "test": 34}
thumbnail.jpg ADDED

Git LFS Details

  • SHA256: 1311a7677c3dfe3853e2a3725a8683dc56973b5fb067f577104c078fb2e0f891
  • Pointer size: 131 Bytes
  • Size of remote file: 166 kB