I submit my code and generated a submission.csv. but I got this error:
IDs for submission are not correct.
My code:
submit_csv = pd.DataFrame(columns=[‘filename’, 0, 1, 2, 3])
wsi_list = glob.glob(’./data/*.tif’)
for idx, item in enumerate(wsi_list):
base_name = item.split(’/’)[-1]
pred = 0 or 1 or 2 or 3
submit_csv.loc[idx] = [base_name] + np.uint8(np.eye(4)[pred]).tolist()
submit_csv.to_csv(’./submission.csv’, index=None)
I didn’t find any difference. Does anyone know the reason?
bull
October 8, 2020, 3:48pm
2
The submission format needs to match submission_format.csv
exactly. This includes the header, the index values, and the order of the rows. The easiest way is to load and iterate through submission_fromat.csv
rather than globbing the filenames, like we do in the benchmark:
for filename, metadata_row in input_metadata.iterrows():
# make sure all the image exists
assert (DATA_ROOT / filename).exists()
# make a random prediction
pred = random.choice([0, 1, 2, 3])
# one-hot encode the prediction
submission_format.loc[filename, str(pred)] = 1
# save as "submission.csv" in the root folder, where it is expected
submission_format.to_csv("submission.csv")