File tree Expand file tree Collapse file tree 1 file changed +4
-4
lines changed Expand file tree Collapse file tree 1 file changed +4
-4
lines changed Original file line number Diff line number Diff line change 13
13
from shutil import copyfile
14
14
from os .path import isfile , join
15
15
var_path = '/toScan'
16
- dest_dir = " /scanned"
16
+ dest_dir = ' /scanned'
17
17
img_files = [f for f in listdir (var_path ) if isfile (join (var_path , f ))]
18
18
19
19
20
20
# Loads label file, strips off carriage return
21
21
label_lines = [line .rstrip () for line
22
- in tf .gfile .GFile (" /tf_files/retrained_labels.txt" )]
22
+ in tf .gfile .GFile (' /tf_files/retrained_labels.txt' )]
23
23
24
24
# Unpersists graph from file
25
- with tf .gfile .FastGFile (" /tf_files/retrained_graph.pb" , 'rb' ) as f :
25
+ with tf .gfile .FastGFile (' /tf_files/retrained_graph.pb' , 'rb' ) as f :
26
26
graph_def = tf .GraphDef ()
27
27
graph_def .ParseFromString (f .read ())
28
28
_ = tf .import_graph_def (graph_def , name = '' )
47
47
top_k = predictions [0 ].argsort ()[- len (predictions [0 ]):][::- 1 ]
48
48
firstElt = top_k [0 ];
49
49
50
- new_file_name = label_lines [firstElt ] + "--" + str (predictions [0 ][firstElt ])[2 :7 ]+ " .jpg"
50
+ new_file_name = label_lines [firstElt ] + '--' + str (predictions [0 ][firstElt ])[2 :7 ]+ ' .jpg'
51
51
print (new_file_name )
52
52
copyfile (join (var_path , image_file ), join (dest_dir , new_file_name ))
53
53
You can’t perform that action at this time.
0 commit comments