{
  "id": 568846,
  "title": " 🍄  Solving FungiCLEF25: Tips and Hints for Few-Shot Classification Improvements",
  "url": "/competitions/fungi-clef-2025/discussion/568846",
  "author_name": "",
  "post_date": "2025-03-18T09:52:18.567647Z",
  "votes": 3,
  "comment_count": 5,
  "views": 0,
  "content": "<p>We’re thrilled to launch <strong>FungiCLEF25</strong>, a competition focused on <strong>few-shot fungi classification</strong> using real-world observational data. The challenge requires innovative approaches to handle species with limited training samples while leveraging multi-image observations effectively.</p>\n<p>In the provided <a href=\"https://www.kaggle.com/code/picekl/fungiclef25-starter-notebook\" target=\"_blank\">starter notebook</a>, two baseline methods—Nearest Neighbor (NN) and Nearest Centroid (NC) classifiers—are introduced. These methods utilize embeddings from the <a href=\"https://huggingface.co/imageomics/bioclip\" target=\"_blank\">BioCLIP</a> model, a vision foundation model tailored for biological taxonomy.</p>\n<ul>\n<li><strong>Nearest Neighbor (NN)</strong>: Assigns a new image to the class of its closest labeled image based on a chosen distance metric (e.g., Euclidean or cosine distance).</li>\n<li><strong>Nearest Centroid (NC)</strong>: Computes the average feature representation (centroid) for each class and assigns new images based on proximity to these centroids.</li>\n</ul>\n<p>These methods serve as a starting point, but we encourage participants to explore and improve upon them!</p>\n<hr>\n<h2>🔥 Key Challenges and Potential Approaches</h2>\n<h3><strong>Aggregating Observation Predictions</strong></h3>\n<p>Each observation consists of multiple images. To maximize prediction accuracy:</p>\n<ul>\n<li><strong>Confidence-Weighted Averaging</strong>: Aggregate predictions from all images within an observation, weighting them by confidence levels.</li>\n<li><strong>Majority Voting</strong>: Assign the final label based on the most frequent top-1 predictions across images.</li>\n<li><strong>Ensemble Methods</strong>: Combine different aggregation techniques for a more robust prediction.</li>\n</ul>\n<h3><strong>Few-Shot Learning and Feature Adaptation</strong></h3>\n<p><strong>Challenge</strong>: Some species have very few labeled samples.</p>\n<h4><strong>Potential Approaches</strong>:</h4>\n<ul>\n<li><strong>Meta-Learning (e.g., MAML, Prototypical Networks)</strong>: Train models to adapt quickly to unseen fungi species with minimal data.</li>\n<li><strong>Feature Transfer Learning</strong>: Use pre-trained embeddings (e.g., BioCLIP, CLIP, DINO) for better generalization.</li>\n<li><strong>Augmentation &amp; Generative Methods</strong>: Use GANs or diffusion models to generate additional samples for rare species.</li>\n</ul>\n<h3><strong>Prototype Optimization for Classification</strong></h3>\n<p>To enhance Nearest Centroid methods:</p>\n<ul>\n<li><strong>Medoid Instead of Centroid</strong>: Use the most central sample instead of the mean to mitigate outlier effects.</li>\n<li><strong>Cluster-Based Prototypes</strong>: Split diverse species into subcategories using clustering algorithms.</li>\n<li><strong>Outlier Filtering</strong>: Identify and remove outlier embeddings before computing the centroid.</li>\n</ul>\n<h3><strong>Improving Nearest Neighbor Classification</strong></h3>\n<ul>\n<li><strong>k-Nearest Neighbors (k-NN)</strong>: Instead of relying on a single nearest neighbor, use majority voting among the top k closest samples. Use <a href=\"https://github.com/facebookresearch/faiss/wiki/Getting-started\" target=\"_blank\">Faiss</a> for fast k-NN implementation.</li>\n<li><strong>Dimensionality Reduction</strong>: Use PCA or t-SNE to remove noise and emphasize important features.</li>\n</ul>\n<h3><strong>Scalable and Efficient Large-Scale Recognition</strong></h3>\n<p><strong>Challenge</strong>: Handling a complex dataset with thousands of species (categories).</p>\n<h4><strong>Potential Approaches</strong>:</h4>\n<ul>\n<li><strong>Efficient Indexing Methods</strong>: Use Approximate Nearest Neighbors (FAISS, HNSW) for fast retrieval.</li>\n<li><strong>Hierarchical Classification Models</strong>: First classify at a higher taxonomic level (e.g., genus), then refine classification at the species level.</li>\n<li><strong>Incremental Learning</strong>: Use continual learning techniques (e.g., EWC, GEM) to adapt dynamically to new species without catastrophic forgetting.</li>\n</ul>\n<hr>\n<h2>🚀 Discussion &amp; Future Directions</h2>\n<p>We encourage participants to explore these methods and share insights. Are you testing a novel open-set recognition technique? Trying a new loss function? Let’s discuss innovative approaches to advancing fungi classification!</p>\n<p>Happy coding! 🎯</p>",
  "messages": [
    {
      "id": "3152959",
      "postDate": "03/18/2025 09:52:18",
      "content": "<p>We’re thrilled to launch <strong>FungiCLEF25</strong>, a competition focused on <strong>few-shot fungi classification</strong> using real-world observational data. The challenge requires innovative approaches to handle species with limited training samples while leveraging multi-image observations effectively.</p>\n<p>In the provided <a href=\"https://www.kaggle.com/code/picekl/fungiclef25-starter-notebook\" target=\"_blank\">starter notebook</a>, two baseline methods—Nearest Neighbor (NN) and Nearest Centroid (NC) classifiers—are introduced. These methods utilize embeddings from the <a href=\"https://huggingface.co/imageomics/bioclip\" target=\"_blank\">BioCLIP</a> model, a vision foundation model tailored for biological taxonomy.</p>\n<ul>\n<li><strong>Nearest Neighbor (NN)</strong>: Assigns a new image to the class of its closest labeled image based on a chosen distance metric (e.g., Euclidean or cosine distance).</li>\n<li><strong>Nearest Centroid (NC)</strong>: Computes the average feature representation (centroid) for each class and assigns new images based on proximity to these centroids.</li>\n</ul>\n<p>These methods serve as a starting point, but we encourage participants to explore and improve upon them!</p>\n<hr>\n<h2>🔥 Key Challenges and Potential Approaches</h2>\n<h3><strong>Aggregating Observation Predictions</strong></h3>\n<p>Each observation consists of multiple images. To maximize prediction accuracy:</p>\n<ul>\n<li><strong>Confidence-Weighted Averaging</strong>: Aggregate predictions from all images within an observation, weighting them by confidence levels.</li>\n<li><strong>Majority Voting</strong>: Assign the final label based on the most frequent top-1 predictions across images.</li>\n<li><strong>Ensemble Methods</strong>: Combine different aggregation techniques for a more robust prediction.</li>\n</ul>\n<h3><strong>Few-Shot Learning and Feature Adaptation</strong></h3>\n<p><strong>Challenge</strong>: Some species have very few labeled samples.</p>\n<h4><strong>Potential Approaches</strong>:</h4>\n<ul>\n<li><strong>Meta-Learning (e.g., MAML, Prototypical Networks)</strong>: Train models to adapt quickly to unseen fungi species with minimal data.</li>\n<li><strong>Feature Transfer Learning</strong>: Use pre-trained embeddings (e.g., BioCLIP, CLIP, DINO) for better generalization.</li>\n<li><strong>Augmentation &amp; Generative Methods</strong>: Use GANs or diffusion models to generate additional samples for rare species.</li>\n</ul>\n<h3><strong>Prototype Optimization for Classification</strong></h3>\n<p>To enhance Nearest Centroid methods:</p>\n<ul>\n<li><strong>Medoid Instead of Centroid</strong>: Use the most central sample instead of the mean to mitigate outlier effects.</li>\n<li><strong>Cluster-Based Prototypes</strong>: Split diverse species into subcategories using clustering algorithms.</li>\n<li><strong>Outlier Filtering</strong>: Identify and remove outlier embeddings before computing the centroid.</li>\n</ul>\n<h3><strong>Improving Nearest Neighbor Classification</strong></h3>\n<ul>\n<li><strong>k-Nearest Neighbors (k-NN)</strong>: Instead of relying on a single nearest neighbor, use majority voting among the top k closest samples. Use <a href=\"https://github.com/facebookresearch/faiss/wiki/Getting-started\" target=\"_blank\">Faiss</a> for fast k-NN implementation.</li>\n<li><strong>Dimensionality Reduction</strong>: Use PCA or t-SNE to remove noise and emphasize important features.</li>\n</ul>\n<h3><strong>Scalable and Efficient Large-Scale Recognition</strong></h3>\n<p><strong>Challenge</strong>: Handling a complex dataset with thousands of species (categories).</p>\n<h4><strong>Potential Approaches</strong>:</h4>\n<ul>\n<li><strong>Efficient Indexing Methods</strong>: Use Approximate Nearest Neighbors (FAISS, HNSW) for fast retrieval.</li>\n<li><strong>Hierarchical Classification Models</strong>: First classify at a higher taxonomic level (e.g., genus), then refine classification at the species level.</li>\n<li><strong>Incremental Learning</strong>: Use continual learning techniques (e.g., EWC, GEM) to adapt dynamically to new species without catastrophic forgetting.</li>\n</ul>\n<hr>\n<h2>🚀 Discussion &amp; Future Directions</h2>\n<p>We encourage participants to explore these methods and share insights. Are you testing a novel open-set recognition technique? Trying a new loss function? Let’s discuss innovative approaches to advancing fungi classification!</p>\n<p>Happy coding! 🎯</p>",
      "rawMarkdown": "We’re thrilled to launch **FungiCLEF25**, a competition focused on **few-shot fungi classification** using real-world observational data. The challenge requires innovative approaches to handle species with limited training samples while leveraging multi-image observations effectively.\n\nIn the provided [starter notebook](https://www.kaggle.com/code/picekl/fungiclef25-starter-notebook), two baseline methods—Nearest Neighbor (NN) and Nearest Centroid (NC) classifiers—are introduced. These methods utilize embeddings from the [BioCLIP](https://huggingface.co/imageomics/bioclip) model, a vision foundation model tailored for biological taxonomy.\n\n- **Nearest Neighbor (NN)**: Assigns a new image to the class of its closest labeled image based on a chosen distance metric (e.g., Euclidean or cosine distance).\n- **Nearest Centroid (NC)**: Computes the average feature representation (centroid) for each class and assigns new images based on proximity to these centroids.\n\nThese methods serve as a starting point, but we encourage participants to explore and improve upon them!\n\n---\n\n## 🔥 Key Challenges and Potential Approaches\n\n### **Aggregating Observation Predictions**\nEach observation consists of multiple images. To maximize prediction accuracy:\n- **Confidence-Weighted Averaging**: Aggregate predictions from all images within an observation, weighting them by confidence levels.\n- **Majority Voting**: Assign the final label based on the most frequent top-1 predictions across images.\n- **Ensemble Methods**: Combine different aggregation techniques for a more robust prediction.\n\n### **Few-Shot Learning and Feature Adaptation**\n**Challenge**: Some species have very few labeled samples.\n\n#### **Potential Approaches**:\n- **Meta-Learning (e.g., MAML, Prototypical Networks)**: Train models to adapt quickly to unseen fungi species with minimal data.\n- **Feature Transfer Learning**: Use pre-trained embeddings (e.g., BioCLIP, CLIP, DINO) for better generalization.\n- **Augmentation & Generative Methods**: Use GANs or diffusion models to generate additional samples for rare species.\n\n### **Prototype Optimization for Classification**\nTo enhance Nearest Centroid methods:\n- **Medoid Instead of Centroid**: Use the most central sample instead of the mean to mitigate outlier effects.\n- **Cluster-Based Prototypes**: Split diverse species into subcategories using clustering algorithms.\n- **Outlier Filtering**: Identify and remove outlier embeddings before computing the centroid.\n\n### **Improving Nearest Neighbor Classification**\n- **k-Nearest Neighbors (k-NN)**: Instead of relying on a single nearest neighbor, use majority voting among the top k closest samples. Use [Faiss](https://github.com/facebookresearch/faiss/wiki/Getting-started) for fast k-NN implementation.\n- **Dimensionality Reduction**: Use PCA or t-SNE to remove noise and emphasize important features.\n\n### **Scalable and Efficient Large-Scale Recognition**\n**Challenge**: Handling a complex dataset with thousands of species (categories).\n\n#### **Potential Approaches**:\n- **Efficient Indexing Methods**: Use Approximate Nearest Neighbors (FAISS, HNSW) for fast retrieval.\n- **Hierarchical Classification Models**: First classify at a higher taxonomic level (e.g., genus), then refine classification at the species level.\n- **Incremental Learning**: Use continual learning techniques (e.g., EWC, GEM) to adapt dynamically to new species without catastrophic forgetting.\n\n---\n\n## 🚀 Discussion & Future Directions\nWe encourage participants to explore these methods and share insights. Are you testing a novel open-set recognition technique? Trying a new loss function? Let’s discuss innovative approaches to advancing fungi classification!\n\nHappy coding! 🎯",
      "votes": null
    },
    {
      "id": "3153483",
      "postDate": "03/18/2025 22:02:50",
      "content": "<p>thank for the hits, I did not find the requiment o on pretrained  models, what kind the pre-trained model can be used?</p>",
      "rawMarkdown": "thank for the hits, I did not find the requiment o on pretrained  models, what kind the pre-trained model can be used?",
      "votes": null
    },
    {
      "id": "3153825",
      "postDate": "03/19/2025 08:09:13",
      "content": "<p>Dear <a href=\"https://www.kaggle.com/wzhang\" target=\"_blank\">@wzhang</a>,</p>\n<p>Any publicly available model should be OK. <br>\nIf you’re unsure, feel free to email us with details about the resource, and we will review it to determine its usability.</p>\n<p>Best regards,<br>\nLukas</p>",
      "rawMarkdown": "Dear @wzhang,\n\nAny publicly available model should be OK. \nIf you’re unsure, feel free to email us with details about the resource, and we will review it to determine its usability.\n\nBest regards,\nLukas",
      "votes": null
    },
    {
      "id": "3159552",
      "postDate": "03/25/2025 18:10:59",
      "content": "<p>I am having trouble understanding what category_id corresponds to. I grouped the training data based on class to get a list of category_id values per class, but I am unsure about their exact meaning.</p>\n<p>Could you clarify whether category_id represents different images of the same species or if they are subcategories that we need to predict? Additionally, could you explain the distinction between class, species, and category_id and what each of them represents in the dataset?</p>",
      "rawMarkdown": "I am having trouble understanding what category_id corresponds to. I grouped the training data based on class to get a list of category_id values per class, but I am unsure about their exact meaning.\n\nCould you clarify whether category_id represents different images of the same species or if they are subcategories that we need to predict? Additionally, could you explain the distinction between class, species, and category_id and what each of them represents in the dataset?",
      "votes": null
    },
    {
      "id": "3160037",
      "postDate": "03/26/2025 09:01:18",
      "content": "<p>Dear <a href=\"https://www.kaggle.com/seemshukla\" target=\"_blank\">@seemshukla</a>,</p>\n<p>In this context, <code>class</code> refers to the taxonomic rank used in biological classification, not a term from machine learning. Taxonomically, a class is a level in the hierarchy of living organisms, situated between phylum and order. For example, the fly agaric mushroom (Amanita muscaria) belongs to the phylum Basidiomycota, the class Agaricomycetes, and the order Agaricales. So when we talk about 'class' here, we mean Agaricomycetes; a biological classification, not a machine learning concept.</p>\n<p>Therefore, <code>category_id</code> is the value you are supposed to predict.</p>\n<p>You can find more about the <a href=\"https://en.wikipedia.org/wiki/Taxonomy_(biology)#Kingdoms_and_domains\" target=\"_blank\">taxonomic ranks</a> in here.</p>\n<p>Best,<br>\nLukas</p>",
      "rawMarkdown": "Dear @seemshukla,\n\nIn this context, `class` refers to the taxonomic rank used in biological classification, not a term from machine learning. Taxonomically, a class is a level in the hierarchy of living organisms, situated between phylum and order. For example, the fly agaric mushroom (Amanita muscaria) belongs to the phylum Basidiomycota, the class Agaricomycetes, and the order Agaricales. So when we talk about 'class' here, we mean Agaricomycetes; a biological classification, not a machine learning concept.\n\nTherefore, `category_id` is the value you are supposed to predict.\n\nYou can find more about the [taxonomic ranks](https://en.wikipedia.org/wiki/Taxonomy_(biology)#Kingdoms_and_domains) in here.\n\nBest,\nLukas",
      "votes": null
    },
    {
      "id": "3160404",
      "postDate": "03/26/2025 18:09:10",
      "content": "<p>Thanks for the clarification.</p>",
      "rawMarkdown": "Thanks for the clarification.",
      "votes": null
    }
  ],
  "comments": [
    {
      "id": 3153483,
      "author_name": "wzhang",
      "author_url": "",
      "post_date": "03/18/2025 22:02:50",
      "content": "<p>thank for the hits, I did not find the requiment o on pretrained  models, what kind the pre-trained model can be used?</p>",
      "votes": null,
      "replies": [
        {
          "id": 3153825,
          "author_name": "picekl",
          "author_url": "",
          "post_date": "03/19/2025 08:09:13",
          "content": "<p>Dear <a href=\"https://www.kaggle.com/wzhang\" target=\"_blank\">@wzhang</a>,</p>\n<p>Any publicly available model should be OK. <br>\nIf you’re unsure, feel free to email us with details about the resource, and we will review it to determine its usability.</p>\n<p>Best regards,<br>\nLukas</p>",
          "votes": null,
          "replies": []
        }
      ]
    },
    {
      "id": 3159552,
      "author_name": "seemshukla",
      "author_url": "",
      "post_date": "03/25/2025 18:10:59",
      "content": "<p>I am having trouble understanding what category_id corresponds to. I grouped the training data based on class to get a list of category_id values per class, but I am unsure about their exact meaning.</p>\n<p>Could you clarify whether category_id represents different images of the same species or if they are subcategories that we need to predict? Additionally, could you explain the distinction between class, species, and category_id and what each of them represents in the dataset?</p>",
      "votes": null,
      "replies": [
        {
          "id": 3160037,
          "author_name": "picekl",
          "author_url": "",
          "post_date": "03/26/2025 09:01:18",
          "content": "<p>Dear <a href=\"https://www.kaggle.com/seemshukla\" target=\"_blank\">@seemshukla</a>,</p>\n<p>In this context, <code>class</code> refers to the taxonomic rank used in biological classification, not a term from machine learning. Taxonomically, a class is a level in the hierarchy of living organisms, situated between phylum and order. For example, the fly agaric mushroom (Amanita muscaria) belongs to the phylum Basidiomycota, the class Agaricomycetes, and the order Agaricales. So when we talk about 'class' here, we mean Agaricomycetes; a biological classification, not a machine learning concept.</p>\n<p>Therefore, <code>category_id</code> is the value you are supposed to predict.</p>\n<p>You can find more about the <a href=\"https://en.wikipedia.org/wiki/Taxonomy_(biology)#Kingdoms_and_domains\" target=\"_blank\">taxonomic ranks</a> in here.</p>\n<p>Best,<br>\nLukas</p>",
          "votes": null,
          "replies": [
            {
              "id": 3160404,
              "author_name": "seemshukla",
              "author_url": "",
              "post_date": "03/26/2025 18:09:10",
              "content": "<p>Thanks for the clarification.</p>",
              "votes": null,
              "replies": []
            }
          ]
        }
      ]
    }
  ],
  "raw_markdown_by_id": {
    "3152959": "We’re thrilled to launch **FungiCLEF25**, a competition focused on **few-shot fungi classification** using real-world observational data. The challenge requires innovative approaches to handle species with limited training samples while leveraging multi-image observations effectively.\n\nIn the provided [starter notebook](https://www.kaggle.com/code/picekl/fungiclef25-starter-notebook), two baseline methods—Nearest Neighbor (NN) and Nearest Centroid (NC) classifiers—are introduced. These methods utilize embeddings from the [BioCLIP](https://huggingface.co/imageomics/bioclip) model, a vision foundation model tailored for biological taxonomy.\n\n- **Nearest Neighbor (NN)**: Assigns a new image to the class of its closest labeled image based on a chosen distance metric (e.g., Euclidean or cosine distance).\n- **Nearest Centroid (NC)**: Computes the average feature representation (centroid) for each class and assigns new images based on proximity to these centroids.\n\nThese methods serve as a starting point, but we encourage participants to explore and improve upon them!\n\n---\n\n## 🔥 Key Challenges and Potential Approaches\n\n### **Aggregating Observation Predictions**\nEach observation consists of multiple images. To maximize prediction accuracy:\n- **Confidence-Weighted Averaging**: Aggregate predictions from all images within an observation, weighting them by confidence levels.\n- **Majority Voting**: Assign the final label based on the most frequent top-1 predictions across images.\n- **Ensemble Methods**: Combine different aggregation techniques for a more robust prediction.\n\n### **Few-Shot Learning and Feature Adaptation**\n**Challenge**: Some species have very few labeled samples.\n\n#### **Potential Approaches**:\n- **Meta-Learning (e.g., MAML, Prototypical Networks)**: Train models to adapt quickly to unseen fungi species with minimal data.\n- **Feature Transfer Learning**: Use pre-trained embeddings (e.g., BioCLIP, CLIP, DINO) for better generalization.\n- **Augmentation & Generative Methods**: Use GANs or diffusion models to generate additional samples for rare species.\n\n### **Prototype Optimization for Classification**\nTo enhance Nearest Centroid methods:\n- **Medoid Instead of Centroid**: Use the most central sample instead of the mean to mitigate outlier effects.\n- **Cluster-Based Prototypes**: Split diverse species into subcategories using clustering algorithms.\n- **Outlier Filtering**: Identify and remove outlier embeddings before computing the centroid.\n\n### **Improving Nearest Neighbor Classification**\n- **k-Nearest Neighbors (k-NN)**: Instead of relying on a single nearest neighbor, use majority voting among the top k closest samples. Use [Faiss](https://github.com/facebookresearch/faiss/wiki/Getting-started) for fast k-NN implementation.\n- **Dimensionality Reduction**: Use PCA or t-SNE to remove noise and emphasize important features.\n\n### **Scalable and Efficient Large-Scale Recognition**\n**Challenge**: Handling a complex dataset with thousands of species (categories).\n\n#### **Potential Approaches**:\n- **Efficient Indexing Methods**: Use Approximate Nearest Neighbors (FAISS, HNSW) for fast retrieval.\n- **Hierarchical Classification Models**: First classify at a higher taxonomic level (e.g., genus), then refine classification at the species level.\n- **Incremental Learning**: Use continual learning techniques (e.g., EWC, GEM) to adapt dynamically to new species without catastrophic forgetting.\n\n---\n\n## 🚀 Discussion & Future Directions\nWe encourage participants to explore these methods and share insights. Are you testing a novel open-set recognition technique? Trying a new loss function? Let’s discuss innovative approaches to advancing fungi classification!\n\nHappy coding! 🎯",
    "3153483": "thank for the hits, I did not find the requiment o on pretrained  models, what kind the pre-trained model can be used?",
    "3153825": "Dear @wzhang,\n\nAny publicly available model should be OK. \nIf you’re unsure, feel free to email us with details about the resource, and we will review it to determine its usability.\n\nBest regards,\nLukas",
    "3159552": "I am having trouble understanding what category_id corresponds to. I grouped the training data based on class to get a list of category_id values per class, but I am unsure about their exact meaning.\n\nCould you clarify whether category_id represents different images of the same species or if they are subcategories that we need to predict? Additionally, could you explain the distinction between class, species, and category_id and what each of them represents in the dataset?",
    "3160037": "Dear @seemshukla,\n\nIn this context, `class` refers to the taxonomic rank used in biological classification, not a term from machine learning. Taxonomically, a class is a level in the hierarchy of living organisms, situated between phylum and order. For example, the fly agaric mushroom (Amanita muscaria) belongs to the phylum Basidiomycota, the class Agaricomycetes, and the order Agaricales. So when we talk about 'class' here, we mean Agaricomycetes; a biological classification, not a machine learning concept.\n\nTherefore, `category_id` is the value you are supposed to predict.\n\nYou can find more about the [taxonomic ranks](https://en.wikipedia.org/wiki/Taxonomy_(biology)#Kingdoms_and_domains) in here.\n\nBest,\nLukas",
    "3160404": "Thanks for the clarification."
  },
  "source": "meta"
}