def __getitem__(self, idx):
img_name = self.img_names[idx]
ensembled = np.zeros(const.img_size)
for i, pred_dir in enumerate(self.pred_dirs):
pred_path = os.path.join(const.OUTPUT_DIR, pred_dir, const.PROBS_DIR_NAME, img_name + '.npy')
img_prob = np.load(pred_path)
weighted_img_prob = np.multiply(img_prob, self.weights[i])
ensembled = np.add(ensembled, weighted_img_prob)
# save into new output/ folder
submit.save_ensembled_prob_map(self.ensemble_dir, img_name, ensembled)
#plt.imshow(ensembled)
#plt.show()
return img_name, ensembled
评论列表
文章目录