louiscklaw commited on
Commit
98faac3
·
1 Parent(s): f5c2de6

update beach_512,

Browse files
This view is limited to 50 files because it contains too many changes.   See raw diff
Files changed (50) hide show
  1. check_valid_image.py +51 -0
  2. data/train/c_0000000003.jpg +3 -0
  3. data/train/c_0000000004.jpg +3 -0
  4. data/train/c_0000000005.jpg +3 -0
  5. data/train/c_0000000006.jpg +3 -0
  6. data/train/c_0000000007.jpg +3 -0
  7. data/train/c_0000000008.jpg +3 -0
  8. data/train/c_0000000009.jpg +3 -0
  9. data/train/c_0000000010.jpg +3 -0
  10. data/train/c_0000000011.jpg +3 -0
  11. data/train/c_0000000012.jpg +3 -0
  12. data/train/c_0000000013.jpg +3 -0
  13. data/train/c_0000000014.jpg +3 -0
  14. data/train/c_0000000015.jpg +3 -0
  15. data/train/c_0000000016.jpg +3 -0
  16. data/train/c_0000000018.jpg +3 -0
  17. data/train/c_0000000019.jpg +3 -0
  18. data/train/c_0000000021.jpg +3 -0
  19. data/train/c_0000000022.jpg +3 -0
  20. data/train/c_0000000024.jpg +3 -0
  21. data/train/c_0000000025.jpg +3 -0
  22. data/train/c_0000000026.jpg +3 -0
  23. data/train/c_0000000028.jpg +3 -0
  24. data/train/c_0000000029.jpg +3 -0
  25. data/train/c_0000000031.jpg +3 -0
  26. data/train/c_0000000032.jpg +3 -0
  27. data/train/c_0000000033.jpg +3 -0
  28. data/train/c_0000000035.jpg +3 -0
  29. data/train/c_0000000036.jpg +3 -0
  30. data/train/c_0000000037.jpg +3 -0
  31. data/train/c_0000000039.jpg +3 -0
  32. data/train/c_0000000040.jpg +3 -0
  33. data/train/c_0000000041.jpg +3 -0
  34. data/train/c_0000000042.jpg +3 -0
  35. data/train/c_0000000043.jpg +3 -0
  36. data/train/c_0000000044.jpg +3 -0
  37. data/train/c_0000000047.jpg +3 -0
  38. data/train/c_0000000048.jpg +3 -0
  39. data/train/c_0000000051.jpg +3 -0
  40. data/train/c_0000000052.jpg +3 -0
  41. data/train/c_0000000053.jpg +3 -0
  42. data/train/c_0000000054.jpg +3 -0
  43. data/train/c_0000000055.jpg +3 -0
  44. data/train/c_0000000056.jpg +3 -0
  45. data/train/c_0000000057.jpg +3 -0
  46. data/train/c_0000000058.jpg +3 -0
  47. data/train/c_0000000059.jpg +3 -0
  48. data/train/c_0000000060.jpg +3 -0
  49. data/train/c_0000000061.jpg +3 -0
  50. data/train/c_0000000062.jpg +3 -0
check_valid_image.py ADDED
@@ -0,0 +1,51 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # iterate files over subdirectories in `00_store`, store image files in hash table, delete files with same hash
2
+ import os
3
+ import hashlib
4
+ import imghdr
5
+
6
+ deleted = 0
7
+
8
+
9
+ def is_image(filename, verbose=False):
10
+
11
+ data = open(filename, "rb").read(10)
12
+
13
+ # check if file is JPG or JPEG
14
+ if data[:3] == b"\xff\xd8\xff":
15
+ if verbose == True:
16
+ print(filename + " is: JPG/JPEG.")
17
+ return True
18
+
19
+ # check if file is PNG
20
+ if data[:8] == b"\x89\x50\x4e\x47\x0d\x0a\x1a\x0a":
21
+ if verbose == True:
22
+ print(filename + " is: PNG.")
23
+ return True
24
+
25
+ # check if file is GIF
26
+ if data[:6] in [b"\x47\x49\x46\x38\x37\x61", b"\x47\x49\x46\x38\x39\x61"]:
27
+ if verbose == True:
28
+ print(filename + " is: GIF.")
29
+ return True
30
+
31
+ return False
32
+
33
+
34
+ def action(in_path):
35
+ for root, _, files in os.walk(in_path):
36
+ for file in files:
37
+ file_path = os.path.join(root, file)
38
+ print(file_path)
39
+
40
+ with open(file_path, "rb") as f:
41
+ if is_image(file_path):
42
+ # it's a jpeg
43
+ pass
44
+ else:
45
+ # print(file_path, "is not valid jpeg")
46
+ os.remove(file_path)
47
+
48
+
49
+ CURR_DIR = os.path.dirname(os.path.abspath(__file__))
50
+ action(CURR_DIR + "/data/train")
51
+ action(CURR_DIR + "/data/validate")
data/train/c_0000000003.jpg ADDED

Git LFS Details

  • SHA256: cac2248dbbf5abe1c4634b5387d1fa939851b83c9a7ef93531a9899fb5993658
  • Pointer size: 130 Bytes
  • Size of remote file: 46.9 kB
data/train/c_0000000004.jpg ADDED

Git LFS Details

  • SHA256: dcf69388120875aa6c7897b352222738afd239e56d0c05815e2d92351ed2ff51
  • Pointer size: 130 Bytes
  • Size of remote file: 41.6 kB
data/train/c_0000000005.jpg ADDED

Git LFS Details

  • SHA256: 3fa5617d6e64788d8aa8d3e842d4fda9f63fc30bb15353482eb85f768f0debd9
  • Pointer size: 130 Bytes
  • Size of remote file: 35.8 kB
data/train/c_0000000006.jpg ADDED

Git LFS Details

  • SHA256: efd8aaa721b0211b457f92f156859404361a1b4189d9f3a137c557f308827289
  • Pointer size: 130 Bytes
  • Size of remote file: 66.5 kB
data/train/c_0000000007.jpg ADDED

Git LFS Details

  • SHA256: f79fed3b5b1d1d6dbdfc4edf48bc9ecbb50f97f96d547da69c319ca155a21b3b
  • Pointer size: 130 Bytes
  • Size of remote file: 44.8 kB
data/train/c_0000000008.jpg ADDED

Git LFS Details

  • SHA256: 220db189b631bf19dc66b535bf5f7ff0ed364a5873209f785ba3e1c92fec9262
  • Pointer size: 130 Bytes
  • Size of remote file: 53.4 kB
data/train/c_0000000009.jpg ADDED

Git LFS Details

  • SHA256: 47cb9fc217e69929cf4589ed6e2eac4d6bb00be8d66065df74c04020d02d9bf1
  • Pointer size: 130 Bytes
  • Size of remote file: 35.4 kB
data/train/c_0000000010.jpg ADDED

Git LFS Details

  • SHA256: b7e9a8369657b4963526185f698a89179a734f77d068a02af4728c3fec73f147
  • Pointer size: 130 Bytes
  • Size of remote file: 76.7 kB
data/train/c_0000000011.jpg ADDED

Git LFS Details

  • SHA256: a00fad9556a1c02a5d16d434f3357d66fda4cfc2faf90c30858c9d31ac17fe0c
  • Pointer size: 130 Bytes
  • Size of remote file: 69.6 kB
data/train/c_0000000012.jpg ADDED

Git LFS Details

  • SHA256: f63f9f93498b9aaefb1262b1439d3c968f420b2aa39c7365dd83d5786e74da2a
  • Pointer size: 130 Bytes
  • Size of remote file: 49 kB
data/train/c_0000000013.jpg ADDED

Git LFS Details

  • SHA256: e97545e8ea94e98cfdafa3a61d1fb59de1219a78785585fa0a915085fa276782
  • Pointer size: 130 Bytes
  • Size of remote file: 80.4 kB
data/train/c_0000000014.jpg ADDED

Git LFS Details

  • SHA256: 4dc060bfd32b11c9bbd5c431b0d671f99b81215ec6634c1fdbae1891d7c7a5f0
  • Pointer size: 130 Bytes
  • Size of remote file: 64.2 kB
data/train/c_0000000015.jpg ADDED

Git LFS Details

  • SHA256: 07456e57df925f71603a820782b91a81ebe2b8997cb55afdffc4ab8a9f758d78
  • Pointer size: 130 Bytes
  • Size of remote file: 64.8 kB
data/train/c_0000000016.jpg ADDED

Git LFS Details

  • SHA256: 14425afe5aca8f92909b04dbb6fbed4d76b143668898942565a65e1ad733407e
  • Pointer size: 130 Bytes
  • Size of remote file: 88.5 kB
data/train/c_0000000018.jpg ADDED

Git LFS Details

  • SHA256: 8105b6279fc62a19317704a2fc154cfeab3a37ec8a69c894e31077a6337b1c7b
  • Pointer size: 130 Bytes
  • Size of remote file: 59.7 kB
data/train/c_0000000019.jpg ADDED

Git LFS Details

  • SHA256: cca80b046493504aed32cedd854b23f162cbc1c1cd46a4c2934494ca9d06d65b
  • Pointer size: 130 Bytes
  • Size of remote file: 45.7 kB
data/train/c_0000000021.jpg ADDED

Git LFS Details

  • SHA256: 7c523ed007843335e53d99479196b9a11fa7647723ea9cd6db745d95132631cc
  • Pointer size: 130 Bytes
  • Size of remote file: 65.4 kB
data/train/c_0000000022.jpg ADDED

Git LFS Details

  • SHA256: 1761164326cefe85dd39cf61aad295d8a6805ca0651c1108d91bfbc7d4c45633
  • Pointer size: 130 Bytes
  • Size of remote file: 62.1 kB
data/train/c_0000000024.jpg ADDED

Git LFS Details

  • SHA256: c62da5a4a4d69cd610737ed118de709d91ba48e325779392d7ef5b03e3ec1b6a
  • Pointer size: 130 Bytes
  • Size of remote file: 36.9 kB
data/train/c_0000000025.jpg ADDED

Git LFS Details

  • SHA256: bbd4fc97d758507f95c2659957145b74344cdde5a7d0f2a1fe8fa4ec1268d88f
  • Pointer size: 130 Bytes
  • Size of remote file: 76.1 kB
data/train/c_0000000026.jpg ADDED

Git LFS Details

  • SHA256: 733495679d0d7e4080acfea58653967974f9d74fd3233a39429dfc4232a28573
  • Pointer size: 130 Bytes
  • Size of remote file: 45.1 kB
data/train/c_0000000028.jpg ADDED

Git LFS Details

  • SHA256: f5306aec150f736bd900bd5f326d2297bf6133fae2a39ad03b4a34820a17b63d
  • Pointer size: 130 Bytes
  • Size of remote file: 31.7 kB
data/train/c_0000000029.jpg ADDED

Git LFS Details

  • SHA256: c497f251d76d12d2247025ae1c8a8b5f3f1e2ae7b309bc90a4d773e693a2a333
  • Pointer size: 130 Bytes
  • Size of remote file: 73.4 kB
data/train/c_0000000031.jpg ADDED

Git LFS Details

  • SHA256: c22b8f74b08d136c3049ad927803b857dc55ff91ba2c3d4250883bb68e62d535
  • Pointer size: 130 Bytes
  • Size of remote file: 66.2 kB
data/train/c_0000000032.jpg ADDED

Git LFS Details

  • SHA256: 90053b82ec672e841b552cc88e80bd86e41abbbbdfcb438d4ae94f32f966499e
  • Pointer size: 130 Bytes
  • Size of remote file: 14.6 kB
data/train/c_0000000033.jpg ADDED

Git LFS Details

  • SHA256: 20afe4e822b3d893e5e553cf35f8d8b3212e6b6f6dfb241f72d82a4b156f6b53
  • Pointer size: 130 Bytes
  • Size of remote file: 44.6 kB
data/train/c_0000000035.jpg ADDED

Git LFS Details

  • SHA256: ca83273e4a9b46aebddfc5510da896613a227a6da54106dd90936149af1280ad
  • Pointer size: 130 Bytes
  • Size of remote file: 57.8 kB
data/train/c_0000000036.jpg ADDED

Git LFS Details

  • SHA256: 321b79d6a69d331aecd212d348328ffa91b3e2231929c271fb4a34ed2f204b9e
  • Pointer size: 130 Bytes
  • Size of remote file: 48.5 kB
data/train/c_0000000037.jpg ADDED

Git LFS Details

  • SHA256: c34289204704b64db4be817cc2e834162d5115e96995b67b113c17e213827526
  • Pointer size: 130 Bytes
  • Size of remote file: 50.1 kB
data/train/c_0000000039.jpg ADDED

Git LFS Details

  • SHA256: ce1ca0f19bb8dc8c4e624cd574921ac3fdcdcc731a9d75447c755578949aff69
  • Pointer size: 130 Bytes
  • Size of remote file: 18.2 kB
data/train/c_0000000040.jpg ADDED

Git LFS Details

  • SHA256: fab5ea938ecdf8b1c2dcca8ab179d76b18cf87f254fdc2fe0f703b95e6c9d014
  • Pointer size: 130 Bytes
  • Size of remote file: 56.8 kB
data/train/c_0000000041.jpg ADDED

Git LFS Details

  • SHA256: b65bc0fad6a2f024c659afb0cc5cfe3763bce24e897da42c36d8251b33507f44
  • Pointer size: 130 Bytes
  • Size of remote file: 76.8 kB
data/train/c_0000000042.jpg ADDED

Git LFS Details

  • SHA256: 8a6b3c334ed737060fa28f04868b144d36c604080a086c222d37162c761979d6
  • Pointer size: 130 Bytes
  • Size of remote file: 31.3 kB
data/train/c_0000000043.jpg ADDED

Git LFS Details

  • SHA256: c51bfb30040fe07a6b748415dd26a4e0d57156f031f80f6e7783d16e2ec20bb8
  • Pointer size: 130 Bytes
  • Size of remote file: 36.2 kB
data/train/c_0000000044.jpg ADDED

Git LFS Details

  • SHA256: 415e13ab21d2d73e51154f5d0981abc65d8a720d08f6584909b5bf7a1a45aa42
  • Pointer size: 130 Bytes
  • Size of remote file: 11.1 kB
data/train/c_0000000047.jpg ADDED

Git LFS Details

  • SHA256: 170fbd16f2da46d0ba14cac55425b4ec0c71f535d12e59e51f47e6dce6a46392
  • Pointer size: 130 Bytes
  • Size of remote file: 57.8 kB
data/train/c_0000000048.jpg ADDED

Git LFS Details

  • SHA256: e88cdfc2fea453353a00a812d7bdf81730704a0bf6949fa2aedc9bae8d195e69
  • Pointer size: 130 Bytes
  • Size of remote file: 47.3 kB
data/train/c_0000000051.jpg ADDED

Git LFS Details

  • SHA256: 317150eb0da323b6ee9cf5131db786feefa379f10ee009708fd00631521fb605
  • Pointer size: 130 Bytes
  • Size of remote file: 88 kB
data/train/c_0000000052.jpg ADDED

Git LFS Details

  • SHA256: 673df7ecdecaca0f6f2100aa99cf35d080d6070018b073d7d996932754ba5833
  • Pointer size: 130 Bytes
  • Size of remote file: 39.9 kB
data/train/c_0000000053.jpg ADDED

Git LFS Details

  • SHA256: a3e794796c548ca38118a3eec13bfeec70ef6d7d568f598c91b810809cde6f11
  • Pointer size: 130 Bytes
  • Size of remote file: 70.2 kB
data/train/c_0000000054.jpg ADDED

Git LFS Details

  • SHA256: 1981475755c6d27a046f3a39dedadc9f1c6d9c006ddce8eb5f33f7b1bdf4026f
  • Pointer size: 130 Bytes
  • Size of remote file: 37.7 kB
data/train/c_0000000055.jpg ADDED

Git LFS Details

  • SHA256: e7d847da3e40a110bcec47aa046ce687c40caa9559a448bc6452f351948abbd3
  • Pointer size: 130 Bytes
  • Size of remote file: 43.4 kB
data/train/c_0000000056.jpg ADDED

Git LFS Details

  • SHA256: b26546d97f5eded1dfa4e46c1f7a6857b8753dffe3cd4820d22a2490dceb8024
  • Pointer size: 130 Bytes
  • Size of remote file: 26.7 kB
data/train/c_0000000057.jpg ADDED

Git LFS Details

  • SHA256: 2d61cdc528ccb872556a9da773a8a2c15b3b6ae2d19ec8f2672cec6155f1bcd3
  • Pointer size: 130 Bytes
  • Size of remote file: 55.7 kB
data/train/c_0000000058.jpg ADDED

Git LFS Details

  • SHA256: 459d93c1c19b5f951ab5480ef20c8962f01ec2a8701fac8061b17fc8dea6afbb
  • Pointer size: 130 Bytes
  • Size of remote file: 58 kB
data/train/c_0000000059.jpg ADDED

Git LFS Details

  • SHA256: ca928e3861c683bbc7525e7d61d79442292534cc38e905b20dea68176266ebf6
  • Pointer size: 130 Bytes
  • Size of remote file: 43.8 kB
data/train/c_0000000060.jpg ADDED

Git LFS Details

  • SHA256: 27ef9cf40998eff1408c94060b1cda7d2e590f092cc1aa415c1dc3f1a9166f66
  • Pointer size: 130 Bytes
  • Size of remote file: 47.4 kB
data/train/c_0000000061.jpg ADDED

Git LFS Details

  • SHA256: fdc09de374647e03398bfc88efda7ec7fb3ac0b710227471d94b43232596cef7
  • Pointer size: 130 Bytes
  • Size of remote file: 28.9 kB
data/train/c_0000000062.jpg ADDED

Git LFS Details

  • SHA256: 627c41b8744b96bf39a132ccc061e001f8a339893835aab58f34fe6d7c09a085
  • Pointer size: 130 Bytes
  • Size of remote file: 30.7 kB