-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Refactored directory structure and extracted research.org for researc…
…h READMEs
- Loading branch information
1 parent
dbe667f
commit 7540e1a
Showing
21 changed files
with
215 additions
and
630 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -31,5 +31,8 @@ clean | |
|
||
**__pycache__ | ||
|
||
# Exlude buckets from AWS S3 | ||
images | ||
# Datasets | ||
data | ||
|
||
# Models | ||
**.h5 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Binary file not shown.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Binary file added
BIN
+1020 KB
research/02_TrafficSignClassification/01_SimpleObjectClassifierKerasVGG16/README.pdf
Binary file not shown.
File renamed without changes.
Binary file added
BIN
+244 KB
...fication/01_SimpleObjectClassifierKerasVGG16/figure/generatedTrainingImages.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+589 KB
...lassification/01_SimpleObjectClassifierKerasVGG16/figure/testSetPredictions.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
File renamed without changes.
4 changes: 4 additions & 0 deletions
4
research/02_TrafficSignClassification/01_SimpleObjectClassifierKerasVGG16/source/common.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
trainPath = '../data/train/' | ||
testPath = '../data/test/' | ||
classCount = 8 | ||
imageSize = 224 |
File renamed without changes.
46 changes: 46 additions & 0 deletions
46
research/02_TrafficSignClassification/01_SimpleObjectClassifierKerasVGG16/source/testing.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
import keras | ||
from keras.models import load_model | ||
from keras.preprocessing.image import ImageDataGenerator | ||
|
||
import matplotlib.pyplot as pyplot | ||
import numpy as np | ||
import common | ||
|
||
model = load_model('fine_tune.h5') | ||
|
||
test_datagen = ImageDataGenerator() | ||
|
||
test_generator = test_datagen.flow_from_directory( | ||
directory=common.testPath, | ||
target_size=(common.imageSize, common.imageSize), | ||
color_mode='rgb', | ||
shuffle=False, | ||
class_mode='categorical', | ||
batch_size=1) | ||
|
||
filenames = test_generator.filenames | ||
nb_samples = len(filenames) | ||
|
||
fig=pyplot.figure() | ||
columns = 4 | ||
rows = 4 | ||
for i in range(1, columns*rows): | ||
x_batch, y_batch = test_generator.next() | ||
|
||
name = model.predict(x_batch) | ||
name = np.argmax(name, axis=-1) | ||
true_name = y_batch | ||
true_name = np.argmax(true_name, axis=-1) | ||
|
||
label_map = (test_generator.class_indices) | ||
label_map = dict((v,k) for k,v in label_map.items()) #flip k,v | ||
predictions = [label_map[k] for k in name] | ||
true_value = [label_map[k] for k in true_name] | ||
|
||
image = x_batch[0].astype(np.int) | ||
fig.add_subplot(rows, columns, i) | ||
pyplot.axis('off') | ||
pyplot.title(f"guess: {predictions[0]}\nactual: {true_value[0]}") | ||
pyplot.imshow(image) | ||
|
||
pyplot.show() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.