File tree Expand file tree Collapse file tree 1 file changed +10
-2
lines changed Expand file tree Collapse file tree 1 file changed +10
-2
lines changed Original file line number Diff line number Diff line change @@ -17,6 +17,8 @@ def mkdir_p(path):
17
17
src_dir = '/toScan'
18
18
dest_dir = '/scanned'
19
19
img_files = [f for f in listdir (src_dir ) if isfile (join (src_dir , f ))]
20
+ issue_dir = join (dest_dir , '_issues' )
21
+ mkdir_p (issue_dir )
20
22
21
23
# Loads label file, strips off carriage return
22
24
label_lines = [line .rstrip () for line
@@ -37,8 +39,14 @@ def mkdir_p(path):
37
39
image_data = tf .gfile .FastGFile (src_image_path , 'rb' ).read ()
38
40
39
41
print (src_image_path )
40
- predictions = sess .run (softmax_tensor , \
41
- {'DecodeJpeg/contents:0' : image_data })
42
+
43
+ try :
44
+
45
+ predictions = sess .run (softmax_tensor , \
46
+ {'DecodeJpeg/contents:0' : image_data })
47
+ except Exception as e :
48
+ move (srcFilePath , join (issue_dir , imageFile ))
49
+ continue
42
50
43
51
# Sort to show labels of first prediction in order of confidence
44
52
top_k = predictions [0 ].argsort ()[- len (predictions [0 ]):][::- 1 ]
You can’t perform that action at this time.
0 commit comments