Digital Africa Plantation Counting Challenge
Can you create a semi-supervised algorithm to count trees in plantations in Côte d'Ivoire?
$10 000 USD
20 days to go
153 active · 461 enrolled
Côte dIvoire
Computer Vision
Object Detection
Clean baseline code - LB: 2.542369639
Notebooks · 28 Feb 2023, 04:25 · 6

In this video I train a model to solve this competition from scratch, from end to end, using PyTorch


Discussion 6 answers

Thanks @TAUIL_Abdelilah for sharing your hard work

1 Mar 2023, 10:36
Upvotes 1

Thanks @TAUIL_Abdelilah How elegant it is!

1 Mar 2023, 16:19
Upvotes 1

Great job ! But i think you did a small mistake when checking the validation score : you are averaging rmse of different batches. You'd rather store the predictions and then calculate the rmse.

2 Mar 2023, 12:18
Upvotes 3

Interesting, I thought averaging rmse of all batches will give the same results as store the predictions and then calculate the rmse. But I was wrong. I just updated the check_accuracy and hopefully fix the mistake.

This is the updated check accuracy, can you review it and see if I'm checking the accuracy the right way:

def check_acc_update(loader, model):    
    all_preds = np.array([]); all_groud_truth = np.array([])
    with torch.no_grad():
        for x,y in tqdm(loader):
            x ='cuda').to(torch.float32)
            y =
            all_preds       = np.append(all_preds, (model(x).cpu()))
            all_groud_truth = np.append(all_groud_truth, (y.cpu()))
    loss = np.sqrt(mean_squared_error(all_preds, all_groud_truth))
    print(f'Loss function: {loss}')
    return loss

Thanks for the feadback @Reacher.

hi @TAUIL_Abdelilah ,

your function was false before because you tend to return the loss of only the last batch, and it is the same to return the average of each batch loss or the loss of all predictions with a reduction="mean".

and this function does't return the accuracy (the fraction of correctly predicted divided by the total of predictions), here you are looking for the validation loss (!=train loss: you can't use numpy to calculate loss for a grading train function).