I have trained a pre-trained Resnet50 classifier on the kaggle images dataset and label them as 0 for No-Covid 1 for Thorax diseases and 2 for covid.
now for the competition, I need to save these labels in the CSV files.
when I run the following code for evaluation of the test images,
total_imgs = 0
covid_positive = 0
for root, dirs, files in os.walk("/content/gdrive/My Drive/dlai3-phase3/VALIDATE/VALIDATE", topdown=False):
for name in files:
total_imgs += 1
#im_covid = Image.open(“data/test/covid/03BF7561-A9BA-4C3C-B8A0-D3E585F73F3C.jpeg”)
img = Image.open(os.path.join(root, name))
img = img.convert(‘RGB’)
pred, probs = predict_covid(img)
print the string labels, not the number. Could anyone please tell me how I can get the numeric labels? thanks