Spaces:
Runtime error
Runtime error
Upload 4 files
Browse files- .gitattributes +2 -0
- Mushrooms_Multilabel_modeling/argryge-DL.1.5/1_mushshrooms-cnn-clasification-cleaning.ipynb +3 -0
- Mushrooms_Multilabel_modeling/argryge-DL.1.5/2.Mushrooms-genus-cnn-modeling.ipynb +3 -0
- Mushrooms_Multilabel_modeling/argryge-DL.1.5/415.ipynb +142 -0
- Mushrooms_Multilabel_modeling/argryge-DL.1.5/README.md +34 -0
.gitattributes
CHANGED
@@ -39,3 +39,5 @@ Hygrocybe_psittacina(WaxCap).jpg filter=lfs diff=lfs merge=lfs -text
|
|
39 |
Lactarius-blennius.jpg filter=lfs diff=lfs merge=lfs -text
|
40 |
Suillus_collinitus.jpg filter=lfs diff=lfs merge=lfs -text
|
41 |
Suillus_granulatus.jpg filter=lfs diff=lfs merge=lfs -text
|
|
|
|
|
|
39 |
Lactarius-blennius.jpg filter=lfs diff=lfs merge=lfs -text
|
40 |
Suillus_collinitus.jpg filter=lfs diff=lfs merge=lfs -text
|
41 |
Suillus_granulatus.jpg filter=lfs diff=lfs merge=lfs -text
|
42 |
+
Mushrooms_Multilabel_modeling/argryge-DL.1.5/1_mushshrooms-cnn-clasification-cleaning.ipynb filter=lfs diff=lfs merge=lfs -text
|
43 |
+
Mushrooms_Multilabel_modeling/argryge-DL.1.5/2.Mushrooms-genus-cnn-modeling.ipynb filter=lfs diff=lfs merge=lfs -text
|
Mushrooms_Multilabel_modeling/argryge-DL.1.5/1_mushshrooms-cnn-clasification-cleaning.ipynb
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:1efc60ee28f1a3f8e8486fc55aeed30269aeb010e50c9b6ca792fcccebc77a0e
|
3 |
+
size 11942605
|
Mushrooms_Multilabel_modeling/argryge-DL.1.5/2.Mushrooms-genus-cnn-modeling.ipynb
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:0db3b38f844056379a6bc6e2016a9b2c3cb5bb3647769ef9eab2ecb578da2564
|
3 |
+
size 13723642
|
Mushrooms_Multilabel_modeling/argryge-DL.1.5/415.ipynb
ADDED
@@ -0,0 +1,142 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
{
|
2 |
+
"cells": [
|
3 |
+
{
|
4 |
+
"cell_type": "markdown",
|
5 |
+
"metadata": {},
|
6 |
+
"source": [
|
7 |
+
"# Module 4: Deep Learning\n",
|
8 |
+
"\n",
|
9 |
+
"## Sprint 1: Computer Vision\n",
|
10 |
+
"\n",
|
11 |
+
"## Know Your Mushrooms"
|
12 |
+
]
|
13 |
+
},
|
14 |
+
{
|
15 |
+
"cell_type": "markdown",
|
16 |
+
"metadata": {},
|
17 |
+
"source": [
|
18 |
+
"<div style=\"text-align:center\">\n",
|
19 |
+
"<div><img style=\"width:400px\" src=\"https://i.pinimg.com/originals/9b/ed/89/9bed89fee3e35c30bbc30f9e9d82b859.jpg\"></img><div>\n",
|
20 |
+
"<div style=\"margin-bottom:20px; color:rgb(117, 117, 117);font-size:12px;\">Source: https://www.pinterest.com/pin/597641813035305267/</div>\n",
|
21 |
+
"</div>"
|
22 |
+
]
|
23 |
+
},
|
24 |
+
{
|
25 |
+
"cell_type": "markdown",
|
26 |
+
"metadata": {},
|
27 |
+
"source": [
|
28 |
+
"## Background\n",
|
29 |
+
"\n",
|
30 |
+
"In US alone, around 7500 yearly cases of mushrooms poisoning are reported [(Source)](https://www.tandfonline.com/doi/full/10.1080/00275514.2018.1479561). According to the source, \"misidentification of edible mushroom species appears to be the most common cause and may be preventable through education\". To avoid expenses for hospitalization and in some cases pointless deaths, you have been hired by US National Health Service to create a machine learning model, that can recognize mushroom types. They want to install this on hand-held devices and to help people make the right choice when mushroom picking. "
|
31 |
+
]
|
32 |
+
},
|
33 |
+
{
|
34 |
+
"cell_type": "markdown",
|
35 |
+
"metadata": {},
|
36 |
+
"source": [
|
37 |
+
"---"
|
38 |
+
]
|
39 |
+
},
|
40 |
+
{
|
41 |
+
"cell_type": "markdown",
|
42 |
+
"metadata": {},
|
43 |
+
"source": [
|
44 |
+
"## Concepts to explore\n",
|
45 |
+
"\n",
|
46 |
+
"Today, we will put everything we learned in this module and use it to solve a classification problem. The idea of this project is to use transfer learning on an architecture of your choice and fine-tune to predict mushroom types.\n",
|
47 |
+
"\n",
|
48 |
+
"You will use this Kaggle dataset https://www.kaggle.com/maysee/mushrooms-classification-common-genuss-images"
|
49 |
+
]
|
50 |
+
},
|
51 |
+
{
|
52 |
+
"cell_type": "markdown",
|
53 |
+
"metadata": {},
|
54 |
+
"source": [
|
55 |
+
"## How to start?\n",
|
56 |
+
"\n",
|
57 |
+
"### Data\n",
|
58 |
+
"Well, the obvious first steps will be getting the data from Kaggle. There are a number of choices on how to do it, such as downloading images to your machine and then uploading to Drive or using [Kaggle API](https://github.com/Kaggle/kaggle-api). Once you get your data, start with an EDA, as this will directly feed into design choices for your architecture.\n",
|
59 |
+
"\n",
|
60 |
+
"### Modeling\n",
|
61 |
+
"\n",
|
62 |
+
"My suggestion is that you start with a simple pre-trained architecture, like ResNet18. This will allow you to fine-tune your net faster and if results are not too good, you can try switching to a larger model later. \n",
|
63 |
+
"It is recommended that you use PyTorch Lightning or FastAI. Both are equally good for simple problems like this, but PyTorch Lightning will give you more control, better customization ability, and better understanding of your network."
|
64 |
+
]
|
65 |
+
},
|
66 |
+
{
|
67 |
+
"cell_type": "markdown",
|
68 |
+
"metadata": {},
|
69 |
+
"source": [
|
70 |
+
"## Requirements:\n",
|
71 |
+
"\n",
|
72 |
+
"- Choose whichever framework you prefer from FastAI, PyTorch Lightning, PyTorch, or Keras.\n",
|
73 |
+
"- As always - EDA\n",
|
74 |
+
"- Use a pre-trained neural net as a backbone of your class\n",
|
75 |
+
"- Train a classifier. Don't forget to fine-tune\n",
|
76 |
+
"- Evaluate inference time\n",
|
77 |
+
"- Visualize results"
|
78 |
+
]
|
79 |
+
},
|
80 |
+
{
|
81 |
+
"cell_type": "markdown",
|
82 |
+
"metadata": {},
|
83 |
+
"source": [
|
84 |
+
"## Evaluation Criteria\n",
|
85 |
+
"\n",
|
86 |
+
"- Model performance\n",
|
87 |
+
" - Classification performance\n",
|
88 |
+
" - Inference speed\n",
|
89 |
+
"- EDA and documented findings\n",
|
90 |
+
"- Results analysis\n",
|
91 |
+
"- Code quality"
|
92 |
+
]
|
93 |
+
},
|
94 |
+
{
|
95 |
+
"cell_type": "markdown",
|
96 |
+
"metadata": {},
|
97 |
+
"source": [
|
98 |
+
"## Bonus challenges\n",
|
99 |
+
"\n",
|
100 |
+
"- Repeat the process with modifications to your network and see how the results vary. \n",
|
101 |
+
" - Try a different optimizer\n",
|
102 |
+
" - Add an intermediate layer between the backbone and output layer"
|
103 |
+
]
|
104 |
+
},
|
105 |
+
{
|
106 |
+
"cell_type": "markdown",
|
107 |
+
"metadata": {},
|
108 |
+
"source": [
|
109 |
+
"\n",
|
110 |
+
"## Sample correction questions\n",
|
111 |
+
"\n",
|
112 |
+
"During a correction, you may get asked questions that test your understanding of covered topics.\n",
|
113 |
+
"\n",
|
114 |
+
"- Describe how a convolutional layers works\n",
|
115 |
+
"- What is overfitting? Describe why is it bad/good and how to detect it?\n",
|
116 |
+
"- What is an optimizer? Describe in high level how it works.\n",
|
117 |
+
"- What are the advantages/disadvantages of transfer learning?"
|
118 |
+
]
|
119 |
+
}
|
120 |
+
],
|
121 |
+
"metadata": {
|
122 |
+
"kernelspec": {
|
123 |
+
"display_name": "Python 3",
|
124 |
+
"language": "python",
|
125 |
+
"name": "python3"
|
126 |
+
},
|
127 |
+
"language_info": {
|
128 |
+
"codemirror_mode": {
|
129 |
+
"name": "ipython",
|
130 |
+
"version": 3
|
131 |
+
},
|
132 |
+
"file_extension": ".py",
|
133 |
+
"mimetype": "text/x-python",
|
134 |
+
"name": "python",
|
135 |
+
"nbconvert_exporter": "python",
|
136 |
+
"pygments_lexer": "ipython3",
|
137 |
+
"version": "3.8.5"
|
138 |
+
}
|
139 |
+
},
|
140 |
+
"nbformat": 4,
|
141 |
+
"nbformat_minor": 4
|
142 |
+
}
|
Mushrooms_Multilabel_modeling/argryge-DL.1.5/README.md
ADDED
@@ -0,0 +1,34 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
Northern European Mushroom Genus Classification Model for Poisonous Species Detection
|
2 |
+
|
3 |
+
Description:
|
4 |
+
This repository presents a machine learning model designed to help prevent mushroom poisoning by accurately classifying the genus of common Northern European mushrooms based on image data. It emphasizes the crucial step of cleaning and pre-processing images to enhance model performance.
|
5 |
+
|
6 |
+
Which genera were used to train the model?
|
7 |
+
Genera:
|
8 |
+
|
9 |
+
Amanita
|
10 |
+
Boletus
|
11 |
+
Hygrocybe
|
12 |
+
Entoloma
|
13 |
+
Russula
|
14 |
+
Agaricus
|
15 |
+
Lactarius
|
16 |
+
Webcaps Cortinarius
|
17 |
+
Slippery Jacks Suillus
|
18 |
+
|
19 |
+
Key Features:
|
20 |
+
|
21 |
+
Classifies common Northern European mushroom genera using image data.
|
22 |
+
Includes thorough image cleaning and pre-processing steps for improved accuracy.
|
23 |
+
Provides clear instructions for running the model.
|
24 |
+
|
25 |
+
Target Audience:
|
26 |
+
|
27 |
+
Individuals concerned with safe mushroom foraging in Northern Europe.
|
28 |
+
Machine learning enthusiasts interested in image classification tasks.
|
29 |
+
Researchers working on mushroom identification and toxicity detection.
|
30 |
+
|
31 |
+
* After modeling we have found:
|
32 |
+
* best performing model: convnext_tiny_in22k
|
33 |
+
* error rate: 0.036
|
34 |
+
* Macro avg: precision 0.96 and recall 0.96
|