-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathstats.py
66 lines (53 loc) · 2.77 KB
/
stats.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
import os
from pathlib import Path
# num images before cleaning
files = os.listdir(Path(r"data\images"))
print("num images before cleaning: ", num_images := len(files))
print("\nRGB based: ---------------------------------------------------")
print("\nUsing cv2.SIFT(): >>>>>>>>>>>>>>>>>>>>>>>>>>>")
print("\nnum templates = ", 1)
# num images after cleaning
with open(Path(r"data\cleaned_images.txt"), "r") as file:
lines = file.readlines()
print("num images after cleaning: ", num_cleaned_images := len(lines))
# % of images removed
print("% of images removed: ", round(((num_images - num_cleaned_images)/num_images)*100, 2), " %")
print("\nnum templates = ", 2)
# num images after cleaning
with open(Path(r"data\cleaned_images_2temp_testing.txt"), "r") as file:
lines = file.readlines()
print("num images after cleaning: ", num_cleaned_images := len(lines))
# % of images removed
print("% of images removed: ", round(((num_images - num_cleaned_images)/num_images)*100, 2), " %")
print("\nEDGE MAP based: ---------------------------------------------------")
print("\nUsing cv2.SIFT(): >>>>>>>>>>>>>>>>>>>>>>>>>>>")
print("\nnum templates = ", 2, "match_threshold = ", 14)
# num images after cleaning
with open(Path(r"data\cleaned_images_2temp_edgemaps.txt"), "r") as file:
lines = file.readlines()
print("num images after cleaning: ", num_cleaned_images := len(lines))
# % of images removed
print("% of images removed: ", round(((num_images - num_cleaned_images)/num_images)*100, 2), " %")
print("\nnum templates = ", 2, ", match_threshold = ", 20)
# num images after cleaning
with open(Path(r"data\cleaned_images_2temp_edgemaps_20.txt"), "r") as file:
lines = file.readlines()
print("num images after cleaning: ", num_cleaned_images := len(lines))
# % of images removed
print("% of images removed: ", round(((num_images - num_cleaned_images)/num_images)*100, 2), " %")
print("\nnum templates = ", 1, ", threshold = ", 14, ", neg_templates = ", True, "num neg_templates = ", \
1, ", neg_threshold = ", 10, )
# num images after cleaning
with open(Path(r"data\cleaned_images_temp1_th14_ntemp1_nth10_edge.txt"), "r") as file:
lines = file.readlines()
print("num images after cleaning: ", num_cleaned_images := len(lines))
# % of images removed
print("% of images removed: ", round(((num_images - num_cleaned_images)/num_images)*100, 2), " %")
print("\nUsing cv2.matchTemplate(): >>>>>>>>>>>>>>>>>>>")
print("\nmethod= cv2.TM_SQDIFF, threshold = 25e7")
# num images after cleaning
with open(Path(r"data\clean_images_tm_sqdiff_25e7.txt"), "r") as file:
lines = file.readlines()
print("num images after cleaning: ", num_cleaned_images := len(lines))
# % of images removed
print("% of images removed: ", round(((num_images - num_cleaned_images)/num_images)*100, 2), " %")