This is the 2nd-place solution for the Beyond Visible Spectrum: AI for Agriculture 2023 challenge hosted in Kaggle.
- Squeeze the 125 bands to only 3 bands using a "pre-Conv2D" layer
- Augmentations: RandomHorizontalFlip, RandomVerticalFlip, GaussianBlur
- EarlyStopping scheduler
- Freeze high level features' layers
-
Go to this link, download the data, and put in the
data
folder. -
Create a
conda
environment from an environment file:
conda env create -f environment.yml
- Activate the
conda
environment:
conda deactivate # if "base" is already activated
conda activate crop-disease
- Train the model:
python3 -u src/train_nn.py --bs=56 > logs/train.log
This will create a folder like 20230912-153034_resnet18_bs56_acc0_760714
.
- Do predictions, passing as
dir
the folder the training script just created:
python3 -u src/predict_nn.py --dir=20230912-153034_resnet18_bs56_acc0_760714 > logs/pred.log
Stratified KFold with k=5
- Mean accuracy: 0.760714
- Std. accuracy: 0.02208
- CentOS 7
- GPU: Tesla V100 with 32GB (only used around 2GB)
- Training: ~40 minutes
- Inference: ~3 minutes
- Randomly choose a subset of bands (0 to 60 or 65 to 125, for example)
- Trying to learn which bands should the model focus on using "learnable weights"