- commit
- dcbbe2e
- parent
- 0f8c002
- author
- Eric Bower
- date
- 2024-10-04 20:26:26 +0000 UTC
chore: detector work
1 files changed,
+7,
-5
+7,
-5
1@@ -12,21 +12,22 @@ CEND = '\033[0m'
2 def images(root_dir):
3 count = 0
4 for filename in glob.iglob(root_dir + '**/*.jpg', recursive=True):
5- if count == 10:
6- return
7+ #if count == 10:
8+ # return
9 try:
10 img = Image.open(filename)
11 yield img, filename
12 except Exception as err:
13 print("failed to open file", err)
14 count += 1
15+ print(f"scanned {count} images")
16
17 if __name__ == '__main__':
18 if len(sys.argv) < 2:
19 raise Exception(f"{CRED}error!: please provide root image folder{CEND}")
20 root_dir = sys.argv[1]
21 print(f"root_dir {root_dir}")
22- threshold = 0.3
23+ threshold = 0.6
24
25 print(f"failure threshold is set to {threshold:.4f}")
26
27@@ -44,7 +45,7 @@ if __name__ == '__main__':
28 try:
29 result = classify(img)
30 except Exception as err:
31- print(f"{CYELLOW}err{CEND} (score:n/a) {filename} {err}")
32+ # print(f"{CYELLOW}err{CEND} (score:n/a) {filename} {err}")
33 continue
34
35 nsfw_score = result[1]["score"]
36@@ -52,4 +53,5 @@ if __name__ == '__main__':
37 if nsfw_score > threshold:
38 print(f"{CRED}failed{CEND} (score:{score_read}) {filename}")
39 else:
40- print(f"{CGREEN}passed{CEND} (score:{score_read}) {filename}")
41+ # print(f"{CGREEN}passed{CEND} (score:{score_read}) {filename}")
42+ pass