This project automates the recognition of allergenic pollen grains present in France using Computer Vision. By assisting in the rapid and accurate identification of pollen taxa, this tool represents a significant step toward building real-time monitoring devices that can help people suffering from pollen allergies know when they are at risk.
The project implements the PollenNet architecture proposed by Shamrat et al. (2024), adapting it to classify 13 specific pollen types found in the French ecosystem.
Reference Paper:
Shamrat, F. M. J. M., et al. "PollenNet: A Novel Architecture for High Precision Pollen Grain Classification through Deep Learning and Explainable AI." Heliyon, vol. 10, no. 19, Oct. 2024, p. e38596. DOI: 10.1016/j.heliyon.2024.e38596
Figure 1: Research poster summarizing the methodology and results.
We constructed a unified dataset by merging and harmonizing three distinct sources to ensure diversity in image acquisition methods.
Data Availability:
The datasets are not included in the repository due to size constraints. Please download them from the sources below and extract them into the data/raw/ folder:
- Pollen13K: Download via IPLab
- Pollen20L: Download via Kaggle
- Pollen23E: Download via Figshare
Preprocessing & Augmentation:
- Classes: 13 pollen types (e.g., Alder, Hazel, Grass, Mugwort, Ragweed...).
- Imbalance: The data is highly unbalanced, ranging from ~9,410 images for Alder to ~35 for Palms and Eucalyptus.
- Augmentation: To create a robust classifier, we used data augmentation (random 180° rotations, horizontal/vertical flips) since pollen grains lack a fixed orientation.
- Split: 85% Training / 15% Validation.
The model is a Convolutional Neural Network (CNN) featuring:
- Feature Extraction: 4 Convolutional layers with MaxPooling and Batch Normalization.
- Regularization: Three Dropout layers (0.5) were used to prevent overfitting, which is critical given the class imbalance.
- Classifier: A fully connected sequence outputting probabilities for the 13 classes.
The model was trained for 12 epochs. Despite the class imbalance, the model achieved strong performance metrics.
- Best Validation Accuracy: 85%.
- Micro-Average AUC: 0.9938.
Figure 2: Training and Validation accuracy over 12 epochs. Note the oscillation in validation accuracy due to the small sample size of rare classes.
| ROC Curves | Confusion Matrix |
|---|---|
![]() |
![]() |
| Figure 3: One-vs-All ROC Curves | Figure 4: Confusion Matrix showing Alder/Hazel confusion |
- Accuracy: The training accuracy increased steadily. Validation accuracy peaked at 0.85 but showed significant oscillation, likely due to the small sample size in the validation set for rare classes.
- ROC Curves: The One-vs-All ROC curves demonstrate excellent separability. Distinct grains like Mugwort, Birch, and Nettle achieved an AUC of 1.000, meaning the model is very good at distinguishing whether a grain belongs to a specific class or not.
- Confusion Matrix:
- The model performs exceptionally well on visually distinct classes.
- Confusion: There is notable confusion between Alder (Alnus) and Hazel (Corylus). This is biologically consistent as both belong to the Betulaceae family and share very similar morphologies.
git clone https://github.com/HugoDeBosschere/PollenNet-France.git
cd PollenNet-France
pip install -r requirements.txtYou have to store the 3 datasets you downloaded in a dataset folder under the folder names pollen20l_images, Pollen13K, Pollen23E Make sure you have a test_labels.json in a bboxes.csv file in the pollen20l_images folder so that the program can recongnize the which images are in the test dataset and which in the train dataset
python scripts/data_creation.pyCreates unified training and validation datasets in dataset/dataset_final_english/.
python -m src.pollen_net.mainIf Results/pollen_net_best_model.pth exists, training resumes automatically.
Set in src/pollen_net/main.py:
NUM_EPOCHS = 0Then run:
python -m src.pollen_net.mainFor research and educational use only.


