-
Notifications
You must be signed in to change notification settings - Fork 5
/
recognise_from_file.py
35 lines (27 loc) · 1.02 KB
/
recognise_from_file.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
import os
import sys
import glob
from RBM_core import *
###############################################################################
# Classification of .jpg images located in "custom_test_datas/"
# Run with "-s" arg to run in silent mode: to not show plots
show_plots = True
for arg in sys.argv:
if arg == "-s" or arg == "-S":
show_plots = False
print("==============================================================================")
print(' Now predicting numbers for pictures in "custom_test_datas/"')
print("==============================================================================")
path = "custom_test_datas/"
for file in glob.glob(os.path.join(path, '*.jpg')):
print("File: \"{}\"".format(file))
img = Image.open(file)
local_img = convert_image_for_network(img, contrast_level=0)
predict_2D_image(
local_img,
classifier,
show_plot=show_plots
)
print("")
print("______________________________________________________________________________")
print("Done.")