Skip to content

Commit

Permalink
check predicted file format
Browse files Browse the repository at this point in the history
  • Loading branch information
Cartucho committed Apr 6, 2018
1 parent 9f0f1b4 commit bebb39b
Showing 1 changed file with 12 additions and 6 deletions.
18 changes: 12 additions & 6 deletions main.py
Original file line number Diff line number Diff line change
Expand Up @@ -215,10 +215,10 @@ def draw_plot_func(dictionary, n_classes, window_title, plot_title, y_label, out
try:
class_name, left, top, right, bottom = line.split()
except ValueError:
print("Error: File " + txt_file + " in the wrong format.")
print(" Expected: <class_name> <left> <top> <right> <bottom>")
print(" Received: " + line)
sys.exit(0)
error_msg = "Error: File " + txt_file + " in the wrong format.\n"
error_msg += " Expected: <class_name> <left> <top> <right> <bottom>\n"
error_msg += " Received: " + line
error(error_msg)
# check if class is in the ignore list, if yes skip
if class_name in args.ignore:
continue
Expand Down Expand Up @@ -300,8 +300,14 @@ def draw_plot_func(dictionary, n_classes, window_title, plot_title, y_label, out
#print txt_file
lines = file_lines_to_list(txt_file)
for line in lines:
line_class_name, confidence, left, top, right, bottom = line.split()
if line_class_name == class_name:
try:
tmp_class_name, confidence, left, top, right, bottom = line.split()
except ValueError:
error_msg = "Error: File " + txt_file + " in the wrong format.\n"
error_msg += " Expected: <class_name> <confidence> <left> <top> <right> <bottom>\n"
error_msg += " Received: " + line
error(error_msg)
if tmp_class_name == class_name:
#print("match")
file_id = txt_file.split(".txt",1)[0]
file_id = os.path.basename(os.path.normpath(file_id))
Expand Down

0 comments on commit bebb39b

Please sign in to comment.