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):
1717src_dir = '/toScan'
1818dest_dir = '/scanned'
1919img_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 )
2022
2123# Loads label file, strips off carriage return
2224label_lines = [line .rstrip () for line
@@ -37,8 +39,14 @@ def mkdir_p(path):
3739 image_data = tf .gfile .FastGFile (src_image_path , 'rb' ).read ()
3840
3941 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
4250
4351 # Sort to show labels of first prediction in order of confidence
4452 top_k = predictions [0 ].argsort ()[- len (predictions [0 ]):][::- 1 ]
You can’t perform that action at this time.
0 commit comments