├── requirements.txt
├── labels.zip
├── assert
└── example.png
├── configs
├── imagelist.npy
├── imagelist_10flod.npy
└── videolist.txt
├── labels_only_gun.zip
├── YouTube-GDD_test_labels.zip
├── tools
├── select_video.py
├── extract.py
└── download.py
├── LICENSE
└── README.md
/requirements.txt:
--------------------------------------------------------------------------------
1 | numpy~=2.0
2 | yt_dlp
--------------------------------------------------------------------------------
/labels.zip:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/UCAS-GYX/YouTube-GDD/HEAD/labels.zip
--------------------------------------------------------------------------------
/assert/example.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/UCAS-GYX/YouTube-GDD/HEAD/assert/example.png
--------------------------------------------------------------------------------
/configs/imagelist.npy:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/UCAS-GYX/YouTube-GDD/HEAD/configs/imagelist.npy
--------------------------------------------------------------------------------
/labels_only_gun.zip:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/UCAS-GYX/YouTube-GDD/HEAD/labels_only_gun.zip
--------------------------------------------------------------------------------
/YouTube-GDD_test_labels.zip:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/UCAS-GYX/YouTube-GDD/HEAD/YouTube-GDD_test_labels.zip
--------------------------------------------------------------------------------
/configs/imagelist_10flod.npy:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/UCAS-GYX/YouTube-GDD/HEAD/configs/imagelist_10flod.npy
--------------------------------------------------------------------------------
/tools/select_video.py:
--------------------------------------------------------------------------------
1 | import argparse
2 | import os
3 | import shutil
4 | import numpy as np
5 |
6 | parser = argparse.ArgumentParser(description='Select YouTube-GDD images')
7 | parser.add_argument('--imagelist', default='./configs/imagelist.npy')
8 | parser.add_argument('--framepath', default='frames')
9 | parser.add_argument('--imagepath', default='images')
10 |
11 | args = parser.parse_args()
12 | if __name__ == '__main__':
13 | dic = np.load(args.imagelist,allow_pickle=True).item()
14 | for set in ["train","val","test"]:
15 | if not os.path.exists(os.path.join(args.imagepath,set)):
16 | os.mkdir(os.path.join(args.imagepath,set))
17 | for set in ["train", "val", "test"]:
18 | dist_root = os.path.join(args.imagepath,set)
19 | for image in dic[set]:
20 | source_path = os.path.join(args.framepath,image)
21 | if os.path.exists(source_path):
22 | shutil.copy(source_path,os.path.join(dist_root,image))
--------------------------------------------------------------------------------
/tools/extract.py:
--------------------------------------------------------------------------------
1 | import argparse
2 | import os
3 | import cv2
4 | import math
5 |
6 | parser = argparse.ArgumentParser(description='Extract YouTube frames')
7 | parser.add_argument('--videopath', default='videos')
8 | parser.add_argument('--framepath', default='frames')
9 |
10 |
11 | def extract_frames(video_path, dst_folder, extract_frequency, abstract_name, frame_rate, index):
12 | video = cv2.VideoCapture()
13 | if not video.open(video_path):
14 | print("can not open the video")
15 | exit(1)
16 | count = 1
17 | while True:
18 | _, frame = video.read()
19 | if frame is None:
20 | break
21 | if count % extract_frequency == 0:
22 | save_path = "{}/{}_{:2d}_{:2d}_{:>06d}.jpg".format(dst_folder, abstract_name, frame_rate, extract_frequency,
23 | index)
24 | cv2.imwrite(save_path, frame)
25 | index += 1
26 | count += 1
27 | video.release()
28 |
29 | args = parser.parse_args()
30 | if __name__ == '__main__':
31 | if not os.path.exists(args.framepath):
32 | os.mkdir(args.framepath)
33 | video_names = os.listdir(args.videopath)
34 | for video_name in video_names:
35 | video_path = os.path.join(args.videopath, video_name)
36 | abstract_name = video_name.split('.')[0]
37 | video_capture = cv2.VideoCapture(video_path)
38 | frame_rate = math.ceil(video_capture.get(5))
39 | extract_rate = frame_rate * 2
40 | extract_frames(video_path, args.framepath, extract_rate, abstract_name, frame_rate, 1)
--------------------------------------------------------------------------------
/tools/download.py:
--------------------------------------------------------------------------------
1 | import argparse
2 | import os
3 | from yt_dlp import YoutubeDL
4 |
5 | parser = argparse.ArgumentParser(description="Download YouTube videos with yt-dlp")
6 | parser.add_argument("--videolist", default="./configs/videolist.txt")
7 | parser.add_argument("--videopath", default="videos")
8 |
9 | args = parser.parse_args()
10 |
11 | def load_entries(path):
12 | with open(path, "r") as f:
13 | return [line.strip() for line in f if line.strip()]
14 |
15 | if __name__ == "__main__":
16 | os.makedirs(args.videopath, exist_ok=True)
17 |
18 | entries = load_entries(args.videolist)
19 | print(f"Found {len(entries)} entries in {args.videolist}")
20 | print(f"Saving videos to: {os.path.abspath(args.videopath)}")
21 |
22 | # yt-dlp options
23 | ydl_opts = {
24 | "format": "bv*+ba/b", # best video+audio, fallback to best
25 | "outtmpl": os.path.join(args.videopath, "%(id)s.%(ext)s"),
26 | "noplaylist": True,
27 | }
28 |
29 | success = 0
30 | with YoutubeDL(ydl_opts) as ydl:
31 | for i, entry in enumerate(entries, start=1):
32 | # allow IDs or full URLs
33 | if entry.startswith("http://") or entry.startswith("https://"):
34 | url = entry
35 | else:
36 | url = f"https://www.youtube.com/watch?v={entry}"
37 |
38 | print(f"\n[{i}/{len(entries)}] Downloading: {url!r}")
39 | try:
40 | ydl.download([url])
41 | success += 1
42 | except Exception as e:
43 | print(f" ❌ Error downloading {url}: {e}")
44 |
45 | print(f"\nFinished. Successfully downloaded: {success} / {len(entries)} videos.")
46 |
--------------------------------------------------------------------------------
/configs/videolist.txt:
--------------------------------------------------------------------------------
1 | QSUIFJzIX5s
2 | 6ZFpqyQ-QyY
3 | nMmEYYDznzc
4 | H3uU8MKc28g
5 | yvO4hdyyWa0
6 | A2vf4KuKepk
7 | 10IK7GTZ2q4
8 | Un2KUI8m4K4
9 | ln32ZHMY8c8
10 | x5FQudbGJ_U
11 | Za7faeNhbpw
12 | Cwglf21dg_U
13 | l-2maNktXKk
14 | iuNWPyKJmu8
15 | sc81bdNyLRA
16 | wSIQRt4ZCQw
17 | exmDIhG8tfQ
18 | jRYqv9J2aPE
19 | b1mWlHeEMN0
20 | eKw7RW3j60s
21 | zKSdnj2A7w0
22 | aE_w02SdjqI
23 | BdCT1btVze0
24 | 55MglhKhTwk
25 | 55Y0l0LQR6U
26 | c5KogvLTVPg
27 | llN33Z-aP_Y
28 | EtAOoWUTPAU
29 | gunNXngtOKo
30 | pYAvIHPUU7I
31 | 3tMcosaQrzc
32 | K_wDSdAb4NI
33 | lnzt9mijxLE
34 | LfAWlJ2qxKY
35 | lGTSxAUH_2g
36 | pTyPn3eo1ng
37 | HZRSvlAO2uw
38 | IzD7zYficNE
39 | U6WAOThWMz8
40 | SXL77TUGbDM
41 | fQTUg5EuzPg
42 | A3F1QvCHQLQ
43 | 12XRDTZWfVo
44 | GP7s1yW93aM
45 | AgCWQbwT-FM
46 | Nwb1qVeLmVc
47 | yv3m39GHA3o
48 | Eb5WLYItSTA
49 | DgGqfAmxTII
50 | ynMqhwm-waU
51 | wZX9MJVXLZY
52 | -zfMrjFI3-k
53 | hm5v6wcqNJA
54 | xKF2fiORD2g
55 | 6r219VR3iO8
56 | GdvN5irvUZY
57 | 6THIvvFsA3I
58 | -CoIhl3puuI
59 | m71dpQuqBjg
60 | GHdO2lelNVs
61 | 3kXNIoGUshs
62 | alj2hBm23Z0
63 | Nx38FIaAwkE
64 | CMp33tQrIa4
65 | q_HuYkhsNEc
66 | SIelWUBYhNM
67 | T_k7IbaLfA8
68 | oRGDT81hbg8
69 | rTmDIQMLXWE
70 | EjQrhDKDWFk
71 | R8K2lY6YThs
72 | Vz_2zPMiCao
73 | kXaC58UBaFU
74 | vpIEN4RhLmU
75 | KhN9eAUtBaE
76 | c9cZx-V7qI0
77 | gSzYTPXWXjI
78 | TwEzbI5dPaU
79 | hhUXBLEjKuA
80 | CKz8L6GA8iE
81 | a0TreznVfqE
82 | qL7u0uD56bI
83 | r31q0MOpWZ0
84 | FFJ9XJSA2Zo
85 | zZchVpkzcJQ
86 | hoMonVfm5q4
87 | oqFmQYNBwcw
88 | _q52OTCR1BM
89 | gYtovSp6ytc
90 | lNTTLEQyCQk
91 | cBb_eDYzTSA
92 | IWu4OaMzW6A
93 | pvGLOCog9HQ
94 | xo-cQpYA7EU
95 | OZBMKa15laA
96 | 6m4VzpV7fc8
97 | zoyzJjVEi7o
98 | SnPub8bkOQI
99 | C7IZNQ91kM4
100 | eT_mD-ITonc
101 | 44b9y66FR7A
102 | _5_p8O4w4A4
103 | oxOeh7BCoBg
104 | tasAi13pehA
105 | qpAlW6WnrZ0
106 | bhKz9v_Ntk8
107 | aid5YDI1ZSc
108 | IbyRIacdhts
109 | MhAVaN4b28w
110 | MOIXahAWn2E
111 | CSEzRgpE4OI
112 | MIab2GdQkE8
113 | wlHyGVg8lIA
114 | aXHoSJMJHy4
115 | eegS7qDaGPQ
116 | _JKqzJ1Jb9g
117 | vhalyNjtDSI
118 | GG7K0pD3ByE
119 | QgFxgTvmE0w
120 | -SQEDs7mOQo
121 | stn9nOucNpk
122 | q3g-5uJBZ4A
123 | QXXnGRjOJVc
124 | 5JJ3UPUdxPo
125 | 1Fd6R8UPAwg
126 | ak-QH9x8Hcc
127 | NyokurZ4cCo
128 | qaPY7I5VO2I
129 | KOz5IJlvDJg
130 | rQSM6heU-p4
131 | RTsxRJ20Kfw
132 | O36UzaP9O1c
133 | WxXcaWg-6_E
134 | I5g2gbOPrYU
135 | qRCHokTdQbk
136 | h4ESNfY1SuU
137 | STfT04CUOis
138 | 9PivSAUTAto
139 | 7H9RtvLyATs
140 | RRCA9ydwuVM
141 | mwxqgLMtt5o
142 | tLxnNP-ycVQ
143 | eoYyk7qUpjY
144 | ddP7IHHnM4A
145 | zdtjGAUK5M4
146 | jNXH0TLE7-A
147 | 4zJN_jpj7p4
148 | tO3cr7_we7k
149 | WkiLiugHGZc
150 | lGfTX7q3nWk
151 | NGO4q-EuQoc
152 | RsZ1Aen4mpE
153 | F1tgkdxCo20
154 | t36L_B_Yuhc
155 | 4liVo8_scKU
156 | oRQ_yRrVjxE
157 | 1uylLbpSe9M
158 | bmeRROzi_4k
159 | OqyKOE5Z0Sk
160 | TNKKC4ew1Xk
161 | 0k-qSbkdqQE
162 | xmeD4doJcws
163 | t3Mape_d3lw
164 | PttQ2BwWByA
165 | VHeCv1lD3o8
166 | _G-ykYxVe4Q
167 | tNZW0z_kf-4
168 | 4CIKoUDJlzk
169 | Oh-Fg57mEsY
170 | iAH3_GSkN4M
171 | thFQ6trxz0E
172 | JpRvVwO07Ao
173 | aragC6k9-SA
174 | 3a_U9C5WD4A
175 | 0kRe9QTdsSo
176 | np_UEMVFFXM
177 | jYibVsp8N0U
178 | _bXNMohWGag
179 | XcEb0yd9O0U
180 | Pgx2sQ5NFhc
181 | vVRPGSz7XXU
182 | xEXYYqpEVDU
183 | 1NAAnu_tSK8
184 | J37evpYs28M
185 | Cc1jPzN4AsI
186 | OtgQC2gwmlA
187 | TI5Calqm6_M
188 | suZAWeZffjk
189 | 1T7zZ_D8nqI
190 | 2jk5E5ltfgU
191 | WoPmGFC28Ug
192 | HeTU5BKZye8
193 | HPHDosjGGWg
194 | -fZwuBddAc4
195 | 0aej6_ZR0HI
196 | V5vmnWN8-aY
197 | sWAA_kJj3Pk
198 | SeIJqR78hbc
199 | KfsepJqSUtU
200 | G7JPKTcP2YQ
201 | Jert1J5494U
202 | xzLKHJ6BoZY
203 | xbEKAlskoko
204 | zSMWD_nihOE
205 | kDXQB94TilA
206 | TY6oDRcgODg
207 | kUmgZpKth-c
208 | p0E2KItDLE8
209 | jlZv6TVmGB4
210 | bkP4toPB9LE
211 | PNWsflgn8JU
212 | 4sd5PEJxGeE
213 | pbtKYzQk4j0
214 | aCOMjyhXCss
215 | pAoYi_eeVO4
216 | GQdZq0m3zzY
217 | sswUxWbacZA
218 | ZN-XRHh2rTM
219 | OezqQ8ppnJo
220 | EzcbLGmVZVg
221 | GDWKRdJOtV0
222 | tPNS4vUlX60
223 | e_X1hHmnv14
224 | odh3faRGvaQ
225 | suUf-hj2EL0
226 | 29aLEnKvSAA
227 | oHhgGFxj7aE
228 | qLDnyrs8pfg
229 | Mo3AgWr1VyY
230 | dj8oApIGugQ
231 | i_7DRpgsgJg
232 | ugzFkBaoeOk
233 | uJDT_PP1MT0
234 | YBDi3yTV0Ts
235 | 03GmcoorLi4
236 | ux8UOIDTzws
237 | BzNm3R2Qvhk
238 | CbBndkxibNo
239 | yVSA-RzOh4Q
240 | e5KzAA7JME4
241 | fj5Aq7bz-tI
242 | sZv9L4WLok4
243 | bNHXwFThE-c
244 | veTA_NumvYI
245 | PxZy3Nd9zUc
246 | nw7T-MAydb8
247 | OSOpvoUTO6A
248 | 9cvI0C-sHRg
249 | 7xZ4BV9nK7Y
250 | JOAW3X0-WEo
251 | dfYeDx5BzfU
252 | b0vpzpjKVsw
253 | xp1obnNeO34
254 | XYAULjXuEuw
255 | vvqYSmf7pyA
256 | J0Qd7ghAWYw
257 | ULzsYVV2kDQ
258 | b_iTZ98FxHM
259 | RotN2xhK4iA
260 | S6urHUxweKE
261 | n70jVKYk8e4
262 | le7OUe4o97I
263 | rN8-Uelm25s
264 | HChWbkzG-rc
265 | NU539JwyHZ8
266 | YdfRA3rxn98
267 | 0V5KlLqT_jk
268 | v9Vh-o-nnCE
269 | oENkG1UULT8
270 | n-O5mnscPQE
271 | 2BrOkge7RHg
272 | bwnymjMUFp8
273 | SjNdRr7OXjs
274 | g2BxHZCvquQ
275 | OBhlwsv0gFA
276 | sWz5LvT-FA8
277 | AtbZ5P34V1A
278 | pN-29kka7SQ
279 | 8pB7R252NNo
280 | ByPQ3YIfX5Q
281 | WGZyGkdNQVw
282 | t1adId2zTnQ
283 | gmpvx5ke5Q0
284 | ZbPiLqKVDYk
285 | uycldbktk_Q+
286 | J4L5brq46Qo
287 | ixUKPsUwzDU
288 | 8Z3HkOP-jT0
289 | IV0TpHM3TOU
290 | 3ht89CbHyYg
291 | LBKE3x44mXw
292 | MYHHHTVrGt4
293 | DconsfGsXyA
294 | dR5wyIlPI48
295 | sfBfQfKfgXw
296 | wsCO0XV5rwA
297 | NLHLXy1gWPg
298 | q9El7gEvJWU
299 | x8LdCzIc4Vw
300 | qGUAylng068
301 | eR5Fr49bPtM
302 | 6zQe0PWuyME
303 | _Dvzxm6e2BY
304 | CfsdP88eQTI
305 | 2NtyOEoLn1I
306 | tcrD-EGteks
307 | 1yQz7Adq2Ds
308 | z-tBm2U0V4g
309 | x3rkw6kldgs
310 | mYNdsFT_QIc
311 | FPsIx8GmKxg
312 | DFPE6x0wi4Q
313 | xTObdi3R1-I
314 | zgYkgq3NzzQ
315 | 2FiBkfmUZR4
316 | 4GgE9nRPe1o
317 | c8ZHLdWuNYs
318 | 1Gx2hXEvNQk
319 | Xrfrf4NpZGU
320 | dzzNEEsYjL0
321 | 2mEnSmpi0Vw
322 | akVvzli98nA
323 | lYFuhwE9aV4
324 | VXriBkaRi1A
325 | 43OQob_7ER4
326 | Inimp_5CkCw
327 | u68lbkhUC-w
328 | QW5oYlmc5-g
329 | aljJ2jPTa1c
330 | jsiSK4nTJgc
331 | 53YvPEhFqSU
332 | tY1cP0Rnc2k
333 | aFxo4uCFWhY
334 | jd3eQFa3Udo
335 | ZieinpwMLR8
336 | rR0G-FBdrU8
337 | 7CawCgthLPs
338 | vxixM0eayp4
339 | draji59ckJY
340 | Z5sRkxk-v0k
341 | Cf_G4Yot2tg
342 | lR_oshbhII8
343 | wro3niO4aYQ
--------------------------------------------------------------------------------
/LICENSE:
--------------------------------------------------------------------------------
1 | Apache License
2 | Version 2.0, January 2004
3 | http://www.apache.org/licenses/
4 |
5 | TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
6 |
7 | 1. Definitions.
8 |
9 | "License" shall mean the terms and conditions for use, reproduction,
10 | and distribution as defined by Sections 1 through 9 of this document.
11 |
12 | "Licensor" shall mean the copyright owner or entity authorized by
13 | the copyright owner that is granting the License.
14 |
15 | "Legal Entity" shall mean the union of the acting entity and all
16 | other entities that control, are controlled by, or are under common
17 | control with that entity. For the purposes of this definition,
18 | "control" means (i) the power, direct or indirect, to cause the
19 | direction or management of such entity, whether by contract or
20 | otherwise, or (ii) ownership of fifty percent (50%) or more of the
21 | outstanding shares, or (iii) beneficial ownership of such entity.
22 |
23 | "You" (or "Your") shall mean an individual or Legal Entity
24 | exercising permissions granted by this License.
25 |
26 | "Source" form shall mean the preferred form for making modifications,
27 | including but not limited to software source code, documentation
28 | source, and configuration files.
29 |
30 | "Object" form shall mean any form resulting from mechanical
31 | transformation or translation of a Source form, including but
32 | not limited to compiled object code, generated documentation,
33 | and conversions to other media types.
34 |
35 | "Work" shall mean the work of authorship, whether in Source or
36 | Object form, made available under the License, as indicated by a
37 | copyright notice that is included in or attached to the work
38 | (an example is provided in the Appendix below).
39 |
40 | "Derivative Works" shall mean any work, whether in Source or Object
41 | form, that is based on (or derived from) the Work and for which the
42 | editorial revisions, annotations, elaborations, or other modifications
43 | represent, as a whole, an original work of authorship. For the purposes
44 | of this License, Derivative Works shall not include works that remain
45 | separable from, or merely link (or bind by name) to the interfaces of,
46 | the Work and Derivative Works thereof.
47 |
48 | "Contribution" shall mean any work of authorship, including
49 | the original version of the Work and any modifications or additions
50 | to that Work or Derivative Works thereof, that is intentionally
51 | submitted to Licensor for inclusion in the Work by the copyright owner
52 | or by an individual or Legal Entity authorized to submit on behalf of
53 | the copyright owner. For the purposes of this definition, "submitted"
54 | means any form of electronic, verbal, or written communication sent
55 | to the Licensor or its representatives, including but not limited to
56 | communication on electronic mailing lists, source code control systems,
57 | and issue tracking systems that are managed by, or on behalf of, the
58 | Licensor for the purpose of discussing and improving the Work, but
59 | excluding communication that is conspicuously marked or otherwise
60 | designated in writing by the copyright owner as "Not a Contribution."
61 |
62 | "Contributor" shall mean Licensor and any individual or Legal Entity
63 | on behalf of whom a Contribution has been received by Licensor and
64 | subsequently incorporated within the Work.
65 |
66 | 2. Grant of Copyright License. Subject to the terms and conditions of
67 | this License, each Contributor hereby grants to You a perpetual,
68 | worldwide, non-exclusive, no-charge, royalty-free, irrevocable
69 | copyright license to reproduce, prepare Derivative Works of,
70 | publicly display, publicly perform, sublicense, and distribute the
71 | Work and such Derivative Works in Source or Object form.
72 |
73 | 3. Grant of Patent License. Subject to the terms and conditions of
74 | this License, each Contributor hereby grants to You a perpetual,
75 | worldwide, non-exclusive, no-charge, royalty-free, irrevocable
76 | (except as stated in this section) patent license to make, have made,
77 | use, offer to sell, sell, import, and otherwise transfer the Work,
78 | where such license applies only to those patent claims licensable
79 | by such Contributor that are necessarily infringed by their
80 | Contribution(s) alone or by combination of their Contribution(s)
81 | with the Work to which such Contribution(s) was submitted. If You
82 | institute patent litigation against any entity (including a
83 | cross-claim or counterclaim in a lawsuit) alleging that the Work
84 | or a Contribution incorporated within the Work constitutes direct
85 | or contributory patent infringement, then any patent licenses
86 | granted to You under this License for that Work shall terminate
87 | as of the date such litigation is filed.
88 |
89 | 4. Redistribution. You may reproduce and distribute copies of the
90 | Work or Derivative Works thereof in any medium, with or without
91 | modifications, and in Source or Object form, provided that You
92 | meet the following conditions:
93 |
94 | (a) You must give any other recipients of the Work or
95 | Derivative Works a copy of this License; and
96 |
97 | (b) You must cause any modified files to carry prominent notices
98 | stating that You changed the files; and
99 |
100 | (c) You must retain, in the Source form of any Derivative Works
101 | that You distribute, all copyright, patent, trademark, and
102 | attribution notices from the Source form of the Work,
103 | excluding those notices that do not pertain to any part of
104 | the Derivative Works; and
105 |
106 | (d) If the Work includes a "NOTICE" text file as part of its
107 | distribution, then any Derivative Works that You distribute must
108 | include a readable copy of the attribution notices contained
109 | within such NOTICE file, excluding those notices that do not
110 | pertain to any part of the Derivative Works, in at least one
111 | of the following places: within a NOTICE text file distributed
112 | as part of the Derivative Works; within the Source form or
113 | documentation, if provided along with the Derivative Works; or,
114 | within a display generated by the Derivative Works, if and
115 | wherever such third-party notices normally appear. The contents
116 | of the NOTICE file are for informational purposes only and
117 | do not modify the License. You may add Your own attribution
118 | notices within Derivative Works that You distribute, alongside
119 | or as an addendum to the NOTICE text from the Work, provided
120 | that such additional attribution notices cannot be construed
121 | as modifying the License.
122 |
123 | You may add Your own copyright statement to Your modifications and
124 | may provide additional or different license terms and conditions
125 | for use, reproduction, or distribution of Your modifications, or
126 | for any such Derivative Works as a whole, provided Your use,
127 | reproduction, and distribution of the Work otherwise complies with
128 | the conditions stated in this License.
129 |
130 | 5. Submission of Contributions. Unless You explicitly state otherwise,
131 | any Contribution intentionally submitted for inclusion in the Work
132 | by You to the Licensor shall be under the terms and conditions of
133 | this License, without any additional terms or conditions.
134 | Notwithstanding the above, nothing herein shall supersede or modify
135 | the terms of any separate license agreement you may have executed
136 | with Licensor regarding such Contributions.
137 |
138 | 6. Trademarks. This License does not grant permission to use the trade
139 | names, trademarks, service marks, or product names of the Licensor,
140 | except as required for reasonable and customary use in describing the
141 | origin of the Work and reproducing the content of the NOTICE file.
142 |
143 | 7. Disclaimer of Warranty. Unless required by applicable law or
144 | agreed to in writing, Licensor provides the Work (and each
145 | Contributor provides its Contributions) on an "AS IS" BASIS,
146 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
147 | implied, including, without limitation, any warranties or conditions
148 | of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
149 | PARTICULAR PURPOSE. You are solely responsible for determining the
150 | appropriateness of using or redistributing the Work and assume any
151 | risks associated with Your exercise of permissions under this License.
152 |
153 | 8. Limitation of Liability. In no event and under no legal theory,
154 | whether in tort (including negligence), contract, or otherwise,
155 | unless required by applicable law (such as deliberate and grossly
156 | negligent acts) or agreed to in writing, shall any Contributor be
157 | liable to You for damages, including any direct, indirect, special,
158 | incidental, or consequential damages of any character arising as a
159 | result of this License or out of the use or inability to use the
160 | Work (including but not limited to damages for loss of goodwill,
161 | work stoppage, computer failure or malfunction, or any and all
162 | other commercial damages or losses), even if such Contributor
163 | has been advised of the possibility of such damages.
164 |
165 | 9. Accepting Warranty or Additional Liability. While redistributing
166 | the Work or Derivative Works thereof, You may choose to offer,
167 | and charge a fee for, acceptance of support, warranty, indemnity,
168 | or other liability obligations and/or rights consistent with this
169 | License. However, in accepting such obligations, You may act only
170 | on Your own behalf and on Your sole responsibility, not on behalf
171 | of any other Contributor, and only if You agree to indemnify,
172 | defend, and hold each Contributor harmless for any liability
173 | incurred by, or claims asserted against, such Contributor by reason
174 | of your accepting any such warranty or additional liability.
175 |
176 | END OF TERMS AND CONDITIONS
177 |
178 | APPENDIX: How to apply the Apache License to your work.
179 |
180 | To apply the Apache License to your work, attach the following
181 | boilerplate notice, with the fields enclosed by brackets "[]"
182 | replaced with your own identifying information. (Don't include
183 | the brackets!) The text should be enclosed in the appropriate
184 | comment syntax for the file format. We also recommend that a
185 | file or class name and description of purpose be included on the
186 | same "printed page" as the copyright notice for easier
187 | identification within third-party archives.
188 |
189 | Copyright [yyyy] [name of copyright owner]
190 |
191 | Licensed under the Apache License, Version 2.0 (the "License");
192 | you may not use this file except in compliance with the License.
193 | You may obtain a copy of the License at
194 |
195 | http://www.apache.org/licenses/LICENSE-2.0
196 |
197 | Unless required by applicable law or agreed to in writing, software
198 | distributed under the License is distributed on an "AS IS" BASIS,
199 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
200 | See the License for the specific language governing permissions and
201 | limitations under the License.
202 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | ⚠️⚠️⚠️ Many youtube links are dead. Download the google drive link instead (mentioned below) ⚠️⚠️⚠️
2 |
3 | # YouTube-GDD: A challenging gun detection dataset with rich contextual information [[arXiv]](https://arxiv.org/pdf/2203.04129.pdf) [[Project Page]](https://www.researchgate.net/project/YouTube-GDD)
4 |
5 | ## Overview
6 | To promote the development of security, this work presents a new challenging dataset called YouTube Gun Detection Dataset ([YouTube-GDD](https://arxiv.org/pdf/2203.04129.pdf)). Our dataset is collected from **343** high-definition YouTube videos and contains **5000** well-chosen images, in which **16064** instances of gun and **9046** instances of person are annotated. Compared to other datasets, YouTube-GDD is "dynamic", containing rich contextual information and recording shape changes of the gun during shooting. To build a baseline for gun detection, we evaluate [YOLOv5](https://github.com/ultralytics/yolov5) on YouTube-GDD and analyze the influence of additional related annotated information on gun detection.
7 |
8 |
9 |

10 |
11 |
12 |
13 | ## Dates
14 | - [x] Release Training and validation sets. [2022-04]
15 | - [x] Release test images. [2022-04]
16 | - [ ] Open the evaluation server to the public. [to be confirmed]
17 | - [ ] Augment dataset volumn to the level of ten thousand. [to be confirmed]
18 |
19 | ## Description
20 | 1. All images are captured from [YouTube videos](https://www.youtube.com/results?search_query=gun).
21 |
22 | 2. All annotations are labeled in [YOLO](https://roboflow.com/formats/yolo-darknet-txt) format with [labelImg](https://github.com/tzutalin/labelImg).
23 |
24 | 3. YouTube-GDD contains two categories, namely **"person"** and **"gun"**, corresponding to category ids **0** and **1**, respectively.
25 |
26 | 4. The name format of each image file and the corresponding label file is set as **"YouTube id_original frame rate_split frame rate_ID"**.
27 |
28 | ## Statistics
29 | Firstly, we split the entire dataset into 10 nonoverlapping folds by [filename](https://github.com/UCAS-GYX/YouTube-GDD/blob/main/configs/imagelist_10flod.npy), each containing 500 images. Secondly, we compute the ratio of different scales in the entire dataset as the probability distribution, and then compute the scale distribution of each fold. The two folds with the lowest **JS divergence** are chosen as test set and validation set, i.e., **fold7** is chosen as the **test set** and **fold6** is chosen as the **validation set** while the rest folds are adopted as the training set.
30 |
31 |
32 |
33 | | Split |
34 | Images |
35 | Videos |
36 | Category |
37 | Scale |
38 |
39 |
40 | | person |
41 | gun |
42 | small |
43 | medium |
44 | large |
45 |
46 |
47 | | fold1 |
48 | 500 |
49 | 35 |
50 | 467 |
51 | 1265 |
52 | 373 |
53 | 235 |
54 | 1124 |
55 |
56 |
57 | | fold2 |
58 | 500 |
59 | 34 |
60 | 430 |
61 | 620 |
62 | 4 |
63 | 84 |
64 | 962 |
65 |
66 |
67 | | fold3 |
68 | 500 |
69 | 31 |
70 | 466 |
71 | 905 |
72 | 39 |
73 | 259 |
74 | 1073 |
75 |
76 |
77 | | fold4 |
78 | 500 |
79 | 31 |
80 | 427 |
81 | 751 |
82 | 5 |
83 | 124 |
84 | 1049 |
85 |
86 |
87 | | fold5 |
88 | 500 |
89 | 36 |
90 | 471 |
91 | 716 |
92 | 11 |
93 | 120 |
94 | 1056 |
95 |
96 |
97 | | fold6 |
98 | 500 |
99 | 43 |
100 | 415 |
101 | 718 |
102 | 13 |
103 | 122 |
104 | 998 |
105 |
106 |
107 | | fold7 |
108 | 500 |
109 | 42 |
110 | 394 |
111 | 879 |
112 | 67 |
113 | 193 |
114 | 1013 |
115 |
116 |
117 | | fold8 |
118 | 500 |
119 | 34 |
120 | 475 |
121 | 636 |
122 | 1 |
123 | 60 |
124 | 1050 |
125 |
126 |
127 | | fold9 |
128 | 500 |
129 | 33 |
130 | 460 |
131 | 589 |
132 | 3 |
133 | 57 |
134 | 989 |
135 |
136 |
137 | | fold10 |
138 | 500 |
139 | 32 |
140 | 518 |
141 | 953 |
142 | 37 |
143 | 281 |
144 | 1151 |
145 |
146 |
147 | | all |
148 | 5000 |
149 | 343 |
150 | 9046 |
151 | 16064 |
152 | 1106 |
153 | 3070 |
154 | 20934 |
155 |
156 |
157 |
158 | **Table Note:** Frames captured from the same video may be assigned into two adjacent folds, causing the video to be repeatedly counted.
159 |
160 | ## Construct YouTube-GDD from Source Videos
161 |
162 | ### Setup
163 |
164 | * Prerequisites
165 |
166 | ```
167 | sudo apt-get install ffmpeg
168 | ```
169 |
170 | * Create and activate a virtual environment:
171 |
172 | ```bash
173 | python3 -m venv .venv
174 | source .venv/bin/activate
175 | ```
176 |
177 | * Pip install:
178 |
179 | ```bash
180 | pip install -r requirements.txt
181 | ```
182 |
183 |
184 |
185 |
186 |
187 |
188 | ### Download + construct Youtube-GDD
189 |
190 | **[Update 18th April]** We thank [a2515919](https://github.com/a2515919) who is also working on the dataset and willing to share the pre-processed images: [Google Drive Link](https://drive.google.com/file/d/1TH6kSx7WoFRrUPbxcDGYBrFrYUI1ReWa/view).
191 |
192 | Here, three scripts are provided for constructing YouTube-GDD from source videos step by step.
193 |
194 | + Download videos.
195 | ```bash
196 | cd /path/to/YouTube-GDD/
197 | python ./tools/download.py --videolist ./configs/videolist.txt --videopath /path/to/videos
198 | ```
199 | + Extract frames.
200 | ```bash
201 | cd /path/to/YouTube-GDD/
202 | python ./tools/extract.py --videopath /path/to/videos --framepath /path/to/frames
203 | ```
204 | + Select images.
205 | ```bash
206 | cd /path/to/YouTube-GDD/
207 | python ./tools/select.py --imagelist ./configs/imagelist.npy --framepath /path/to/frames --imagepath /path/to/images
208 | ```
209 |
210 | After collecting images, unzip [labels.zip](https://github.com/UCAS-GYX/YouTube-GDD/blob/main/labels.zip) to the parent root of imagepath and **the expected dataset structure** should be organized as follows, which also meets the dataset structure requirement of [YOLOv5](https://github.com/ultralytics/yolov5).
211 | ```
212 | YouTube-GDD/
213 | images/
214 | train/
215 | val/
216 | test/
217 | labels/
218 | train/
219 | val/
220 | ```
221 |
222 | ## Baseline
223 |
224 |
225 | | Method |
226 | w/ TL |
227 | w/ AoP |
228 | FLOPs |
229 | Params |
230 | Gun |
231 | Person |
232 |
233 |
234 | | AP50 |
235 | AP |
236 | AP50 |
237 | AP |
238 |
239 |
240 | | YOLOv5s |
241 | |
242 | |
243 | 15.80G |
244 | 7.01M |
245 | 67.7 |
246 | 41.0 |
247 | - |
248 | - |
249 |
250 |
251 | |
252 | yes |
253 | 15.81G |
254 | 7.02M |
255 | 67.9 |
256 | 41.3 |
257 | 90.3 |
258 | 75.0 |
259 |
260 |
261 | | yes |
262 | |
263 | 15.80G |
264 | 7.01M |
265 | 75.0 |
266 | 52.0 |
267 | - |
268 | - |
269 |
270 |
271 | | yes |
272 | yes |
273 | 15.81G |
274 | 7.02M |
275 | 77.3 |
276 | 52.1 |
277 | 92.4 |
278 | 81.2 |
279 |
280 |
281 |
282 | **Table Note:** TL means Transfer Learning and AoP means Annotations of Person.
283 |
284 | ## Contact
285 | If you have any general question, feel free to email us at `guyongxiang19@mails.ucas.ac.cn`. If you have dataset-related or implementation-related questions, please feel free to send emails to us or open an issue in this codebase (We recommend that you open an issue in this codebase, because your questions may help others).
286 |
287 | ## Citation
288 | If you find our work inspiring or use our dataset in your research, please cite our work.
289 | ```
290 | @article{gu2022youtube-gdd,
291 | title={YouTube-GDD: A challenging gun detection dataset with rich contextual information},
292 | author={Gu Yongxiang and Liao Xingbin and Qin Xiaolin},
293 | journal={arXiv preprint arXiv:2203.04129},
294 | year={2022}
295 | }
296 | ```
297 |
298 | ## Thanks
299 | We thank Lab students, namely Mingfei Li, Jingyang Shan, Qianlei Wang, Siqi Zhang, Xu Liao, Yuncong Peng, Gang Luo, Xin Lan, Boyi Fu and Yangge Qian, for their suggestions about improving the YouTube-GDD dataset.
300 |
--------------------------------------------------------------------------------