-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathExercise template part 1.ipybn
228 lines (228 loc) · 8.02 KB
/
Exercise template part 1.ipybn
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
{
"cells": [
{
"cell_type": "markdown",
"id": "48574939",
"metadata": {},
"source": [
"This is the template for the image recognition exercise. <Br>\n",
"Some **general instructions**, read these carefully:\n",
" - The final assignment is returned as a clear and understandable *report*\n",
" - define shortly the concepts and explain the phases you use\n",
" - use the Markdown feature of the notebook for larger explanations\n",
" - return your output as a *working* Jupyter notebook\n",
" - name your file as Exercise_MLPR2023_Partx_uuid.jpynb\n",
" - use the uuid code determined below\n",
" - use this same code for each part of the assignment\n",
" - write easily readable code with comments \n",
" - if you exploit code from web, provide a reference\n",
" - it is ok to discuss with a friend about the assignment. But it is not ok to copy someone's work. Everyone should submit their own implementation\n",
" - in case of identical submissions, both submissions are failed "
]
},
{
"cell_type": "markdown",
"id": "0bfbc2b3",
"metadata": {},
"source": [
"**Deadlines:**\n",
"- Part 1: Mon 6.2 at 23:59\n",
"- Part 2: Mon 20.2 at 23:59\n",
"- Part 3: Mon 6.3 at 23:59\n",
"\n",
"**No extensions for the deadlines** <br>\n",
"- after each deadline, example results are given, and it is not possible to submit anymore\n",
"\n",
"**If you encounter problems, Google first and if you can’t find an answer, ask for help**\n",
"- Moodle area for questions\n",
"- [email protected]\n",
"- teacher available for questions\n",
" - Monday 30.1 at 14:00-15:00 room 407B Honka (Agora 4th floor)\n",
" - Monday 13.2 at 14:00-15:00 room 407B Honka (Agora 4th floor)\n",
" - Thursday 2.3 at lecture 10:15-12:00 "
]
},
{
"cell_type": "markdown",
"id": "ea03f4ab",
"metadata": {},
"source": [
"**Grading**\n",
"\n",
"The exercise covers a part of the grading in this course. The course exam has 5 questions, 6 points of each. Exercise gives 6 points, i.e. the total score is 36 points.\n",
"\n",
"From the template below, you can see how many exercise points can be acquired from each task. Exam points are given according to the table below: <br>\n",
"<br>\n",
"7 exercise points: 1 exam point <br>\n",
"8 exercise points: 2 exam points <br>\n",
"9 exercise points: 3 exam points <br>\n",
"10 exercise points: 4 exam points <br>\n",
"11 exercise points: 5 exam points <br>\n",
"12 exercise points: 6 exam points <br>\n",
"<br>\n",
"To pass the exercise, you need at least 7 exercise points, and at least 1 exercise point from each Part.\n",
" \n",
"Each student will grade one submission from a peer and their own submission. After each Part deadline, example results are given. Study them carefully and perform the grading according to the given instructions. Mean value from the peer grading and self-grading is used for the final points. "
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "20913a7e",
"metadata": {},
"outputs": [],
"source": [
"import uuid\n",
"# Run this cell only once and save the code. Use the same id code for each Part.\n",
"# Printing random id using uuid1()\n",
"print (\"The id code is: \",end=\"\")\n",
"print (uuid.uuid1())"
]
},
{
"cell_type": "markdown",
"id": "fb9b2c64",
"metadata": {},
"source": [
"# Part 1"
]
},
{
"cell_type": "markdown",
"id": "41f6c75d",
"metadata": {},
"source": [
"Read the original research article:\n",
"\n",
"İ. Çınar and M. Koklu. Identification of rice varieties using machine learning algorithms. Journal of Agricultural Sciences, 28(2):307–325, 2022. doi: 10.15832/ankutbd.862482.\n",
"\n",
"https://dergipark.org.tr/en/download/article-file/1513632"
]
},
{
"cell_type": "markdown",
"id": "3ce21d52",
"metadata": {},
"source": [
"## Introduction (1 p)"
]
},
{
"cell_type": "markdown",
"id": "35ca8979",
"metadata": {},
"source": [
"Will be written in Part 3"
]
},
{
"cell_type": "markdown",
"id": "6f605da2",
"metadata": {},
"source": [
"## Preparations of the data (1 p)"
]
},
{
"cell_type": "markdown",
"id": "bd900472",
"metadata": {},
"source": [
"Make three folders in your working folder: \"notebooks\", \"data\" and \"training_data\". Save this notebook in \"notebooks\" folder.\n",
"<br> <br>\n",
"Perform preparations for the data\n",
"- import all the packages needed for this notebook in one cell \n",
"- import the images. Data can be found from (downloading starts as you press the link) https://www.muratkoklu.com/datasets/vtdhnd09.php <br>\n",
" - save the data folders \"Arborio\", \"Basmati\" and \"Jasmine\" in \"data\" folder \n",
"- take a random sample of 100 images from Arborio, Basmati and Jasmine rice species (i.e. 300 images in total) \n",
"- determine the contour of each rice (you can use e.g. *findContours* from OpenCV) \n",
"- plot one example image of each rice species, including the contour "
]
},
{
"cell_type": "markdown",
"id": "b8386fd1",
"metadata": {},
"source": [
"## Feature extraction (2 p)"
]
},
{
"cell_type": "markdown",
"id": "83cc994d",
"metadata": {},
"source": [
"Gather the feature data <br>\n",
"<br>\n",
"Color features (15) <br>\n",
"- Calculate the following color features for each image, including only the pixels within the contour (you can use e.g. *pointPolygonTest* from OpenCV)\n",
" - Mean for each RGB color channel \n",
" - Variance for each RGB color channel \n",
" - Skewness for each RGB color channel \n",
" - Kurtosis for each RGB color channel \n",
" - Entropy for each RGB color channel \n",
" \n",
"Dimension features (6) <br>\n",
"- Fit an ellipse to the contour points (you can use e.g. *fitEllipse* from OpenCV) \n",
"- Plot one example image of each rice species including the fitted ellipse \n",
"- Calculate the following features for each image (for details, see the original article)\n",
" - the major axis length the ellipse \n",
" - the minor axis length of the ellipse \n",
" - area inside the contour (you can use e.g. *contourArea* from OpenCV) \n",
" - perimeter of the contour (you can use e.g. *arcLength* from OpenCV) \n",
" - roundness \n",
" - aspect ratio \n",
" \n",
"Gather all the features in one array or dataframe: one data point in one row, including all feature values in columns. <br>\n",
"For each data point, include also information of the original image and the label (rice species). Save the data in \"training_data\" folder. "
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "d7c4e2d1",
"metadata": {},
"outputs": [],
"source": []
}
],
"metadata": {
"kernelspec": {
"display_name": "Python [conda env:env1]",
"language": "python",
"name": "conda-env-env1-py"
},
"language_info": {
"codemirror_mode": {
"name": "ipython",
"version": 3
},
"file_extension": ".py",
"mimetype": "text/x-python",
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.10.5"
},
"toc": {
"base_numbering": 1,
"nav_menu": {},
"number_sections": true,
"sideBar": true,
"skip_h1_title": false,
"title_cell": "Table of Contents",
"title_sidebar": "Contents",
"toc_cell": false,
"toc_position": {
"height": "calc(100% - 180px)",
"left": "10px",
"top": "150px",
"width": "232px"
},
"toc_section_display": true,
"toc_window_display": true
}
},
"nbformat": 4,
"nbformat_minor": 5
}