Most foodborne deaths in China do not come from bacteria in restaurant kitchens. They come from people at home eating a wild mushroom or plant they mistook for an edible one. Poisonous mushrooms caused 55.9% of the country's foodborne deaths in 2020, and private homes accounted for 89.5% of deaths (Li et al., 2021). In Zhejiang, mushrooms caused 16.8% of outbreaks but 75% of deaths (Chen et al., 2022). Kitchen hygiene rules never reach a forager's kitchen, so a phone-based identification tool is one of the few interventions that could. For such a tool, calling a deadly mushroom "edible" is roughly a hundred times worse than the reverse.
This note asks one question: where should the edible/poisonous boundary sit when the poisonous species in the field may never have appeared in training? Current fungi classifiers handle the asymmetric cost by lowering a probability threshold after training. That rule is the textbook choice when probabilities are calibrated, but rare and unseen species are exactly where calibration breaks. We propose to train a linear large-margin classifier (a support vector machine, or SVM, which places a hyperplane as far as possible from both classes) on frozen deep image features. We would place that boundary with "apportioned margin," a method that deliberately gives the poisonous side a wider geometric buffer. The test that matters is whether this buffer catches poisonous species held out entirely from training better than a threshold-shifted probabilistic classifier does.
Core Claim
Our hypothesis concerns frozen embeddings from a large vision backbone. In such a space, poisonous and edible training species are close to linearly separable, because there are many dimensions and few images per species. Under separability, Gottlieb et al., 2021 showed that ordinary cost weighting of SVM errors does not move the boundary at all: it stays at the margin midpoint. Their apportioned margin instead moves the boundary toward the low-cost class in proportion to a priority ratio. They reported 10–20% lower expected risk than weighted multiclass baselines, and 86% versus 81.5% (weighted softmax) sensitivity on a CIFAR-100 superclass.
A shifted probability threshold buys safety only where the model is confidently calibrated. A geometric buffer instead claims a slab of feature space for the poisonous class, and that slab extends to unseen lookalikes that land near the boundary. We claim the advantage should appear specifically on held-out poisonous species. If it shows up only on seen species, or not at all, the idea is wrong and the simple threshold rule should be preferred.
Relation to Prior Work
The closest work is the FungiCLEF2024 "upupup" system (Tan et al., 2024). It combines ViT-Large and Eva02-Large backbones, a metadata-fusion network, and an entropy-based rejector for unknown species. It merges 49 poisonous species into one macro-class and flags poison at 1% probability, which gave the lowest cost loss in the competition (0.0718). Their 1% threshold is not arbitrary: with costs of 100 versus 1, the cost-minimizing rule for calibrated probabilities flags poison above about 1/101. Our proposal therefore does not claim they used a heuristic. It asks whether a training-time geometric buffer outperforms a test-time threshold when calibration fails on novel species. They never isolate that question, because they change backbone, loss and threshold together.
The fine-grained benchmarks DF20 and the FungiCLEF 2022 winner (Xiong et al., 2022) supply the data and features. They optimize accuracy or F1, not asymmetric cost.
Two cost-sensitive SVM papers supply competing linear methods. Katsumata & Takeda, 2015 place larger uncertainty balls around minority-class points, which is equivalent to class-specific regularization. Gu et al., 2015 find the exact cross-validation optimum over the two class penalties. Its cost grows roughly quadratically to cubically in sample count, so it does not scale to DF20, and we use budget-matched search instead.
The case for linear heads on small, high-dimensional data rests on two papers. A linear SVM reached 89.29% and 95.29% on hyperspectral jerky data (Food, 2025). A neural network on bongkrekic-acid strain typing scored 100% internally but only 86.7% on external strains (Foods, 2024). We treat these as motivation only. No hyperspectral or genotype dataset of lethal lookalikes exists in the file, so we do not build on either.
Research Program
We would first build toxicity labels for DF20 species using the FungiCLEF2024 poisonous list. We would then construct two splits. One is the standard split. The other holds out whole poisonous species, and separately whole genera, so that some poisonous test images belong to taxa never seen in training.
Next, we would extract frozen embeddings from one strong backbone, matching upupup's Eva02-Large where possible, with and without the habitat and substrate metadata that DF20 found most useful. As a diagnostic, we would solve the hard-margin feasibility problem for poisonous versus edible, on full data and on subsamples. This checks whether the separability regime that Gottlieb et al.'s argument requires actually holds.
On these fixed features we would train linear binary poison gates of four kinds: standard SVM, weighted-hinge SVM, robust cost-sensitive SVM, and apportioned-margin SVM. We would also train logistic regression with the cost-minimizing threshold, both with and without temperature calibration. Each gate sits on top of the same species classifier, and evaluation uses the FungiCLEF2024 cost matrix.
Finally, we would sweep the cost ratio from 10 to 1000. This tests whether conclusions hold as the false-negative cost changes. We can only justify the exact fatal-error ratio loosely from case-fatality figures such as 0.47% overall in Zhejiang (Chen et al., 2021), so robustness across ratios matters.
Baselines
The naive reference is the species classifier's top prediction, mapped to edible or poisonous with no cost adjustment. A second trivial reference flags every observation as poisonous; its cost equals the edible fraction and it caps how much over-flagging is tolerable.
The strongest existing system is upupup (Tan et al., 2024), which reports a FungiCLEF2024 Track 2 cost loss of 0.0718. We compare against that number on the official test set using a head built on the same backbone family plus metadata. We acknowledge that their ensemble uses more compute, so we also report a same-backbone re-implementation of their 1% rule.
The fairest and most threatening baseline is logistic regression on the identical frozen features with a Bayes threshold and temperature calibration. Every linear head gets the same features, the same validation data and the same hyperparameter budget: 64 configurations each, chosen by cross-validated cost.
The ablation isolates the key ingredient. We compare weighted-hinge SVM against apportioned-margin SVM, which differ only in how the boundary is placed. Beating the field means lower cost than the calibrated-logistic baseline on held-out poisonous species, with non-overlapping bootstrap intervals across five seeds, and no worse than 0.0718 on the standard test.
Why not just…?
Why not just threshold calibrated probabilities, as upupup does? This is the real threat, and on seen species it may well win, since the threshold rule is optimal under calibration. Our held-out-species split settles it. If calibrated logistic regression matches apportioned margin there too, we will report that the geometric buffer adds nothing and recommend the simpler rule.
Why not just fine-tune the whole network with a cost-weighted loss? Fine-tuning gives a different feature space and so confounds feature quality with boundary placement. It also costs far more compute per cost ratio, whereas a linear head re-solves in minutes. We include a cost-weighted fine-tuned model on the standard split for reference. The claim we test, though, concerns boundary placement on fixed features, where Gottlieb et al. show weighted losses fail under separability.
Why not just weight the SVM's error penalties or oversample poisonous images? Under separability, penalty weighting leaves the boundary at the midpoint (Gottlieb et al., 2021). Robust uncertainty sets already outperform synthetic sampling on imbalanced benchmarks (Katsumata & Takeda, 2015). Our separability diagnostic tells us whether this argument applies. If the data turn out not to be separable, weighted hinge should close the gap, and the ablation will show it.
Decisive Checks
The proposal succeeds only if three things hold together. Training embeddings must be near-separable. Weighted-hinge SVM must leave the boundary roughly where it was. Apportioned margin must then cut cost on held-out poisonous species relative to calibrated thresholding across the cost-ratio sweep.
We will also plot each method's poisonous-recall curve against distance from the boundary for unseen species. This checks whether unseen lookalikes really fall inside the buffer, which is the mechanism the claim depends on. If held-out poisonous species land deep on the edible side, no linear buffer can catch them. We will report that as a limit of frozen features rather than of the classifier.
References
- Characteristics of Settings and Etiologic Agents of Foodborne Disease Outbreaks — China, 2020
- Surveillance for foodborne disease outbreaks in Zhejiang Province, China, 2015–2020
- Apportioned margin approach for cost sensitive large margin classifiers
- Say No to the Poisonous Fungi: An Effective Strategy for Reducing 0-1 Cost in FungiCLEF2024
- Danish Fungi 2020 - Not Just Another Image Recognition Dataset
- 1st Place Solution for FungiCLEF 2022 Competition: Fine-grained Open-set Fungi Recognition
- Robust Cost Sensitive Support Vector Machine
- Bi-Parameter Space Partition for Cost-Sensitive SVM
- Non-destructive identification of commercial jerky types based on multi-band hyperspectral imaging with machine learning
- Identification of Burkholderia gladioli pv. cocovenenans in Black Fungus and Efficient Recognition of Bongkrekic Acid and Toxoflavin Producing Phenotype by Back Propagation Neural Network
- Epidemiological analysis of wild mushroom poisoning in Zhejiang province, China, 2016–2018