def filter_bad_images():
index = 0
gt_index = arguments.gt_start
predicted_index = arguments.predicted_start
indices = []
filter_path = search(predicted_index)
filter_filename = os.path.join(arguments.gt_path, "filter_close.txt")
if os.path.exists(filter_filename):
with open(filter_filename, "r") as filter_file:
filter_close_indices = [int(line.strip()) for line in filter_file.readlines()]
else:
filter_close_indices = []
for image_index in range(arguments.samples):
rgb = mpimg.imread(os.path.join(filter_path, arguments.filter_format.format(predicted_index)))
if np.median(rgb) > 5 and gt_index not in filter_close_indices:
indices.append((index, gt_index, predicted_index))
index += 1
gt_index += 1
predicted_index += 1
return indices
评论列表
文章目录