Skip to content
This repository has been archived by the owner on Nov 17, 2023. It is now read-only.

Commit

Permalink
Skip the line in lst, if the format is incorrect (#5561)
Browse files Browse the repository at this point in the history
  • Loading branch information
jiayue666 authored and piiswrong committed Mar 24, 2017
1 parent f2d33e2 commit b276a9d
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion tools/im2rec.py
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,15 @@ def read_list(path_in):
if not line:
break
line = [i.strip() for i in line.strip().split('\t')]
item = [int(line[0])] + [line[-1]] + [float(i) for i in line[1:-1]]
line_len = len(line)
if line_len < 3:
print('lst should at least has three parts, but only has %s parts for %s' %(line_len, line))
continue
try:
item = [int(line[0])] + [line[-1]] + [float(i) for i in line[1:-1]]
except Exception, e:
print('Parsing lst met error for %s, detail: %s' %(line, e))
continue
yield item

def image_encode(args, i, item, q_out):
Expand Down

0 comments on commit b276a9d

Please sign in to comment.