Skip to content

Commit c874a2e

Browse files
Update traffic_sign.md
1 parent 1c8119f commit c874a2e

File tree

1 file changed

+5
-85
lines changed

1 file changed

+5
-85
lines changed

Theory/traffic_sign.md

Lines changed: 5 additions & 85 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,11 @@ Implementing Traffic Sign Classification in Python for Computer Vision tasks in
44

55
## Test online [here](https://valentynsichkar.name/traffic_signs.html)
66

7+
### Courses:
8+
* Explore course **"Convolutional Neural Networks for Image Classification"** here: https://stepik.org/course/53801/promo
9+
710
## Content
8-
Theory and experimental results (on this page):
11+
Short description of the content. Full codes you can find inside the course by link above:
912

1013
* [Loading Data](#loading-data)
1114
* [Unique Training Examples](#unique-examples)
@@ -26,7 +29,7 @@ Theory and experimental results (on this page):
2629
<br/>
2730

2831
### <a id="loading-data">Loading Data</a>
29-
Data used for this task is **German Traffic Sign Benchmarks (GTSB)**.
32+
Data used for this task is **German Traffic Sign Benchmarks (GTSRB)**.
3033
<br/>Initially dataset consists of images in ***PPM*** format with different sizes.
3134

3235
For current task datasets were organized in the same way as it was done for [CIFAR-10 Image Classification](https://github.com/sichkar-valentyn/Neural_Networks_for_Computer_Vision/blob/master/Theory/cifar10.md):
@@ -158,8 +161,6 @@ Shapes of data4 - data8 are as following (Gray):
158161
For **Model 1** architecture will be used as it was done for [CIFAR-10 Image Classification](https://github.com/sichkar-valentyn/Neural_Networks_for_Computer_Vision/blob/master/Theory/cifar10.md):
159162
<br/>`Input` --> `Conv` --> `ReLU` --> `Pool` --> `Affine` --> `ReLU` --> `Affine` --> `Softmax`
160163

161-
![Model_1_Architecture_TS.png](https://github.com/sichkar-valentyn/Neural_Networks_for_Computer_Vision/blob/master/images/Model_1_Architecture_TS.png)
162-
163164
<br/>For **Model 1** following parameters will be used:
164165

165166
| Parameter | Description |
@@ -175,52 +176,6 @@ For **Model 1** architecture will be used as it was done for [CIFAR-10 Image Cla
175176

176177
### <a id="overfitting-small-data-for-model-1">Overfitting Small Data for Model 1</a>
177178
For Overfitting Small Data of Model 1 dataset **'data8.pickle'** was chosen.
178-
<br>Code for Overfitting Small Data for Model 1 will be used as it was done for [CIFAR-10 Image Classification](https://github.com/sichkar-valentyn/Neural_Networks_for_Computer_Vision/blob/master/Theory/cifar10.md):
179-
180-
```py
181-
import numpy as np
182-
183-
# Importing module 'ConvNet1.py'
184-
from Helper_Functions.ConvNet1 import *
185-
186-
# Importing module 'Solver.py'
187-
from Solver import *
188-
189-
# Loading data
190-
# Opening file for reading in binary mode
191-
with open('Data_Preprocessing/data8.pickle', 'rb') as f:
192-
d = pickle.load(f, encoding='latin1') # dictionary type
193-
194-
# Number of training examples
195-
number_of_training_data = 10
196-
197-
# Preparing data by slicing in 'data' dictionary appropriate array
198-
small_data = {
199-
'x_train':d['x_train'][:number_of_training_data],
200-
'y_train':d['y_train'][:number_of_training_data],
201-
'x_validation':d['x_validation'],
202-
'y_validation':d['y_validation']
203-
}
204-
205-
# Creating instance of class for 'ConvNet1' and initializing model
206-
model = ConvNet1(weight_scale=1e-2, hidden_dimension=100)
207-
208-
# Creating instance of class for 'Solver' and initializing model
209-
solver = Solver(model,
210-
small_data,
211-
update_rule='adam',
212-
optimization_config={'learning_rate':1e-3},
213-
learning_rate_decay=1.0,
214-
batch_size=50,
215-
number_of_epochs=100,
216-
print_every=1,
217-
verbose_mode=True
218-
)
219-
220-
# Running training process
221-
solver.train()
222-
```
223-
224179
Overfitting Small Data with 10 training examples and 100 epochs is shown on the figure below.
225180

226181
![Overfitting_Small_Data_for_Model_1_TS.png](https://github.com/sichkar-valentyn/Neural_Networks_for_Computer_Vision/blob/master/images/Overfitting_Small_Data_for_Model_1_TS.png)
@@ -229,41 +184,6 @@ Overfitting Small Data with 10 training examples and 100 epochs is shown on the
229184

230185
### <a id="training-of-model-1">Training of Model 1</a>
231186
For training Model 1 dataset **'data8.pickle'** was chosen as it reached the best accuracy over all datasets.
232-
<br>Code for training Model 1 will be used as it was done for [CIFAR-10 Image Classification](https://github.com/sichkar-valentyn/Neural_Networks_for_Computer_Vision/blob/master/Theory/cifar10.md):
233-
234-
```py
235-
import numpy as np
236-
237-
# Importing module 'ConvNet1.py'
238-
from Helper_Functions.ConvNet1 import *
239-
240-
# Importing module 'Solver.py'
241-
from Solver import *
242-
243-
# Loading data
244-
# Opening file for reading in binary mode
245-
with open('Data_Preprocessing/data8.pickle', 'rb') as f:
246-
d = pickle.load(f, encoding='latin1') # dictionary type
247-
248-
# Creating instance of class for 'ConvNet1' and initializing model
249-
model = ConvNet1(input_dimension=(1, 32, 32), weight_scale=1e-3, hidden_dimension=500, regularization=1-e3)
250-
251-
# Creating instance of class for 'Solver' and initializing model
252-
solver = Solver(model,
253-
d,
254-
update_rule='adam',
255-
optimization_config={'learning_rate':1e-3},
256-
learning_rate_decay=1.0,
257-
batch_size=50,
258-
number_of_epochs=50,
259-
print_every=1,
260-
verbose_mode=True
261-
)
262-
263-
# Running training process
264-
solver.train()
265-
```
266-
267187
Model 1 with 'data8.pickle' dataset reached **0.989** training accuracy.
268188
<br/>Training process of Model 1 with **17 500** iterations is shown on the figure below.
269189

0 commit comments

Comments
 (0)